A simple chaos theory experiment in Excel.




Chaotic Growth

I've recently published a review of James Gleick's book on Chaos science. Chaos is a surprising and relatively "new" science that appears in the most unexpected places. One of the things that struck me when reading the book were the examples of deceptively simple phenomena where chaos can arise given the right circumstances. Consider population growth. The so called "logistic equation" is a (very simple) model of population growth from day to day. It basically tells us what the population in the "next day" should be as a function of the population of the "current day". If you call the "next day" population xn+1 and the present day's population xn, this can be expressed with the following equation:


So let's say that, as an example, you have a population of bacteria in a petri dish. If you start with an initial number of bacteria x0, you predict next day's population with x1 = r * x0(1-x0). You keep on repeating this for subsequent days. The factor r is the "driving parameter" and can be seen as a parameter that controls the rate of growth.  In fact, for small values of r, the model behaves as you would intuitively expect it to behave. The number of bacteria grows and grows until it reaches a sort of equilibrium and the population stabilizes. This very simple model does account for the fact that there are limited resources in the petri dish (think food, space) and that therefore, the growth cannot continue forever. Eventually the population can no longer grow, and reaches a stable number.

Excel Simulation

This equation is so simple that when I first heard abut it, I decided it would be fun to "simulate" it on Excel; to see it in action so to speak. I'm attaching below the spreadsheet I created so my readers can also play around with it. All you need to do is to vary the parameter r and see what happens.

excel Logistic Equation Example, Rev 1


The spreadsheet automatically performs 1000 iterations of the logistic equation and displays the results. Because there are important details at different stages, the spreadsheet display the data at three different "scales". The two top graphs are the same data but one is on a logarithimic iteration scale whereas the second is on a linear iteration scale. The bottom graphs zoom in on the final 100 iterations to show the "end result" .

Figure 1 shows the results for a small value of r (r = 1.1 in this case). This is the "intuitive" result. After about 100 iterations, the population stabilizes at a constant value (Note: the values are designed to be smaller than 1. This hardly matters for the discussion at hand as one can think of them as representing thousands or millions of specimen. The scale is arbitrary). The growth is "smooth" and quite well behaved... No surprises here.


 Figure 1 - Normal Population Growth for small r (r = 1.1 shown)


The first surprise: oscillation

Things start to get interesting as the value of r exceeds 3. Instead of converging to a stable value, the population ends-up oscillating between two values!  So imagine measuring your bacteria population and finding that it alternates between two values every time you measure it. Strange, but predictable by this model. I'm told that behavior like this is actually seen in nature and in lab experiments. Though real-world populations are more complicated than this simple model, seems even this rudimentary mathematical model is not too far from what is seen in the real world. Goes to show the beauty and power of mathematics...


Figure 2 - Oscillation for r >3


The ultimate surprise: Chaos

I might have overstated my surprise in the previous case of oscillatory behavior. After all, to make an analogy with the field of electronics, the electronics readers will recognize that even simple circuits can oscillate (resonant LC circuits come to mind). But things get really, really surprising for values of r > 3.57. At this stage, the population value becomes random. It doesn't converge nor does it oscillate; it simply behaves chaotically! Figure 3 illustrates this behavior.



Figure 3 - Chaos for r > 3.57


A natural question that follows is whether this behavior is actually observed in Nature? I don't feel qualified to comment on this field as it's definitely not my expertise. However, the little research I did suggests that most scientists believe chaotic population is not commonly seen in Nature for a variety of reasons (some studies argue that chaotic behavior would diminish a specie's chances of survival... I hear you:) Notwithstanding these studies, some scientists claim to have induced chaotic behavior in lab environments using some types of bacteria. Again, amazing how a mathematical model can predict complex biological behavior.

The scientists that first studied this equation were puzzled, and justifiably so. How can such a simple equation produce such interesting and complex behavior? And if this is true for such a simple model, what lurks behind the surely more complex models representing real-world systems? Much of the development in Chaos theory and non-linear dynamics try to answer these questions. It's a fascinating world. 

Comments, questions, suggestions? You can reach me at: contact (at sign) paulorenato (dot) com