Double Pendulum Chaos Simulator
Explore Lagrangian mechanics and deterministic chaos — two identical pendulums with imperceptibly different angles diverge into completely different trajectories within seconds.
The Physics of Chaos
🌏 Lagrangian Mechanics
Rather than using Newton's second law (F = ma), the double pendulum is most elegantly analysed using the Lagrangian L = T − V, where T is kinetic energy and V is potential energy. Applying the Euler–Lagrange equations gives the true equations of motion without needing to resolve forces at the pin joint. This is the standard approach for any system with constraints.
🌊 Sensitive Dependence
Two double pendulums starting at angles that differ by only 0.01° will, within about 5–10 seconds, evolve into completely different motions. This sensitive dependence on initial conditions — characterised by a positive Lyapunov exponent λ > 0 — means no measurement can ever be precise enough to predict long-term behaviour. The system is deterministic but unpredictable: the essence of chaos.
📈 Phase Space & Attractors
Instead of plotting position vs time, plotting θ vs ω (angle vs angular velocity) in phase space reveals the geometric structure of the motion. For a simple undamped pendulum this is an ellipse. For the chaotic double pendulum it traces a tangled, space-filling set — a strange attractor with fractal dimension between 1 and 2. With damping the attractor collapses to a fixed point at (0, 0).
⚡ Energy Conservation
In an undamped double pendulum, total mechanical energy E = T + V is conserved exactly. The RK4 numerical integration used here preserves this to within rounding error (drift <0.01% over 60 s). With damping, energy bleeds away at rate dE/dt = −b(ω₁² + ω₂²) and the pendulum eventually stops. Watch the total energy readout: it should stay flat in undamped mode.
Key Equations
| Symbol / Equation | Meaning |
|---|---|
| L = T − V | Lagrangian (kinetic minus potential energy) |
| d/dt(?L/?θ?) − ?L/?θ = 0 | Euler–Lagrange equation of motion for each angle |
| Θ1, Θ2 | Angles of arm 1 and arm 2 from vertical (radians) |
| ω1 = dΘ1/dt, ω2 = dΘ2/dt | Angular velocities of each arm |
| T = ½(m1+m2)L1²ω1² + ½m2L2²ω2² + m2L1L2ω1ω2cos(Θ1-Θ2) | Kinetic energy of the system |
| V = -(m1+m2)gL1cos(Θ1) - m2gL2cos(Θ2) | Potential energy (reference at pivot) |
| λ > 0 | Positive Lyapunov exponent ? chaotic divergence |
| RK4: k1..k4 | 4th-order Runge–Kutta integration steps (error O(h5)) |
Chaotic vs Periodic Regimes
🔴 Small Angles (=15°)
Both arms stay near vertical. The nonlinear sin(θ) terms ˜ θ (small-angle approximation), so the system behaves like two coupled harmonic oscillators with well-defined, predictable normal modes. Phase portrait is smooth and closed.
🟡 Medium Angles (15°–90°)
Nonlinearity grows. Motion starts mixing modes; trajectories are quasi-periodic for some parameter combinations. Shadow pendulum (ghost) diverges slowly. Some initial conditions in this range remain periodic (KAM tori).
🟢 Large Angles (>90°)
Lower arm can execute full rotations. Motion is fully chaotic — the ghost pendulum diverges in under 3 seconds. Phase portrait fills area densely. Lyapunov exponent is maximised in this regime.
🔵 With Damping
Damping dissipates energy. The region of phase space accessible shrinks over time and the trajectory spirals toward (0, 0). Chaotic behaviour is transient — the system will always settle given enough time. Real pendulums are always in this category.
Real-World Chaos Examples
The double pendulum is the canonical classroom example for chaos, but the same mathematics governs a surprising range of real systems.
🌦 Weather
The Lorenz equations — a simplified model of atmospheric convection — exhibit the same sensitivity. This is why numerical weather prediction beyond ~10 days is fundamentally unreliable, not just a computational limitation. The butterfly effect was named after Lorenz's 1972 paper "Does the flap of a butterfly's wings in Brazil set off a tornado in Texas?"
⚖ Robotic Arms
Industrial robot arms, especially 6-DOF manipulators, contain multiple joints that can enter chaotic regimes at certain velocities. Control engineers must account for this and use feedback control with very high sampling rates — exactly the regime where Lyapunov analysis is applied practically.
🍔 Human Gait
The human leg functions mechanically as a double pendulum during the swing phase of walking. Subtle irregularities in gait analysed via phase portraits can flag neurological conditions such as Parkinson's disease years before other symptoms appear — chaos theory applied to biomechanics.
⭐ Orbital Mechanics
The three-body gravitational problem (Sun–Jupiter–asteroid, for example) is chaotic for many initial conditions. This drove the formation of the Kirkwood gaps in the asteroid belt — regions where orbital resonances with Jupiter create chaotic zones that eject asteroids over millions of years.
Curriculum Alignment
| Level | Topic | Concepts |
|---|---|---|
| GCSE Physics | Forces & Motion | Pendulum period, gravity, energy conservation |
| A-Level Physics | Simple Harmonic Motion; Fields | Period formula, energy exchange, non-linearity |
| A-Level Maths / Further Maths | Differential Equations | Coupled ODEs, numerical methods, phase diagrams |
| IB Physics SL/HL | Mechanics; Oscillations | SHM, energy, damping, resonance |
| AP Physics C | Mechanics; Oscillations | Lagrangian optional enrichment, RK integration |
| University Year 1–3 | Classical Mechanics; Non-linear Dynamics | Lagrangian / Hamiltonian mechanics, chaos, Lyapunov, attractors, KAM theorem |
Worked Example
Predicting chaotic divergence time
Setup: Two double pendulums with L1 = L2 = 0.5 m, m1 = m2 = 1 kg, ?1 = 120°, ?2 = -30°. Pendulum A: ?2 exactly -30.000°. Pendulum B: ?2 = -30.001° (0.001° offset).
Lyapunov exponent for this configuration ˜ 3.5 s?¹. Two orbits separated initially by d0 diverge as d(t) ˜ d0 · e?t.
After 5 s: d ˜ 0.001° × e3.5 × 5 ˜ 0.001° × 107.6 ˜ 35,000° — the pendulums are completely uncorrelated.
Conclusion: For any realistic measurement precision (= 0.001°), predictions become meaningless after ~5 s. To extend predictability to 10 s would require measuring the initial angle to 8 significant figures — impossible in practice.
Frequently Asked Questions
Is the simulation accurate?
The simulation uses a 4th-order Runge–Kutta (RK4) integrator with a fixed time step of ?t = 0.005 s (adjustable via speed multiplier). Energy conservation error accumulates at roughly 1 part in 106 per second in undamped mode. For the first 60 s the dynamics are physically accurate; beyond that, floating-point rounding errors cause slow drift from the true trajectory — this is unavoidable for any chaotic system simulated numerically.
What does the ghost pendulum show?
The ghost pendulum starts with all parameters identical to the main pendulum except ?2 is offset by +0.01°. It is drawn as a transparent blue trail. Watching how rapidly the two trails diverge gives you an intuitive feel for the Lyapunov exponent — a quantitative measure of how fast nearby trajectories separate. A large exponent = rapid divergence = highly chaotic.
Can I use this for my A-Level or IB write-up?
Yes. The double pendulum is an excellent topic for extended essays (IB EE), A-Level project work, or supplementary investigation tasks. Key measurable quantities: the divergence time as a function of initial angle, energy conservation fidelity over time, the change in Lyapunov exponent with arm length ratio. All these can be observed directly in the simulator and quantified in a write-up.
What's the difference between Lagrangian and Newtonian mechanics here?
Newton's approach would require resolving tension forces at the pivot and pin joint — complicated because they are internal constraint forces. Lagrangian mechanics bypasses this entirely: you write T and V in terms of the generalised coordinates (?1, ?2) and let the Euler–Lagrange equations handle the constraints automatically. The resulting equations of motion are identical in both approaches, but the derivation via Lagrangians is far cleaner.
How does this relate to the Lorenz attractor simulation?
Both the double pendulum and the Lorenz attractor are deterministic chaotic systems with positive Lyapunov exponents and strange attractors in phase space. The Lorenz system models atmospheric convection (3D phase space); the double pendulum is a 4D system (?1, ?1, ?2, ?2). You can explore both in the Lorenz Attractor Simulator.
Further Reading
🆕 Unlock Premium Features
The free version gives you full access to the double pendulum chaos simulator. Premium unlocks: Poincaré section rendering, Lyapunov exponent live calculation, energy surface heatmap, 60-FPS high-res trail export as GIF/PNG, side-by-side multi-pendulum comparison (up to 8 clones), Hamiltonian mode, and access to all 32 simulations.
View Premium Plans🌀 Chaotic Dynamics
The double pendulum is one of the simplest mechanical systems that displays deterministic chaos. Trajectories starting from nearly identical initial conditions diverge exponentially characterised by a positive Lyapunov exponent. This sensitive dependence on initial conditions makes long-term prediction impossible in practice, even though the equations are fully deterministic.
📐 Degrees of Freedom
The system has two degrees of freedom: angles θ1 and θ2. Its four-dimensional phase space (θ1, ω1, θ2, ω2) can be explored via Poincaré sections. The Lagrangian formulation elegantly handles the coupled constraints without explicit force decomposition.