1.Decide the initial values forx1 and x2 and stopping criterion,
E.
2.Compute f1 =f(x1) and f2 = f(x2)
3.If f1*f2>0, then x1+x2 do not bracket any root and goto
step7. otherwise continue.
4. Compute xm = (x1+x2)/2 and compute f0=f(x0).
5. If f1*f0<0 then
set x2=xm
else
set x1=xm
6. If absolute value of (x2-x1)/x2 is less then error E, than
root = (x1+x2)/2
write the value of root,
goto step 7
else,
goto step 4
7. stop.
No comments:
Post a Comment