Beats and resonance are among the most interesting behaviors exhibited by 2nd order ordinary differential equations, so it might be worthwhile to explore how and why they occur. Consider the following forced harmonic oscillator:

y'' + ω2y = A cos(γt).
Hopefully it is clear that the homogeneous solution is,
yh= C1sin(ωt) + C2cos(ωt).
Thus, depending on the values of ω and γ, the solutions could be quite different. That is, when ω ≠ γ the particular solution is,
yp= a sin(γt) + b cos(γt),
but when ω = γ, we have,
yp= t(a sin(ωt) + b cos(ωt)).
Choose different values for these paremeters and explore the different behaviors. What happens when ω and γ differ only slightly?
ω: γ: A: tfinal: Δt: y'0: y0:

Note: A fourth order Runge-Kutta method is used to solve the differential equation. Keep in mind that this is a fairly powerful method and that Δt does not need to be very small to get accurate results.