# # Program for the fixed iteration # x[k] = g(x[k-1]) # # Input: g --- the function as an operator # x0 --- the initial iterate # N --- the maximum steps allowed # tol --- the error tolerance # fixed_it:=proc( g::operator, x0::numeric, N::integer, tol::numeric ) local x, k; x:=array(0..N); x[0]:=x0; for k from 1 to N do x[k]:= g(x[k-1]); print( k, x[k], abs( x[k]-x[k-1]) ); # stopping criterion if abs(x[k]-x[k-1])