## Motion of the cannonball without air drag
g  = 9.8;         ## m/sec^2
v0 = 700;         ## m/sec 
theta0 = 45;      ## degrees
theta0 *= pi/180; ## rad
dt=0.1;           ## sec

x=0;  y=eps;
vx=v0*cos(theta0); vy=v0*sin(theta0);
n=1;    ## Initialize the loop index

while ( y(n)>0 );
  
  x=[x;
     x(n)+vx(n)*dt];
  y=[y;
     y(n)+vy(n)*dt];
  vx=[vx;
      vx(n)];
  vy=[vy;
      vy(n)-g*dt];
  n++;

endwhile

plot(x/1000,y/1000,';no drag;')
       

