You are on page 1of 3

Unit 2

Bisection Method Step 1 [Read the Initial Range values of x1 and x2]
Read x1, x2

Step 2 [Read prescribed tolerance]


Read epsilon

Step 3
Calculate f1=f (x1) and f2=f (x2)

Step 4
If (f1*f2)>0 Go to step 10 Endif

Step 5
If absolute ((x1-x2)/x1)<Epsilon Go to step 9 Endif

Step 6
Set x0=(x1+x2)/2

Step 7
Calculate f0=f (x0)

Step 8
If (f1*f0)<0 then Set x2=xo, f2=f0 Else Set x1=x0, f1=f0 Endif

Step 9
Repeat step 4

Step 10
Write root = x0

Step 11[Stop]
End

False Position Method Step 1 [Read the Initial Range values of x1 and x2]
Read x1, x2

Step 2 [Read prescribed tolerance]


Read epsilon

Step 3
Calculate f1=f (x1) and f2=f (x2)

Step 4
If (f1*f2)>0 Go to step 11 Endif

Step 5
Set x0=((x1*f2)-(x2*f1)/(f2-f1))

Step 6
If absolute ((x1-x2)/x1)<Epsilon Go to step 10 Endif

Step 7
Calculate f0=f (x0)

Step 8
If (f1*f0)<0 then Set x2=xo, f2=f0 Else Set x1=x0, f1=f0 Endif

Step 9
Repeat step 5

Step 10
Write root = x0

Step 11 [Stop]
End

Newton Raphson Step 1 [Read the Initial value of X0]


Read x0

Step 2 [Read Prescribed Tolerance]


Read Epsilon

Step 3
If absolute (f (x0)) <epsilon Go to step Endif

Step 4
Calculate x1=x0- (f (x)/f (x))

Step 5
If absolute ((x1-x0)/x1)<epsilon Go to step Endif

Step 6
Set x0=x1

Step 7
Go to step 3

Step 8
Write root = x1

Step 9 [Stop]
End

You might also like