Harmonic oscillators are used to describe a variety of systems in physics, like pendulums, electronic circuits and even quantum particles in a potential well. The underlying equation is the following second order ODE

The parameter gamma is an optional dampening factor. In the demo Below, different numerical methods are used to solve this popular differential equation. As you can see, the simpler methods diverge quickly and only produce accurate results when the simulation step size is significantly smaller than the oszillation frequency, while the higher order Runge Kutta Method produces useful results, even at a low resolution.