Table of Contents:
- A Quick Recap
- Story 1: The Decimal Point That Broke Weather Forecasting
- Story 2: The Prize-Winning Mistake
- Story 3: The Mathematician Who Caught a Falling Satellite
- What These Stories Actually Teach Us About Algorithms
- Try It Yourself: Watch the Butterfly Effect in Your Terminal
- Further Resources, If You Want to Fall Down This Hole
A Quick Recap
In Part 1, we talked about chaos algorithms as a math trick: structured unpredictability that helps programs escape ditches while searching for the best answer. Useful. Practical. A little dry, if we’re honest.
What we didn’t talk about is where this idea came from. And that’s the fun part; because chaos theory wasn’t discovered in a clean lab with a whiteboard. It was discovered by accident, by three people who were mostly just trying not to look stupid in front of their colleagues.
Here are their stories.
Story 1: The Decimal Point That Broke Weather Forecasting
In the winter of 1961, a meteorologist named Edward Lorenz was running a toy weather simulation on a room-sized computer at MIT. It was twelve equations, looping over and over, spitting out a fake climate; wind, temperature, pressure; as numbers on a printout.
One day he wanted to re-run part of a sequence, so instead of starting from scratch, he typed in a number from partway through his previous printout: 0.506. The computer’s internal memory had actually been carrying that number to six decimal places; 0.506127; but the printout had rounded it for readability, and Lorenz assumed the tiny difference wouldn’t matter.
He went to get a cup of coffee.
When he came back, the new run had completely diverged from the old one. Not “slightly different.” Not “a bit noisier.” Unrecognizable. Two weather patterns that started almost identically had, after a simulated couple of months, nothing in common at all.
Lorenz’s first assumption was that a vacuum tube had failed; that had to be it, right? But the more he checked, the more he realized the machine was working perfectly. The system itself was the problem: it was this sensitive to this small a difference. He’d stumbled onto what he later named the butterfly effect, and in doing so, accidentally founded modern chaos theory.
The unsettling part wasn’t that his forecasts were sometimes wrong. It’s that he proved forecasts had to be wrong past a certain point; not because our instruments aren’t precise enough, but because no instrument could ever be precise enough. Some systems are built to amplify the smallest gaps between “almost the same” and “completely different.”
Story 2: The Prize-Winning Mistake
Rewind further, to 1887. King Oscar II of Sweden announced a prize for anyone who could mathematically solve the “three-body problem”; basically, prove that a system of three planets orbiting each other was stable forever, the way Newton had proven it for two.
Henri Poincaré submitted an entry. It was long, it was dense, and it won. The judges were satisfied, the prize was awarded, and the paper went off to be published in a math journal.
Then Poincaré found an error in his own work; a case he’d skipped over because he’d assumed it would behave the same way as everything else in the paper. When he went back to actually work through that case properly, he discovered the opposite of what he’d claimed to prove. The orbits weren’t stable at all. Under the right conditions, they became unpredictable; not because anything was random, but because the tiniest change in starting position could send the whole system down a completely different path.
The journal had already been printed. Poincaré had to pay, out of his own pocket, to recall and reprint every copy; reportedly more than the prize money he’d just won; so the corrected version could go out instead.
He’d set out to prove the universe was predictable. Instead, he became the first person to mathematically describe deterministic chaos, decades before anyone had a computer to actually watch it happen.
Story 3: The Mathematician Who Caught a Falling Satellite
Fast-forward to 1990. Japan had launched a small lunar probe called Hiten. Its main job was to release a tiny orbiter, Hagoromo, around the Moon. Hagoromo’s radio failed almost immediately, and the mission looked more or less finished; Hiten had barely any fuel left, nowhere near enough for the standard route to lunar orbit.
At JPL, a mathematician named Edward Belbruno had spent years developing an unusual idea: instead of powering a spacecraft into orbit, you could ride the faint, chaotic tug-of-war between the Earth’s and Moon’s gravity; regions where a spacecraft’s path becomes so sensitive to small nudges that a tiny push in the right place, at the right moment, can completely redirect it. Almost nobody at JPL took the idea seriously. Chaotic trajectories sounded like the opposite of what you want when a multi-million dollar spacecraft is involved.
But Hiten had nothing to lose. In 1991, Belbruno used the theory to redirect the stranded spacecraft onto a new kind of route and successfully got it to the Moon. It became the first practical use of what’s now called a weak stability boundary transfer; a low-fuel path that works precisely because it deliberately moves through chaotic regions of space.
The rescue didn’t just save one Japanese satellite. It kicked off a whole field of low-energy trajectory design that later missions have relied on for cheap, flexible routes through the solar system. The “bug”; a spacecraft’s path being wildly sensitive to small changes; turned out to be the feature, once someone understood how to steer it on purpose.
What These Stories Actually Teach Us About Algorithms
Notice the pattern. In all three stories, chaos shows up first as a problem:
- Lorenz’s forecasts fell apart.
- Poincaré’s proof was wrong.
- Hiten was stranded with no fuel.
And in every case, the fix wasn’t to eliminate the sensitivity; it was to understand it well enough to use it. Lorenz’s “problem” became the foundation for knowing why weather forecasts have a natural limit, which changed how meteorologists communicate uncertainty. Poincaré’s “mistake” became the starting point for an entire branch of mathematics. Belbruno’s “unstable” trajectories became the cheapest way to get somewhere in space.
This is exactly the intuition behind chaos algorithms in computing, just at a smaller scale. A search algorithm that’s too stable gets stuck in the first decent answer it finds; like Poincaré assuming his skipped case would behave nicely. A search algorithm that’s too random wastes all its effort; no better than guessing. What you actually want is a system sensitive enough to escape bad spots, but still governed by a rule you understand; the same sensitivity that stranded a spacecraft, redirected on purpose.
Try It Yourself: Watch the Butterfly Effect in Your Terminal
You don’t need a room-sized 1961 computer to reproduce Lorenz’s discovery. Here’s a small script that starts two nearly identical values, runs them through the same chaotic rule, and prints how far apart they drift; right in your terminal.
def logistic_map(x, steps):
r = 4.0
seq = [x]
for _ in range(steps):
x = r * x * (1 - x)
seq.append(x)
return seq
def show_divergence(x1, x2, steps=25):
seq1 = logistic_map(x1, steps)
seq2 = logistic_map(x2, steps)
print(f"{'step':>4} | {'x1':>8} | {'x2':>8} | divergence")
for i, (a, b) in enumerate(zip(seq1, seq2)):
diff = abs(a - b)
bar = "#" * int(diff * 50)
print(f"{i:>4} | {a:8.5f} | {b:8.5f} | {bar}")
# Two starting points, different only in the 6th decimal place
show_divergence(0.506127, 0.506128)
Run it. For the first handful of steps, the two rows are nearly indistinguishable; same as Lorenz’s printout. Then the divergence column starts filling in, and by step 15 or so, x1 and x2 have nothing to do with each other anymore. You just reproduced, in about ten lines of Python, the exact accident that founded chaos theory.
Further Resources, If You Want to Fall Down This Hole
If any of these three stories grabbed you more than the algorithm itself did, here’s where to go next:
Books
- Chaos: Making a New Science; James Gleick. The definitive, highly readable account of Lorenz, Poincaré’s intellectual descendants, and how chaos theory became a real field. Start here.
- Fly Me to the Moon; Edward Belbruno’s own memoir of the Hiten rescue, part science and part personal story of being dismissed before being proven right.
- Nonlinear Dynamics and Chaos; Steven Strogatz. Once you want the actual math (phase space, attractors, bifurcations), this is the standard textbook, written unusually clearly for a math text.
Primary sources
- Edward Lorenz’s original 1963 paper, Deterministic Nonperiodic Flow; short, and you can follow most of it without a heavy math background.
- Belbruno & Miller’s 1993 paper formalizing the weak stability boundary transfer, if you want the actual orbital mechanics behind Story 3.
If you’d rather watch than read
- Veritasium’s video on chaos theory and the butterfly effect covers Lorenz’s story with good visuals of the actual attractor shape.
- 3Blue1Brown’s video on the logistic map and bifurcation diagrams is the clearest visual explanation of why
r = 4goes fully chaotic that I’ve seen anywhere.
If you want to keep building
- Try swapping the logistic map in the code above for other chaotic maps; the tent map or the Hénon map; and compare how quickly each one diverges.
- Look up “chaotic simulated annealing”; a direct descendant of the ideas in Part 1, where chaos replaces the random temperature schedule in classic simulated annealing.
Chaos theory keeps showing up in the same shape: something looks broken, someone refuses to write it off as noise, and it turns out to be the most useful part of the system. That’s a good thing to remember next time your own code does something that looks like a bug.