function yOut = AM2Newton(f,t0,y0,n,h)
% f is a handle to a function of the form [yp,dfdt] = f(t,y) where t and y are scalars.
% yp is the rate of change of f(t,y(t)) with respect to t and dfdy is the
% rate of change of f with respect to y.
% yOut is a column (n+1)-vector with the property that
% yOut(k) is an approximate solution to the IVP
%
% y'(t) = f(t,y) y(t0) = y0
%
% at t = t0+(k-1)h, k=1:n+1. The 2nd order Adams-Moulton method (AM2)
% with step length h is used to generate the approximate solutions. In
% particular, z = y_{k+1} approximately satisfies
%
% z = y_k + (h/2)*(f(t_{k+1},z) + f(t_{k},y_{k})
%
% where t_{k}=t0+kh and y_{k} \approx y(t_[k}).
% A Newton iteration is used to do this.