PHYS 305: Computational Physics II

Winter 2014



The Simple Harmonic Oscillator Revisited

The Simple Harmonic Oscillator serves as a standard model in Mechanics and Quantum Mechanics. Yet it is very easy to understand and, therefore, very useful.

Here we propose to use SHO as a standard for coding the numerical approaches to solve ODEs, Euler, Mid-Point and rk4.

The following provides complete C codes that solve the SHO over an arbitrary time interval spanned by an arbitrary time grid, using default potential parameter and mass. These codes illustrate diverse coding styles.

  1. Euler Method
  2. Mid-point
  3. Runge-Kutta 4th order
  4. Time stepper


Back to main page