Interactive Educational Modules in
Scientific Computing

Symplectic Methods for ODEs

This module illustrates symplectic methods for numerically solving ordinary differential equations whose solutions satisfy a conservation law, such as dynamical systems for which total energy is conserved. The term symplectic essentially means area preserving in phase space. Approximate solutions generated by symplectic methods are conservative even at finite resolution, in contrast with numerical methods that generate approximate solutions that are conservative only in the limit as the time step size approaches zero, and tend to gain or lose energy at finite resolution.

Ten numerical methods are implemented in this module, five of them symplectic and five nonsymplectic, and these can be applied to any of six example systems of ODEs: a simple pendulum, harmonic oscillator, Morse oscillator, Lennard-Jones oscillator, Kepler's orbit problem for two bodies, and a population model due to Lotka and Volterra. The first five problems are mechanical systems governed by Newton's second law of motion (F = ma) for various force fields, and for these systems the total energy (potential plus kinetic) should be conserved. The population model is not a mechanical system, but nevertheless it still has a constant of the motion that should be preserved. The first four problems are one-dimensional, so their phase spaces have two dimensions (position and velocity), whereas the last two problems are two-dimensional, so only the two position coordinates of their four-dimensional phase spaces are plotted.

The user first selects a problem and a method from the menus provided. The user can additionally choose the time step size and the final time of integration using the sliders provided. The user then clicks Solve and the resulting solution components, energy, and phase portrait are plotted.

The four Euler methods are only first-order accurate, and thus produce relatively poor solutions unless the step size is relatively small. The nonsymplectic Euler methods either gain or lose energy over time, whereas for the symplectic Euler methods the energy is constant or oscillates about a constant level, neither gaining nor losing energy in the long run. (Some of these effects become more evident for the more challenging problems and for longer integration times.)

The midpoint and trapezoid methods are second-order accurate, and thus yield better accuracy for relatively larger step sizes. Again, the symplectic methods conserve energy, but the nonsymplectic methods also do reasonably well because of the relatively higher accuracy and the fact that they fairly closely mimic their symplectic analogs.

The symplectic velocity Verlet method is second-order accurate and is specifically designed for mechanical systems, so its effectiveness is not surprising, and accounts for its popularity in such contexts. (Note, however, that the Lotka-Volterra model is not a mechanical system, and the Verlet method is not designed for it.) The classical fourth-order Runge-Kutta method is not symplectic, but because of its relatively high accuracy it may appear to be conservative in the short run, although it still tends to gain energy over a sufficiently long integration time.

References:

  1. Michael T. Heath, Scientific Computing, An Introductory Survey, 2nd edition, McGraw-Hill, New York, 2002. See Chapter 9.
  2. Mark H. Holmes, Introduction to Numerical Methods in Differential Equations, Springer, New York, 2007. See Section 1.6 and Exercises 1.22-1.26.
  3. E. Hairer, C. Lubich, and G. Wanner, Geometric Numerical Integration, 2nd edition, Springer, New York, 2006. See Sections I.1 and I.2.

Developers: Sukolsak Sakshuwong and Michael Heath