The double pendulum: chaos, RK4 and why the energy error is the real test
A double pendulum is two rods, one hanging from a fixed pivot and the second from the first, with a mass at each end. Its motion is governed by two coupled nonlinear differential equations. The nonlinearity comes from the sine and cosine of the angles and from the coupling term that depends on the difference between them.
state = [θ₁, θ₂, ω₁, ω₂] · dstate/dt = f(state) · RK4 with dt = 0.002 s
The equations
With point masses m₁ and m₂ on massless rods of length L₁ and L₂, measured from the downward vertical, the angular accelerations are the standard expressions in the bench's method section. They are not linearised: a small-angle version would replace sin θ with θ and lose the very behaviour the simulator exists to show.
The energy is the sum of kinetic and potential terms, T = ½(m₁+m₂)L₁²ω₁² + ½m₂L₂²ω₂² + m₂L₁L₂ω₁ω₂cos(θ₁−θ₂) and V = −(m₁+m₂)gL₁cosθ₁ − m₂gL₂cosθ₂. The cross term in the kinetic energy is what couples the two rods even when they are not touching.
Why it is chaotic
The equations are deterministic and time-reversible, yet the motion is chaotic in the technical sense: nearby trajectories diverge exponentially, measured by a positive Lyapunov exponent. Starting from θ₁ = 1.6 rad and θ₂ = 2.4 rad gives an energy of about 7.80 J; starting from 1.7 rad instead produces a visibly different path within a few seconds.
Chaos does not mean randomness. The motion is bounded, repeats no exact pattern, and is fully determined by the initial state. It means that predicting the long-term state requires knowing the initial state to a precision that grows exponentially with time, which no real measurement can supply.
Integrating it
The bench uses fourth-order Runge–Kutta with a fixed 2 ms step. RK4 evaluates the derivative four times per step and combines them with weights 1/6, 2/6, 2/6, 1/6, giving a local error of order dt⁵ and a global error of order dt⁴. At 2 ms the motion is smooth and the energy stays nearly constant.
A first-order Euler step at the same dt visibly gains energy and the pendulum speeds up over time. A smaller step reduces the error but costs more computation. RK4 is the usual compromise for hand-sized problems; for long integrations, a symplectic method preserves the energy structure better even at larger steps.
The energy audit
Total energy is conserved for the ideal frictionless system, so any change is numerical error. The bench tracks the initial energy and the relative drift every step. With 2 ms RK4 and this configuration the drift stays around 10⁻⁸ over tens of seconds, which is far below the 1 percent that would matter physically.
This is the right test because the trajectory itself cannot be checked by eye, and a run with a slightly different step will look different after a few seconds. The energy check tests the method's stability, and the trajectory's character tests nothing but the initial conditions.
What the display shows
The animation shows the two rods and the trail of the lower mass. The phase portrait plots θ₁ against ω₁ and shows the trajectory winding inside a bounded region. Change the initial angle slightly and the trajectory explores a different part of the same region, which is the visual signature of chaos.
The energy readout is the quiet part of the display and the most important. A drift that grows steadily means the step is too large for the motion; a drift that jumps at a particular moment means a close approach to a singularity or a sudden high angular velocity. Either is a signal to reduce the step.
Why this belongs in a mechanics lab
The double pendulum is the smallest mechanical system that shows chaos. It uses only rigid rods, point masses and gravity, yet it defeats closed-form solution and intuition. It is a compact demonstration that the equations of mechanics are not the same thing as a prediction, and that numerical integration is a tool with its own error to manage.
The model has no damping, no rod inertia and no pivot friction. Adding any of them makes the energy decay and the motion settle, and the drift check must then compare against the dissipated energy rather than a constant.
Questions
If the equations are deterministic, why is the motion unpredictable?
Because nearby initial conditions separate exponentially. Any uncertainty in the initial angle, however small, grows until it fills the range of possible states. Deterministic does not mean predictable at finite precision.
Does a small energy drift mean the trajectory is accurate?
It means the integrator is stable and the trajectory is on the correct energy surface. It does not guarantee that the exact position after ten seconds matches, because chaos amplifies any small phase error. The energy check validates the method, not the individual trajectory.
Run the pendulum, change θ1 by 0.1 rad, and compare the divergence with the energy drift.
Open the simulatorWritten from standard statics, mechanics of materials and vibration theory; the worked numbers can be reproduced in the simulator linked above.
Back to the guides