function [xout,fout] = newton2_tdelillo(f,fprime,x0,tol)
% Newton iteration for solving f(x) = 0
% intial guess x0, tolerance tol
n = 5; % take n Newton steps for now
x = x0;
errx=2;
while errx > tol
  xlast = x;  
  x = x - f(x)/fprime(x)
  errx = abs(x - xlast)
end 
  xout = x;
  fout = f(x);