% Iterative method x0 = 2; % initial point maxiterate = 10^3; % the maximum of the iteration steps error_tolerence = 10^-5; % the error tolerance x = g(x0); itcount = 1; %it_count is the iteration steps, starting with 1 while abs(x-x0)>=error_tolerence && itcount