"Sample code 0: Simulate a single SHM pendulum "
theta0=15Degree;L=0.01;g=9.81;
Deltat=0.001T;
omega=Sqrt[g/L];
T=2Pi/omega;
theta[t_]:=theta0*Cos[omega*t];
x[t_]:=L*Sin[theta[t]];y[t_]:=-L*Cos[theta[t]];
pp[t_]:=ListPlot[{{x[t],y[t]}},PlotRange->{{-L,L},{0,-1.1L}},PlotMarkers->{"●",Medium}];
line[t_]:=Graphics[Line[{{0,0},{x[t],y[t]}}],PlotRange->{{-L,L},{0,-1.1L}}];
Manipulate[Show[{pp[t],line[t]}],{t,0,10T,Deltat}]

"Measuring the speed-squared of the pendulum as function of time"
vx[t_]:=(x[t]-x[t-Deltat])/Deltat;vy[t_]:=(y[t]-y[t-Deltat])/Deltat;
vsq[t_]:=vx[t]^2+vy[t]^2;
ListPlot[Table[{t,vsq[t]},{t,0,T,Deltat}],PlotRange->All,AxesLabel->{"Time,t", "speed-squared,v^2"}]
ParametricPlot[{t,vsq[t]},{t,0,T},AspectRatio->0.5,AxesLabel->{"Time,t", "speed-squared,v^2"}]

"Measuring the speed-squared of the pendulum as function of displacement from the equilibrium position"
vx[t_]:=(x[t]-x[t-Deltat])/Deltat;vy[t_]:=(y[t]-y[t-Deltat])/Deltat;
vsq[t_]:=vx[t]^2+vy[t]^2;
displacement[t_]:=If[x[t]>0,Sqrt[x[t]^2+(y[t]+L)^2],-Sqrt[x[t]^2+(y[t]+L)^2]];
ListPlot[Table[{t,displacement[t]},{t,0,T,Deltat}],PlotRange->All,AxesLabel->{"Time,t", "displacement"}]
ListPlot[Table[{displacement[t],vsq[t]},{t,0,T,Deltat}],PlotRange->All,AxesLabel->{"displacement","speed-squared,v^2"}]