Table of contents
  1. Principles of integrators for ODEs
  2. Accuracy and performance of Euler and Runge-Kutta integrators
  3. Verlet integrators
  4. Resources
  5. Footnotes

Principles of integrators for ODEs

The first part of this lesson introduced the formalism and the basic ideas behind integration algorithms.

We revisit the Euler algorithm and introduce much better algorithms, namely the Runge-Kutta schemes and the Verlet integrator.

Accuracy and performance of Euler and Runge-Kutta integrators

The second part shows how to assess the accuracy of integration algorithms and analyzes in more depth the simple Euler integrator and the Runge-Kutta methods, namely rk2 and rk4. As examples we use the simple 1D harmonic oscillator with potential energy function \(U(x) = \frac{1}{2} k x^2\), an anharmonic oscillator (\(U(x) = \frac{1}{2} k x^2 (1-\frac{2}{3} \alpha x)\)), and a 6-th power oscillator (\(U(x) = \frac{1}{6} k x^6\)).

The Jupyter notebook 10-ODE_integrators.ipynb contains the lecture notes and implementations are in the module integrators.py.1

Verlet integrators

The third part introduces a different class of integrators: time reversible (and symplectic) integrators such as the velocity Verlet algorithm, which have worse accuracy than e.g. RK4 but long term stability.

  • The notebook 10-ODE-integrators-verlet.ipynb implements the velocity Verlet algorithm and shows how to use it to calculate the orbit of the Earth around the sun.

Resources


Footnotes

  1. As usual, git pull the resources repository PHY432-resources to get a local copy of the notebook. Then copy the notebook and all other code into your work directory in order to complete the exercises.