function newton; % newtons's method %p=pi p=0.28 % n is the number if iterations n=7; for i=1:1:n f(p) der_f(p) p=p-f(p)/der_f(p) end function y=f(x); % use example 2.2#7 solve as root finding problem by Newton's method %y=pi+0.5*sin(x/2)-x; y=10*x^3-8.3*x^2+2.295*x-0.21141; function y=der_f(x); % use example 2.2#7 solve as root finding problem by Newton's method %y=cos(x/2)/4-1; y=30*x^2-16.6*x+2.295;