Double Pendulum REC

Double pendulum
θ₁″, θ₂″ = f(θ₁, θ₂, θ₁′, θ₂′)
depends on m₁, m₂, L₁, L₂, g

What's happening

A pendulum hangs from a pivot; a second pendulum hangs off the end of the first. Each bob's acceleration depends on both angles, both angular velocities, both masses, and both rod lengths at once — gravity pulls straight down, but the coupling between the two arms turns that simple pull into a tangle of motion.

Where the equations come from

They fall out of Lagrangian mechanics: write the system's kinetic minus potential energy, then apply the Euler–Lagrange equation to each angle. The result is two coupled second-order ODEs for θ₁ and θ₂ — long to write out in full, so the box above shows the shape of the dependency rather than the expanded formula.

Why it looks chaotic

Below a small swing it behaves almost like two ordinary pendulums. Past that, it's chaotic: two runs started a hair's width apart diverge exponentially, so the long-term path is effectively unpredictable even though nothing here is random — the same sensitive-dependence signature as the Lorenz attractor. Add a second or third pendulum above with a nearly identical starting angle and watch them peel apart.

Integration method

Each pendulum numerically integrates its own ODEs every frame — RK4 (4th-order Runge–Kutta) by default, the most accurate of the options offered; Euler is the crudest and visibly drifts and gains energy it shouldn't have over time.

Controls

Drag a weight to reposition it. Add pendulums below — each keeps its own settings, trail color, and integration method.

Drag a weight to reposition. Add pendulums below — each has its own settings. Recording captures only the animation.