function x=newton(x0,n) for i=1:n x=x0-f(x0)/df(x0); x0=x; endfor endfunction