function ret = leapfrog2(steps)

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

y0 = 0;

stepsize = 1/steps;
x = 0;

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

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

ret = y2;
