function [X,Y] = euler1(x,xf,y,n)
% x is initial interval value ; y is final interval value
% y is y(0) ; n is number of steps 
% f.m provides differential function in separate file 
% or define f[x_,y_] on the command line.
% Returns matrix [X,Y]
% Source: Edwards and Penney, Applications Manual for 
% Differential Eqs. . . . Computing and Modeling (4th)
h = (xf-x)/n;                  % step size
X = x;                          % initial x
Y = y;                          % initial y
for i = 1 : n                    % begin loop
     y = y + h*f(x,y) ;          % Euler iteration
     x = x + h ;                 % new x
     X = [X;x] ;                 % update x-column
     Y = [Y;y] ;                 % update y-column
end                              % end loop
