# Pendulum Simulator - Exact Period, Phase Space, Double Pendulum Chaos

> Simulate a nonlinear pendulum (RK4) beside its small-angle twin: exact period, damping, phase space and energy plots, plus a chaotic double pendulum.

- URL: https://qilingtools.com/en/math/pendulum
- Category: Physics Tools (https://qilingtools.com/en/physics)
- Tags: [Physics](https://qilingtools.com/en/tags/physics), [Education](https://qilingtools.com/en/tags/education)
- Last updated: 2026-10-26
- Price: Free, no sign-up
- Privacy: Runs locally in the browser; files are never uploaded

The simple-pendulum mode integrates the full nonlinear equation θ″ = −(g/L) sin θ − γθ′ with RK4, next to a small-angle pendulum (sin θ ≈ θ) released at the same angle. The larger the swing, the sooner the two drift apart. You get the exact period from the complete elliptic integral, compared with 2π√(L/g), the series approximation and the period measured in the simulation, along with a live phase portrait and kinetic, potential and total energy curves. The double-pendulum mode shows chaos. Add a twin that starts just 0.001° away and within seconds the two are doing completely different things, with their separation growing roughly exponentially on a log plot.

## How to use

1. Choose the simple or double pendulum, optionally starting from a preset
2. Set the length, release angle, damping, mass and gravity, or drag a bob on the canvas to set its angle
3. Press Start and watch the motion, the phase portrait and the energy curves
4. Read the exact and small-angle periods and the error in the results; in double mode, see when the twins visibly separate

## Features

- Nonlinear RK4 pendulum running side by side with the small-angle version
- Exact elliptic-integral period, series approximation and measured period
- Adjustable damping, with energy curves showing the losses
- Live phase-space (θ, ω) trajectory
- Double-pendulum chaos with path tracing and a log plot of twin separation
- Drag the bobs to set starting angles (touch-friendly)

## FAQ

### When is T = 2π√(L/g) not accurate?

That formula comes from the small-angle approximation sin θ ≈ θ. The exact period is T = 4√(L/g)·K(sin(θ₀/2)), where K is the complete elliptic integral of the first kind, and it grows with amplitude. It is about 0.19% longer at 10°, 1.7% at 30°, 7.3% at 60° and 18% at 90°, and it goes to infinity as the release angle approaches 180°. Below about 5° the error is under 0.05%, which is why textbooks call that range "small".

### What do the closed loops in the phase portrait mean?

The phase portrait plots angle θ against angular velocity ω, so each moment of the motion is a single point. Without damping, energy is conserved and the point keeps tracing the same closed curve. It is an ellipse for small swings and becomes lemon-shaped with sharper ends for large ones. With damping, energy drains away and the curve becomes a spiral into the origin. A chaotic double pendulum's portrait never closes and fills the plane erratically.

### Why is the double pendulum chaotic?

It has two degrees of freedom and strongly nonlinear equations of motion, and at high enough energy it is extremely sensitive to initial conditions. Two copies that start 0.001° apart separate roughly like e^(λt) in phase space and are completely different within seconds. This isn't numerical error: the equations are deterministic, but any tiny difference gets amplified, so long-term behaviour is unpredictable in practice. At small angles the system is nearly linear, a mix of two normal modes, and is not chaotic.

### What are the normal modes of a double pendulum?

At small angles the double pendulum can be linearised, and it has two patterns in which everything oscillates at a single frequency. With equal masses and lengths, the in-phase mode has θ₂/θ₁ = √2 and the lower frequency, and the anti-phase mode has θ₂/θ₁ = −√2 and the higher frequency. Any small-angle motion is a combination of the two. Try the in-phase and anti-phase presets to watch the bobs move in perfect lockstep.

### What is the energy drift, and is RK4 accurate enough?

Without damping the total energy should stay exactly constant, and numerical integration introduces tiny errors. The tool shows how far the current energy has drifted from its starting value. With 1 ms steps for the simple pendulum and 0.5 ms for the double pendulum, the drift typically stays below about 10⁻⁸ after a minute, far too small to see. The divergence of the twin double pendulums comes from chaos itself, not from this error.

## Related tools

- [Unit Converter](https://qilingtools.com/en/math/unit): Free online unit converter: length, area, volume, weight, temperature, time, speed, data, pressure, energy and angle — one value converts every unit at once.
- [Vector Calculator](https://qilingtools.com/en/math/vector): Free online vector calculator for 2D and 3D: addition, scalar multiples, dot and cross products, magnitude, angle, unit vector and projections, with checks.
- [Significant Figures Calculator](https://qilingtools.com/en/math/significant-figures): Free online sig fig calculator: count significant figures digit by digit, round to N sig figs or decimals with six rounding modes, and compute by sig fig rules.
- [Tone Generator](https://qilingtools.com/en/audio/tone-generator): Free online tone generator: sine, square, sawtooth and triangle waves from 1 to 20,000 Hz, a note picker, sweeps, white/pink/brown noise and a WAV download.
- [Audio Spectrogram](https://qilingtools.com/en/audio/spectrogram): Free online spectrogram generator: see time, frequency and level from a Hann-windowed STFT, with FFT size, log axis, dB range and colour maps. Exports PNG.
- [Decibel Meter](https://qilingtools.com/en/audio/decibel): Free online decibel meter: measure noise with your mic in real time, A/C/Z weighting, fast/slow response, min/max/average/Leq, 60-second graph and calibration.
- [Physics Formula Calculator](https://qilingtools.com/en/math/physics): Physics formulas solved with steps: SUVAT, projectiles, Newton’s laws, inclines, energy, Ohm’s law, resistors, RC, buoyancy, waves, lenses, gravity.
- [Fourier Series & FFT Visualizer](https://qilingtools.com/en/math/fourier): Fourier series coefficients and animated partial sums for square, sawtooth, triangle or any function (Gibbs), draw-your-own epicycles and FFT spectra.
