# Example 2 in Section 2.2 by Fixed-Point Iterations

       

      # Math 354 / Mast 334 by Dr. M. Mei

 

 

> g:=x->sqrt(10/(x+4));

> i:=1;maxstep:=100; tolerance:=0.01; err:=100; a:=1;

> for i from 1 to maxstep while (evalf(err)>tolerance) and (a<2) do p:=g(a);

> err:=abs(p-a); a:=evalf(p); print(a," error= ", evalf(err)); end do;

>