The Programmer's Guide to Chaos
Written by Mike James   
Thursday, 14 May 2020
Article Index
The Programmer's Guide to Chaos
Population Dynamics

You might well think that “chaos” isn’t something that really should be mentioned in the same breath as “computer”, but you’d be wrong. Here's an overview of a  fascinating and disturbing topic and one that every programmer should know something about.

This account of chaos almost made it into my recent book The Programmer’s Guide To Theory but eventually I decided that it wasn't quite in the same category as the "core" computer science topics that had already made the list. Even so, it is just as deep and would be in a book on the great ideas you really need to know about.



The computer has allowed us to study the phenomenon of chaos and even managed to make bring it into a wider arena – there are popular books on the subject that philosophize, theologize and generally try to turn the idea into something all embracing.

But what is it all about and what does it have to do with butterflies, strange attractors and fractals?

If I could provide a 100% complete explanation of any of these ideas then I’d be doing better than the huge number of researchers trying to do the same. What I can do is give you some idea of what it's all about and indicate where it might all be leading.


Chaos is often confused with randomness – and they really aren’t the same thing at all.

The idea of probability and randomness is linked with the idea that there is no way that we can predict what is going to happen even in principle.

Chaos on the other hand is where we have a system that is in principle 100% predictable but in practice all we can do is to give the probability of any particular outcome.

For example, that well known example of randomness, the fair coin, is in fact a better example of chaos. In principle you can take the initial conditions of the coin and how it is about to be thrown into the air and use the equations of Newtonian mechanics to predict exactly how it will land on the table.

This can be done in principle with certainty and there is no need to invoke randomness or probability to explain the behaviour of the coin.

Of course in practice we cannot know all of the initial conditions and so a probability model is used to describe certain features of the exact dynamics of the system. That is, the coin tends to come down equally on both sides unless there is something in its make up that makes it come down on one side more than the other for a range of initial conditions.

You need to think about this for a little while but it soon becomes clear that a probability model is an excuse for what we don’t know – but still very useful none the less.

The question of whether or not there are truly random processes, i.e. ones that are even in principle not predictable, is considered open for some people, and answered by quantum mechanics for others.

But the argument about whether or not quantum mechanics is truly random is another story.

The one we are interested in is what can go wrong when you know how to predict and you know the initial conditions. Chaos is what happens when we know everything there is to know about the penny and yet still cannot make a complete prediction about what it will do in the future.

The Universal Clockwork

This idea goes against the classical view of the universe as mechanism. After Newton it was generally believed that the universe was a sort of clockwork wind-up toy but as the 19th century was coming to an end the cracks were beginning to show. The Newtonian theory was so accurate that it allowed the existence of Uranus to be deduced from the wobbles in the orbits in the other planets.

Then the mathematician Poincaré discovered that a simple three-body system moving under gravity could not be proved to be stable. In his 1890 paper he essentially proved that the earth, moon and sun system was chaotic, even if he didn’t use these terms, and this was deeply disturbing for anyone who believed in the clockwork universe.

As with all radical ideas it took some time for it all to sink in and become accepted. But how can a set of simple equations result in behaviour so complicated that it appears to have no pattern or regularity in it?

The Butteryfly Effect

At its simplest chaos can be illustrated by the “butterfly effect", a term coined by the American mathematician and meteorologist, Edward Lorenz.

In 1963 Lorenz constructed a simple model of a weather system and using Poincaré’s mathematics he showed that the outcome depended on the initial conditions in a way that was so wild that he could well imagine that a butterfly flapping its wings in Hong Kong could cause a tornado in Texas.



Edward Lorenz (1917-2008)


The butterfly effect captures the basic principles that create chaos – and gives the weathermen a good excuse for being wrong.

Sensitivity to initial conditions, and to conditions that develop along the way, mean that very small changes produce very large changes in behaviour.

Some systems are so finely balanced that tiny seemingly insignificant effects can tip them in completely different directions. It is not just a matter of degree you can get completely different types of behaviour with very small changes in the initial conditions.

This is, again, not what you expect in classical theories where giving one of the planets in the solar system a small nudge isn’t expected to cause a huge rearrangement and send planets spinning off into deep space.

In fact this brings us to the next important idea in chaos theory – equilibrium and its generalization.

<ASIN: 0192853783>




Last Updated ( Wednesday, 13 April 2022 )