Experiments 17

Which Way It Turns

Leave a system alone and it drifts toward a few favorite ways of behaving: a pendulum comes to rest, a clock keeps ticking. Those are attractors. This wheel of leaky cups can end up in every kind, or never settle at all. It depends on how much water you give it.

Rust · WASM · Runge–Kutta · Canvas · SVGView source 

Tumbling. Watch for the moment it changes direction.

The wheel

Drag it to spin it. Tap a cup to splash water in.

Its path

The shape it keeps tracing is its attractor. Tap it to start a few wheels there.

weight highweight lowanticlockwiseclockwise
Chaos: it never settles

Copy makes a second wheel from this one’s numbers rounded to three places, the way Edward Lorenz retyped a printout in 1961.

Twins are 100 wheels that each start a hair away from this one. Do they stay together? You can also tap the path to start a few wheels anywhere.

Notes on how it works

Notes

What an attractor is

Leave a system alone and it drifts toward a few favorite ways of behaving. A swinging pendulum with friction ends up hanging still. A pendulum clock ends up ticking at its own beat, however hard you first pushed it. Those end states are attractors. The Wikipedia article sorts them into kinds: a point (resting), a loop (a clock), and the strange ones that never repeat but never wander off either. This wheel has all three.

The wheel is the Lorenz system

Willem Malkus and Lou Howard built a wheel of leaky cups at MIT to act out Edward Lorenz’s weather equations. Steven Strogatz derives why it works in Nonlinear Dynamics and Chaos (section 9.1). Write the water on the rim as a Fourier series. Only the first harmonic, a₁ sin θ + b₁ cos θ, drives the wheel, and it obeys

ȧ₁ = ω b₁ − K a₁
ḃ₁ = −ω a₁ − K b₁ + q₁
ω̇ = (−ν ω + π g r a₁) / I

Here K is the leak rate, ν the friction, I the inertia and q₁ how unevenly the tap pours. Measure time in units of 1/K and set x = ω/K, y = (πgr/Kν) a₁ and z = ρ − (πgr/Kν) b₁. These become Lorenz’s equations, ẋ = σ(y − x), ẏ = ρx − y − xz, ż = xy − βz, with σ = ν/(IK), ρ = πgr q₁/(K²ν) and β = 1. Lorenz’s own β = 8/3 came from the shape of his convection rolls. The wheel’s β is 1 because both halves of the water drain at the same rate. So this page’s butterfly is the wheel’s, a little different from the famous picture. The water slider is ρ, and σ is fixed at 10.

a₁ and b₁ say where the water’s weight sits. That is why the white dot in the wheel and the path next to it are the same motion seen two ways. Each cup’s level on screen is a₁ sin θ + b₁ cos θ plus a constant, sampled at the cup.

What the tap covers

Every threshold below was measured with this page’s own Rust code, not copied from the classic β = 8/3 values.

  • ρ below 1: the wheel rests. The leaks win before the top gets heavy enough to tip it.
  • 1 to 8.18: it tips and turns steadily the way it started to fall. These are two fixed points, one per direction.
  • 8.18 to about 14.9: after the homoclinic point at 8.18, the wheel coming out of rest swings past and settles the other way. Which way a start ends up folds into thin interleaved bands, so a few wheels started in one spot can split, and transients get long.
  • About 14.9 to 17.5: a strange attractor appears while steady turning is still stable. Some starts settle into turning, and their neighbors tumble forever.
  • Above 17.5: the steady turns become unstable. That is the Hopf point σ(σ + β + 3)/(σ − β − 1), which for σ = 10 and β = 1 is exactly 17.5.
  • Clock windows: at about 26.75–27.75, 40–41.5 and 326–362, the wheel locks into a repeating back-and-forth, a limit cycle. The page checks for this by timing the reversals: at 27 and 345 they repeat to within 2%, at 28.5 they don’t.

The water slider is square-root scaled up to 45, then jumps to 316–350 so the widest clock window fits. The five buttons under it jump to 0.6, 5, 12, 28 and 340. The two narrow clock windows near 27 and 40 are marked on the slider as short ticks.

How the pictures are made

A small Rust module, attractor.rs, compiled to WebAssembly, integrates the equations with fourth-order Runge–Kutta at a step of 0.005 time units. Playback runs slower as the tap opens, so the wheel stays readable, and Faster doubles it. That’s why the rounding panel measures time in seconds on your screen, not in model time.

Twins run in a Rust Swarm alongside the main wheel. “Add 100 twins” scatters them uniformly within ±0.15 of the wheel’s three numbers, which is under 1% of its spin at the default flow. Tapping the path starts 40 within ±1.5% of the view. The path only shows spin and height, so a tap sets the third number, the lean, equal to the spin, the relation that holds at both steady turns. A wheel counts as settled once it comes inside a small ball around a steady turn. The ball shrinks toward the Hopf point at 17.5, and the Rust tests check that every start counted as settled is still there 600 time units later. They also check that at ρ = 28, neighboring starts on a grid disagree about their final direction more than 30% of the time, against under 10% at ρ = 5.

The rounding error

Lorenz’s 1961 rerun used his 12-variable weather model on a Royal McBee LGP-30, not these three equations. The copy here plays the same trick on the wheel: it takes the wheel’s three numbers, rounds them to three decimals as his printout did, and runs both. The pace is fitted to the straight part of the log-scale gap, while it is between ten times the first gap and a tenth of the attractor’s size. At low water the gap shrinks instead, because a steady turn pulls every nearby start onto itself.

Whether this “butterfly” is really a strange attractor, and not a trick of rounding, stayed open for decades. Warwick Tucker settled it for Lorenz’s classic case in 2002 with a computer-assisted proof. The proofs experiment is about proofs like that.

Sources

  1. Edward N. Lorenz, “Deterministic Nonperiodic Flow,” Journal of the Atmospheric Sciences 20 (1963): 130–141.
  2. Steven H. Strogatz, Nonlinear Dynamics and Chaos, section 9.1, “A Chaotic Waterwheel.”
  3. James Gleick, Chaos: Making a New Science (1987), for the printout story.
  4. Warwick Tucker, “A Rigorous ODE Solver and Smale’s 14th Problem,” Foundations of Computational Mathematics 2 (2002): 53–117.
  5. Malkus waterwheel and Lorenz system on Wikipedia.