Runge-Kutta versus Velocity-Verlet Solutions for the Classical Harmonic Oscillator
Runge-Kutta versus Velocity-Verlet Solutions for the Classical Harmonic Oscillator
The harmonic oscillator is an idealized system widely used in many physical applications. It consists of a mass that oscillates without friction around an equilibrium position under a conservative attractive force. The energy is therefore constant. There is another conserved quantity, often not mentioned—the phase-space two-form (where is a coordinate and the conjugate momentum). The conservation of this quantity in a Hamiltonian system is a necessary and sufficient condition for conservation of the total number of particles, relevant if the system contains a fixed number of particles.
dxdp
x
p
This Demonstration aims to show the differences between Runge–Kutta 4 (RK4) and Velocity-Verlet (VV) in the approximation of the classical harmonic oscillator problem, and is often considered a good simple test to evaluate an algorithm’s reliability on more complex Hamiltonian systems. Both are fourth-order algorithms that approximate the solution by calculating the trajectory’s point separated by a fixed . The smaller the , the better the approximation is for the true stability of the algorithm. It can be seen how going forward in "time" and changing in the approximated solutions makes the former quantities change in an appropriate way using VV and RK, in a catastrophic case.
dt
dt
dt