function T3 = taylor3(d2f,a,b,ya,N)

% Input   - d2f=[y' y'' y'''] entered as a string 'd2f'
%           where y'=f(t,y), y''=df(t,y)/dt, y'''=d^2f(t,y)/dt^2
%         - a and b are the left and right endpoints
%         - ya is the initial condition y(a)
%         - N is the number of steps
% Output  - T3=[T' Y'] where T is the vector of abscissas and
%           Y is the vector of ordinates

h=(b-a)/N;
T=zeros(1,N+1);
Y=zeros(1,N+1);
T=a:h:b;
Y(1)=ya;

for j=1:N
   D=feval(d2f,T(j),Y(j));
   Y(j+1)=Y(j)+h*(D(1)+h*(D(2)/2+h*D(3)/6));
end

T3=[T' Y'];

