Chaotic Pendulum Forecast Lab
Integrate a two to seven arm pendulum with Runge-Kutta and race three statistical forecasters against deterministic chaos.
How this tool works
The chain is modelled as n point masses on rigid massless rods. Assembling the mass matrix and solving M(θ)·θ̈ = b(θ, ω) at every stage of a fourth-order Runge-Kutta step gives the reference trajectory that everything else is measured against.
Three forecasters then watch only the angle history, with no knowledge of the physics: a ridge-regularised autoregressive fit, an analogue method that replays the closest matching window from the recorded past, and a small neural network trained in the browser on demand. Each one tracks the truth briefly and then peels away, and the lab reports the lead time at which it does.
Switch the source to your own recording to run the same three forecasters over measured angles instead of simulated ones. Nothing is uploaded; the series is parsed in the page.
Core equations
M(θ) · θ̈ = b(θ, ω)M[i][j] = (Σ m from max(i,j) outward) · l[j] · cos(θᵢ − θⱼ)E = Σ ½mᵢvᵢ² − Σ mᵢ g hᵢusable horizon = min{ t : |θ̂(t) − θ(t)| > 0.1 rad }Assumptions
- Rods are rigid and massless, and all mass is concentrated at the joints.
- Motion is planar, frictionless, and free of air drag or joint damping.
- Gravity is uniform at 9.81 m/s².
- Imported recordings are treated as evenly sampled joint angles in radians, and arm lengths are set to unit values because real geometry is unknown.
Limitations
- Runge-Kutta is accurate but not symplectic, so total energy drifts slowly. The current drift is displayed rather than assumed to be zero, and long runs at seven arms will drift fastest.
- The forecasters are deliberately simple baselines. They demonstrate why data-driven extrapolation of a chaotic system fails; they are not a serious attempt at state-of-the-art forecasting.
- The autoregressive fit is ridge regularised and its rollout is bounded. Without those guards the delay-embedding fit is close to rank deficient and the forecast diverges to meaningless magnitudes within a fraction of a second.
- The usable horizon is a single-run estimate from one replay of the recent past, not an averaged Lyapunov exponent.
- Large imported recordings are not kept in the saved state or in share links; reload them after returning to the page.
References and verification
- Supplied single-file prototypePorted into a platform tool module. The physics, the two statistical forecasters and the neural forecaster keep their original structure; the linear solver, the autoregressive rollout, the series parser, the pseudorandom generator and the training loop were corrected during the port.