Lab IV Simple Harmonic Motion

  1. (a) Use Maple to solve the differential equation for a simple harmonic oscillator. Let a mass, m, be attached to a spring of force constant, k. Let the initial position of the mass be at x0 and its initial velocity be v0, and obtain a solution, x(t) in terms of these constants and the angular frequency w0 = (k/m)1/2.

Hints Use diff(x(t),t,t) to define the second derivative w/r to time. The second term should be omega0^2*x(t). Use sol := dsolve({eq,x(0)=x0,D(x)(0)=v0},x(t)); to solve the DFQ with the required initial conditions.

Also, try solving the equation by right clicking it and selecting Solve DE interactively.

(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) to express the velocity (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) [so X:= unapply(x(t),x0,v0,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. Note that this is a parametric plot you can look up plot parametric.