(*2D projectile motion, without drag force. *)
theta=-30.0Degree;v0=10;g=9.81;
vx0=v0*Cos[theta];vy0=v0*Sin[theta];
ilast=300;Deltat=0.01;
(*initialisation*)
x[0]=0;y[0]=10;vx[0]=vx0;vy[0]=vy0;
(*end initialisation*)
For[i=0,i<ilast,i++,
x[i+1]=x[i]+Deltat*vx[i];
vx[i+1]=vx[i];
y[i+1]=y[i]+Deltat*vy[i];
vy[i+1]=vy[i]-g*Deltat;
];
ttx=Table[{i*Deltat,x[i]},{i,0,ilast}];
tty=Table[{i*Deltat,y[i]},{i,0,ilast}];
txy=Table[{x[i],y[i]},{i,0,ilast}];
ttvx=Table[{i*Deltat,vx[i]},{i,0,ilast}];
ttvy=Table[{i*Deltat,vy[i]},{i,0,ilast}];
ListPlot[txy,PlotLabel->"y vs. x",Joined->True,Mesh->All]

(*Do a movie*)

ListPlot[{{x[2],y[5]}},PlotStyle->{PointSize->0.025},PlotRange->{{-10,10},{10,10}}]

Manipulate[
ListPlot[{{x[i],y[i]}},PlotStyle->{PointSize->0.025},PlotRange->{{-10,10},{10,10}}]
,{i,0,ilast,1}
]

(*2D projectile motion, without drag force. *)
m=1;B2=0.05;
theta=45.0Degree;v0=20;g=9.81;
vx0=v0*Cos[theta];vy0=v0*Sin[theta];
ilast=300;Deltat=0.01;
(*initialisation*)
x[0]=0;y[0]=0;vx[0]=vx0;vy[0]=vy0;
(*end initialisation*)
For[i=0,i<ilast,i++,
v[i]=Sqrt[vx[i]^2+vy[i]^2];
x[i+1]=x[i]+Deltat*vx[i];
vx[i+1]=vx[i] -Deltat*B2*v[i]*vx[i]/m ;
y[i+1]=y[i]+Deltat*vy[i];
vy[i+1]=vy[i] -Deltat*B2*v[i]*vy[i]/m -g*Deltat;
];
ttx=Table[{i*Deltat,x[i]},{i,0,ilast}];
tty=Table[{i*Deltat,y[i]},{i,0,ilast}];
txy=Table[{x[i],y[i]},{i,0,ilast}];
ttvx=Table[{i*Deltat,vx[i]},{i,0,ilast}];
ttvy=Table[{i*Deltat,vy[i]},{i,0,ilast}];
ttv=Table[{i*Deltat,v[i]},{i,0,ilast}];
ListPlot[txy,PlotLabel->"y vs. x",Joined->True,Mesh->All]

txy