← henderhead

Bouncing ball chaos

after a demo by Matt Henderson
the ball the next bounce four bounces ahead
run
dead centre bounces straight up and down forever
this is the energy. Drop near the bottom and the chaos goes away
measurement error
how wrong the launch angle might be, in radians
how predictable it is, now

Spread of the fan after the full look-ahead, over time. Near zero the futures all land together and the next few bounces are certain; near one they are scattered right round the rim. The peaks and troughs are his Stable and Chaotic Eras, measured rather than eyeballed.

the phase portrait

The Poincaré section: every bounce as a dot, at the angle round the rim and the sine of the angle it left at. Violet is hundreds of other orbits at the same energy, blue is this one. The right half is empty because at this energy the ball cannot reach above the middle. Drag the drop height down and the speckle collapses into nested loops. Click anywhere to launch the ball from there.

the machine
at zero it is a chord billiard and perfectly predictable

What this is

On 14 September 2026 Matt Henderson posted this: chaos from bouncing a ball in a circle — at each point, I simulate a bunch of futures with slightly different velocities, showing how predictable the system would be with measurement error. The system seems to move between Stable Eras and Chaotic Eras, where it is hard to predict four bounces ahead. His original post is worth watching first.

The one thing that had to be got right

The video does not say what the rule is, and there is a version of this that looks identical for a few seconds and is completely wrong: a ball bouncing in a circle along straight lines. That system is integrable. The angle of incidence is conserved at every bounce, the ball just rotates round a fixed inner circle forever, nearby trajectories separate linearly rather than exponentially, and four bounces ahead is perfectly predictable. If that were the rule, the post's own sentence could not be true.

So it was measured off the video instead — tracking the white dot frame by frame. Before the first bounce x is constant while y accelerates; after it, x advances at a constant rate while y changes linearly. Parabolas, not chords: there is gravity. And at the end of his eighty seconds the ball is still rising to within a few pixels of the height it was dropped from, so the bounces are elastic. That is the whole rule.

between bounces p(t) = p₀ + v₀t + ½gt² at the wall v → v − (1+e)(v·n̂)n̂ n̂ the outward normal dropped from rest, a seventh of a radius off centre

Adding gravity is not a detail. It breaks the conservation law, the phase space goes mixed, and every single thing he describes follows from that. There are tests here for both halves: without gravity the sine of the launch angle is constant to one part in ten thousand over three hundred bounces, and with it that number wanders across its entire range.

Chaos, as a number

Start a second ball a billionth away and watch the gap. Averaging the log of how much each bounce stretches it gives the Lyapunov exponent, and over a couple of thousand bounces it settles at about 0.44 nats per bounce — half again as big at every bounce, and about six times as big after four. That is an average, though, and the whole story of the eras is that the actual stretching over any particular four bounces is nothing like it. Turn gravity down to nothing and the same measurement gives essentially zero, because linear separation is not exponential separation.

The Eras, and where they come from

The fan above is his: a few hundred copies of the ball, each launched with the velocity turned by up to δ, each followed four bounces. Turning the velocity rather than changing its size keeps every future on the same energy surface as the real ball, so the comparison means "error in direction" and nothing else.

What a page can add is the number. The spread plot measures how far apart those futures end up — zero if they all land in the same place, one if they are scattered right round the rim — and the Stable and Chaotic Eras stop being an impression and become peaks and troughs you can point at.

The obvious explanation for the eras would be a mixed phase space — stable islands sitting in a chaotic sea, with the ball getting stuck near an island for a while. That is what these systems usually do, and it is what this page said in its first draft. It is not what is happening here: plot the section at the energy the video uses and it is an almost uniform speckle. There are no islands worth the name to get stuck near.

What is left is the honest answer, and it is a better one. The Lyapunov exponent is a long-run average. Over any four bounces the actual stretching is nothing like that average — sometimes the fan is squeezed and sometimes it is torn apart, and those fluctuations are large. A stable era is a run of bounces that happened to squeeze. Nothing is stabilising it and nothing is holding it there; it is the same chaotic sea all the way through, being locally uneven. Watch the spread plot with the fan and you can see an era end.

The islands are real, though — just not at this energy. Drag the drop height down and the section collapses from a speckle into a stack of nested closed loops around the ball that bounces straight up and down at the bottom. That slider is the energy control and the only one: E = gy at the moment of release, and the ball can never get back above that height. Gravity, counter-intuitively, is not an energy control — rescale time and any value of g becomes 1, so the portrait does not depend on it at all. Click a point on the section to start the ball from there.

How it computes

Bounces are solved exactly, not stepped. Between bounces the path is a parabola, so the next wall hit is a root of a quartic in t — and because the ball sits exactly on the circle after every bounce, the constant term vanishes, t factors out, and what is left is a cubic with a closed form. That matters here more than in most simulations: in a system whose entire subject is how fast small errors grow, an integrator that manufactures its own errors is not acceptable. Over five thousand bounces the energy drifts by less than a part in a billion, and there is a test that says so.

All of it is a small Rust engine compiled to WebAssembly (engine/ here, 53 KB, no imports and no bindgen), rebuilding the whole fan — up to a thousand futures, four bounces each — from scratch every frame.

Credit, and a request

This is a fan page. The demo is Matt Henderson's (matthen.com, @matthen.com); the code here is ours and none of his video is copied onto this site. If he would rather this did not exist, or wants anything about it changed, that decision is his and we will act on it — see the note on the front page.