Lab IV Simple Harmonic Motion
(b) Define the kinetic and potential energy as the mechanical energy of the system and show that it is conserved.
Hints: Write the kinetic energy term using diff(x(t),t) (after assigning the previous solution) and then add the potential energy 1/2*k*x(t)^2, then use simplify(subs(omega0=sqrt(k/m),%))
(c) Now let x(t) = A cos(w0 t + q). Obtain expressions for A and q in terms of x0 and v0 and w0.
Hints Define the equation for x(t) given above as equation 1. Then say eq2:= subs(t=0,eq1) and solve for A. Then substitute t = Pi/(2omega0) to get q.(d) Define X and V as the position and velocity functions of time, v0 and x0. Set w0 = 1 and make phase plots for the cases of v0 = 0 and x0 = 1,2 and 3.
Hints: First unassign xo and v0 using x0 := 'x0': v0:= 'v0'. Then define the functions using unapply for x(t) and diff(x(t),t). For the phase plot, you will have plot([X(1,0,t),V(1,0,t),t = 0..2*Pi]) but its nicer to plot all on the same graph.