8.4 Integration methods: symplectic integrators 213
0.42
0.44
0.46
0.48
0.5
0.52
0.54
0.56
0.58
0 5 10 15 20 25 30 35 40 45
Energy
Time
E 1
E 3
E 2
Figure 8.2. The energy of the harmonic oscillator determined using the various
velocity estimators described in the text.E 1 is the energy using(8.29),E 2 uses
(8.27) andE 3 was calculated using(8.28).
In the leap-frog version, we have the velocities at our disposal for times halfway
between those at which the positions are given:
p(t+h/ 2 )=[x(t+h)−x(t)]/h+O(h^2 ). (8.29)
Each of the expressions (8.27–8.29) for the momentum gives rise to a different
expression for the energy.
We first analyse the different ways of calculating the total energy for the simple
case of the one-dimensional harmonic oscillator
H=(p^2 +x^2 )/ 2 (8.30)
and we can use any of the formulae (8.27–8.29) for the momentum. InFigure 8.2
the different energy estimators are shown as a function of time for the harmonic
oscillator which is integrated using the Verlet algorithm with a time steph=0.3.
This is to be compared with the periodT= 2 πof the motionx(t)=cos(t)(for
appropriate initial conditions). It is seen that the leap-frog energy estimator is an
order of magnitude worse than the other two. This is not surprising, since the fact
that the velocity is not calculated at the same time instants as the position results
in deviation of the energy from the continuum value of orderhinstead ofh^2 when
using (8.27). The energy estimator using third order momenta according to (8.28)
is better than the second order form. Note that the error in the position accumulates
in time to giveO(h^2 )(see Problem A3), so that there is no point in calculating the
momenta with a higher order of accuracy, as this will not yield an order of magnitude
improvement. The fact that the error for the third order estimator is about a factor
of 3 better than that of the second order one for the harmonic oscillator does not
therefore indicate a systematic trend. More importantly, the error inbothestimators