function [Y,isConverged]=newton4euler(f,xkp1,yk,Y,h)
% [Y,isConverged]=newton4euler(f,xkp1,yk,Y,h)
% special function to evaluate Newton's method for back_euler

% $Id: newton4euler.m,v 1.1 2011/01/07 02:17:45 mike Exp $

TOL = 1.e-6;
MAXITS = 10;
 
isConverged= (1==0);  % starts out FALSE
for n=1:MAXITS
  [fValue fPartial] = feval( f, xkp1, Y);
  F = yk + h * fValue - Y;
  J = h * fPartial - eye(length(Y));
  increment=J\F;
  Y = Y - increment;
  if norm(increment,inf) < TOL*norm(Y,inf)
    isConverged= (1==1);  % turns TRUE here
    return
  end
end
