function ydot = valleyf(t, y)
% VALLEYF :  function for the "stiff" valley walk ODE
%
% You are somewhere in a long valley, 
% whose altitude at position (y1, y2) is
%  a(y1, y2) =  (y1/1000)^2 + y2/^2. 
%
% There is a town at (0,0), the bottom of the valley.
%
% To get to town, you want to walk downhill, 
% which is in the direction of the 
% negative gradient, 
%
%  -[da/dy1 ; da/dy2]  =  -[y1/500 ; 2*y2].
%
% You want to walk at constant speed, 
% so you scale ydot to have length 1.
% 
% The differential equation, as always, 
% is ydot = valleyf(t, y)

gradient = [y(1)/500; 2*y(2)];
ydot = -gradient / norm(gradient);