function ret = leapfrog1(steps)

% Calculate the value of dy/dx = y, y(0) = 1/e, at y(1).
% in <steps> steps.
% Use the leapfrog technique, and simple euler to find the 
% seed step.

y0 = 1;

stepsize = 1/steps;
x = 0;

% Simple Euler to get first step.
% (Remember dy/dx = y);
y1 = y0 + stepsize * y0;
x = x + stepsize;

% Now start leapfrogging.
while (x <= 1) 
	y2 = y0 + 2 * stepsize * y1;
	y0 = y1;
	y1 = y2;
	x = x + stepsize;
end;

ret = y2;
