tool · physics simulation · chaotic system

Chaotic Triple Pendulum

Three hinged rods, a single writing tip. The equations of motion are derived from Lagrangian mechanics and integrated in real time with fourth-order Runge–Kutta: a path that never repeats and depends sensitively on its initial conditions.

triple_pendulum::rk4 — floriano@neural-link idle

While paused: drag a bob to aim its rod. Press ./run to release the system.

What you are watching

The physics

The triple pendulum is the simplest articulated chain that turns chaotic. Three masses hang from three rigid, weightless rods: the state is three angles and their velocities. From the Lagrangian L = T − U you obtain a linear system M(θ)·θ̈ = f(θ, θ̇), where M is the coupled mass matrix. Every step the simulation solves that 3×3 system for the exact angular accelerations — no small-angle approximation.

M(θ)·θ̈ = f(θ, θ̇)

The integrator

The state advances with fixed-step fourth-order Runge–Kutta, run as several substeps per frame to stay stable even in the violent regime. Energy conservation is the quality check: the “energy drift” readout measures how far the integrator strays from the initial value. With damping at zero the system is conservative and the drift stays tiny.

The ghost copies

Turn on the copies and start from identical conditions, except one angle shifted by a thousandth of a radian. At first they move together, indistinguishable; then, within seconds, the tips peel apart and each writes its own story. That is the visual signature of deterministic chaos: perfectly known laws, yet practical unpredictability. The “tip divergence” readout tracks that separation live.

Method: Lagrangian mechanics for N rods · mass matrix solved by Gaussian elimination · fixed-step RK4 integrator · phosphor trail on a separate canvas. Everything runs locally in the browser, with no external libraries.