Plot position against momentum and a whole motion becomes one curve. Follow a blob of possible states as it stretches without ever changing area, and see why some computer simulations stay honest for ever
To know everything a pendulum will ever do you need two numbers: where it is, and how fast it is going. Plot those two numbers as one point, and the pendulum’s whole future is a curve through that point.
The space of all such points is called phase space. Motion in it obeys a rule that position alone never reveals: it flows like an incompressible fluid.
Drag and flick the pendulum, or drag the point in the plane beside it. Look for the dashed curve that divides swinging from going over the top, then try to make two curves cross.
A 1 kg point mass on a rigid 2 m rod with no mass. Its momentum here is the one that goes with an angle, p = ml²·(angular velocity), and the picture repeats every 360°. No friction. Stepped with the leapfrog method at 960 steps a second, so the energy wobbles in its last digits but does not drift. The level curves are equally spaced in energy, so the state moves fastest where they crowd together. Flow arrows are shortened to fit: their lengths go as the square root of the speed.
Newton’s law is about acceleration, so a position alone does not settle what happens next; the velocity is needed too. In place of velocity, phase space uses momentum. For any coordinate q, whether a distance or an angle, the momentum that goes with it is p = ∂L/∂q̇, where L is the Lagrangian, kinetic minus potential energy. For a mass on a spring that is mv; for a pendulum’s angle it is ml2 times the angular velocity, the angular momentum. See also: The Principle of Least Action.
The Hamiltonian is H = pq̇ − L, written in terms of q and p. For every system in this demo it is simply the total energy, p2/2M + V(q), where M is the mass or, for an angle, the moment of inertia. Between 1834 and 1835 William Rowan Hamilton showed that the motion is then given by a pair of equations:
q̇ = ∂H/∂p, ṗ = −∂H/∂q
Both are first order: they say where the point (q, p) goes next and ask nothing about where it has been. One point determines the whole curve, forwards and backwards. Two different curves therefore cannot cross, because a state at the crossing would have two futures. (The figure of eight at an unstable point is not an exception. The balance point is a curve by itself, and the curves that lead to it and from it take for ever to arrive and to leave.) See also: Phase Portraits in Differential Equations.
The velocity of the phase point, (∂H/∂p, −∂H/∂q), is the gradient of H turned through a right angle. So the point always moves along a level curve of H, never across one, and that is the conservation of energy. Its speed is the length of the gradient, which is large where the level curves crowd together. At a minimum of V the curves close into ovals round a centre. At a maximum they form a saddle, where a tiny offset grows as eωt; for a pendulum ω = √(g/l), the same number that sets the rhythm of its small swings.
Place or draw a blob of possible states, press Play, and watch the area readout while the blob is stretched and wound up. Then press Reverse time, switch on friction, and open the second panel to see a scrambled picture come back.
Position times momentum has the units of joule-seconds, so that is the unit of area. The pendulum is 1 kg on a massless 2 m rod; the spring is 4 N/m with a 1 kg mass. Every point of the boundary is stepped 240 times a second, by leapfrog without friction and Runge–Kutta with it, and where the boundary stretches new points are put on the original outline and run forward from the start. The area is that of the polygon they make, good to a part in a thousand or better; its last digits flicker because a polygon cuts the corners of a curve. Friction is a force −γp.
Treat the motion of all phase points together as the flow of a fluid with velocity (q̇, ṗ). Whether a fluid is being compressed is measured by the divergence of its velocity, and Hamilton’s equations make that zero:
∂q̇/∂q + ∂ṗ/∂p = ∂2H/∂q∂p − ∂2H/∂p∂q = 0
So area in the phase plane is conserved, and with more coordinates the volume of phase space is. The calculation goes back to Joseph Liouville in 1838, and the result is Liouville’s theorem. It holds for any H, even one that changes with time. With friction −γp the divergence is −γ instead, and every area shrinks as e−γt. Maps of phase space that preserve this structure are called canonical or symplectic transformations, and following the motion for any length of time is one of them.
One consequence is that a system without friction has no attractors: a blob cannot drain into a point or a closed loop, because it would have to lose area on the way. Another is the foundation of statistical mechanics. A cloud of states that begins evenly spread over an energy shell remains so, which is why physicists can take all the states of an isolated gas at one energy to be equally likely.
The winding-up in the demo is called phase mixing. Nothing is lost, and reversing time undoes it. But anyone who can see only the coarse cells will find the blob spread over more and more of them, and would need impossibly precise knowledge to run it back. That is a hint of how irreversible behaviour, and the growth of entropy, can come out of reversible laws. It is only a hint: why the world began in such a small cell is a separate question. See also: Shannon Entropy.
In 1890 Henri Poincaré proved that an area-preserving flow in a bounded region must bring almost every state back arbitrarily close to where it started, infinitely often. The second panel is the simplest case: a finite number of cells can only be rearranged in finitely many ways, so a rule that never merges two of them must eventually repeat. Quantum mechanics adds a last twist. Phase space is not infinitely divisible: the smallest meaningful cell for one coordinate has an area of about Planck’s constant, 6.6 × 10−34 J·s, and the uncertainty principle says that no state can be squeezed into much less. See also: Wave-Particle Duality.
Every animation in this module is a computer taking small steps. Run four ways of stepping side by side, make the step coarser, then fill the table to a million periods and see which of them can be trusted.
| Method | Forces per step | Area factor of one step | Energy error after 1 period | 10² periods | 10⁴ periods | 10⁶ periods |
|---|---|---|---|---|---|---|
| Explicit Euler | 1 | 1.0400 | · | · | · | · |
| Runge–Kutta 4 | 4 | 1 − 8.8 × 10⁻⁷ | · | · | · | · |
| Symplectic Euler | 1 | 1 | · | · | · | · |
| Leapfrog | 1 | 1 | · | · | · | · |
A 1 kg mass on a 1 N/m spring, pulled 1 m: the cycle takes 6.28 s. Each dot is one step. An entry in the table is the largest relative energy error during the last period before that time. “1” in thearea column means 1 to nine digits, measured by differencing; for the symplectic pair it can be proved to be exactly 1. The shadow curves are exact for a spring. Elsewhere in this module, motion without friction that runs for a long time (springs, pendulums, orbits) uses leapfrog, and anything with friction, drag, driving or a tumbling body uses Runge–Kutta with a small step.
The obvious way to step forward is Euler’s: work out q̇ and ṗ now, and move along them for a time h. On a spring of unit mass and stiffness that multiplies the energy by exactly 1 + h2, every step. The classical Runge–Kutta method looks ahead four times, and its error after a fixed time falls as h4. It still multiplies the spring’s energy by 1 − h6/72 + h8/576 each step. That is as good as 1 for a short run, but over a long one the small factors multiply up, always in the same direction. See also: Numerical Methods.
Symplectic Euler changes one thing: it updates p first and then uses the new p to update q. Each half is a shear, and a shear preserves area exactly, so the whole step does too. Leapfrog is half a push, a full drift, and half a push: three shears, and symmetric in time, which makes it second-order accurate. Methods that preserve area in this sense are called symplectic. They copy the geometry of Hamilton’s equations, even where they miss the numbers.
Why does that keep the energy in bounds? The step of a symplectic method is, to extraordinary accuracy, the exact motion of a slightly different system, with a shadow Hamiltonian close to the true one. So the method conserves the shadow energy, and the true energy can only wobble about it. For the unit spring the conserved quantities can be written down:
½(p2 + q2) − ½hpq, ½(p2 + (1 − h2/4) q2)
for symplectic Euler and for leapfrog, each exact to the last digit. Reading a numerical method as the exact solution of a nearby problem is called backward error analysis. It says nothing about timing: a leapfrog planet keeps its size and shape, but its period is slightly wrong and its ellipse slowly turns.
The leapfrog has been found many times over. It is the construction of straight runs and sudden kicks in Newton’s geometric proof of the equal-areas law in the Principia (see also: Gravity and Orbits). It carries the name of Carl Størmer, who used it in 1907, and of Loup Verlet, who used it in 1967 to simulate the atoms of a liquid. In 1991 Jack Wisdom and Matthew Holman devised a symplectic map for the Solar System that steps along exact ellipses between the kicks. Long integrations, with maps like theirs and by other methods, have found that the planets’ orbits are themselves chaotic, over times of millions of years. See also: Chaos.
Spot a mistake or have an idea?