Week 1 Notebook

Solving the Simple Harmonic Oscillator

DSolve[x''[t]==-ω^2 x[t],x[t],t]

As we see, the solutions are sin’s and cos’s, with angular frequency ω=sqrt(k/m)

CHALLENGE - how does this solution relate to the one we wrote in class, x(t) = A sin(ω t+ α))?  Hint - the answer involves just a bunch of trig, and C1 and C2 can be expressed in terms of A and α.

Let us plot the behavior of the pure sinusoid with amplitude 5 (units could be anything, and are not included here) and angular frequency 1 rad/sec through two full periods (where T=2 pi = 6.28... seconds):

Plot[5 Sin[t*1],{t,0,4π}]

Now we can try doubling the Amplitude:

Plot[10 Sin[t*1],{t,0,4π}]

Now we can try doubling the frequency (which halves the period):

Plot[5 Sin[t*2],{t,0,4π}]

Finally we can try adding a non-zero value for α...let’s say α=π/2:

Plot[5 Sin[t*1+π/2],{t,0,4π}]

Notice that now the function looks like (and indeed is, after some trig) a cosine function.

Finally, Mathematica Lets us adjust (using sliders) different variables in a plot....now you can play with the sliders and see what happens when you mess around with various things:

Manipulate[Plot[A Sin[ω t+α],{t,0,4π}],{A,1,5},{ω,1,5},{α,0,2π}]

Now let us solve the equation for the pendulum, and compare it with the solution for just small oscillations:

Manipulate[Plot[{θ0 Cos[t],Evaluate[θ[t]/.NDSolve[{θ''[t]==-Sin[θ[t]],θ[0]==θ0,θ'[0]==0},θ,{t,0,50}][[1]]]},{t,0,50}],{θ0,0.01,π*.999}]