Xo = 0;%lower limit h = .01;%intervals Xn = 2;%upper limit y = 3.*exp(2.*Xo)./(exp(2.*Xo)+2);%the function at Xo dy = 2.*(1-y./3).*y;%the derivative of y at Xo %%%%%%%%%%%%%%%%Richardson%%%%%%%%%%%%%%%%%%%%%%%%% %f = y; %df = -f; %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% for x = h:h:Xn Y = y + h.*dy;%the value of the tangent line at x %%%%%%%%%%%%%%%%Richardson%%%%%%%%%%%%%%%%%%%%%%%%% %F = f + 2.*h.*df; %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% func = 3.*exp(2.*x)./(exp(2.*x)+2);%actual function %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %Error = func - Y; %Rel = Error/func; %%%%%%%%%%%%%%%%Richardson%%%%%%%%%%%%%%%%%%%%%%%%% %RError = 2.*Y - F; %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% [x, func, Y] y = Y;%function at Xn %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% dy = 2.*(1-y./3).*y;%derivative of y at Xn %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%Richardson%%%%%%%%%%%%%%%%%%%%%%%%% %f=F; %df = -f; %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% end