function x=Newton(func,x)

% Solving f(x)=0 with the Newton's method

tol=10^(-10); k=1; kmax=20;
f=feval(func,x); err=norm(f); 

while err>tol ,
   M=Df(func,x); x=x-M\f; 
   f=feval(func,x); err=norm(f); 
   k=k+1; if k>kmax , err=0; x=NaN*x; end; end


   
