function out=NewtonMethod(F,x0,numits,tol) % Inputs to Newton's Method: % F- Name of a function that returns BOTH % values of g(x) and g'(x) % x0= Initial value of x. % numits= Maximum number of iterations % tol = Tolerance (like 1e-6) measures % change between iterates of x for k=1:numits [g,gprime]=feval(F,x0); if gprime==0 error('Derivative is zero'); end xnew=x0-g/gprime; d=abs(xnew-x0); if d