function [z,steps] = newton(f,fprime,z,max_iter,max_size)
      sqrteps = sqrt(eps(2));
      steps = 0;
      err = 3*sqrteps;
      while err > sqrteps
         h = f(z)./fprime(z);
         err = abs(h);
         z = z - h;
         steps = steps +1;
         if (steps > max_iter) || (abs(z) > max_size)
            z= Inf;
            err= 0;
         end
      end
end