ALGORITHM FOR BISECTION METHOD
1- Enter f(x), error, max_iteration.
2- Enter a and b such that f (a).f (b) <0.
3- if f (a).f (b)>0 then
goto step 2
4- for (i=0; i<max_iteration; i++)
{
x= (a+b)/2
if f(x).f (a) <0
b=x;
else
a=x;
if [(b-a)/b <=error]
{
printf “Root is x”
Stop
}
}
5- printf “Solution does not converge in
max_iteration.
6- Stop
No comments:
Post a Comment