function  canonballminimal
% Same as Canonballbig, only minimal.
% Too minimal to hand in.  Just showing the essence.

options=odeset('events',@f2);
vx0=50*2^.5;
[t,z,tev, zev, i] =  ode45(@f,[0 1000],[0 vx0 0 vx0],options);
numericalerror= zev(1) - 2*vx0^2/10 
plot( z(:,1), z(:,3) )
end

function zdot = f(t,z);
zdot = [z(2) 0 z(4) -10]';
end

function [value,done,dir] = f2(t,z)
value = z(3) ;  done = 1;  dir= -1; 
end
