function root=newton(x0,epsilon)

format long 


f0=f(x0);
f1=fprime(x0);
if (abs(f1)<1.0e-26)
    fprintf('Error: Derivative almost zero\n')
    return
end
x1=x0-f0/f1;    


fprintf('n        x_n            x_n-x_{n-1}             f(xn)\n');
fprintf('-------------------------------------------------\n');
n=1;
nmax=100;

fprintf('%d     %2.10f    %2.10f    %e\n',n,x1,abs(x0-x1),f(x1));        
while ((abs(x0 - x1) > epsilon) &(n<nmax))
   n=n+1; 
   x0=x1;
   f0=f(x0);
   f1=fprime(x0);
   x1=x0-f0/f1;
   fprintf('%d     %2.10f    %2.10f   %e \n',n,x1,abs(x0-x1),f(x1));
    
end
if (n==nmax)
    fprintf('Error: Performed maximum number of iterations\n')
    return
end
root=x1;   