The logistic difference equation is a fundamental of chaos theory. Originally applied mostly in population biology, it is:

x(next) = rx(1-x)

where x is any value between 0 and 1 (1 representing the maximum imaginable, say, population of a fish pond), and r is any positive value you wish (though usually r is less than 4, for reasons to be explained momentarily) representing the nonlinear forces in the system: the force driving the variation from interval to interval. In the fish pond, for example, it represents a quantity known as "biotic potential".

In other words, pick an r between 0 and 4, and a starting x between 0 and 1. To calculate the next x (for example, next year's fish population), subtract x from 1, then multiply by r and by x.

The connection to chaos theory comes when you investigate and graph the results for multiple values of r. For low r, the population tends toward 0 -- the fish die off because they aren't reproducing enough. As r increases, the population limit rises from 0 in a steady progression -- the fish stabilize at a higher and higher population as r rises. Around r=2.9, an interesting thing happens: the population (or whatever) settles down to an oscillation between two well-defined values. As r continues to rise, this oscillation "bifurcates" again and again, in a constant ratio of 4.669... (a.k.a. the Feigenbaum constant, which occurs again and again in nonlinear systems like this one which give rise to periodic oscillations and chaotic behavior). Just after r passes 3.0, the whole graph goes to hell -- the system never settles down to a stable state or oscillation, but jumps all over, with only vague statistical correlations continuing the original well-defined lines.

Keep gradually raising r, though. All of a sudden, occasionally there will be windows of stability, starting with a stable period of 3, which then undergoes Feigenbaum-constant bifurcations again, to periods of 6, 12, etc. Other windows exist on both sides of the period-3 window (period 5, period 7, and so on), but you need to have a finer level of detail to see them. Interestingly, chaos researcher James Yorke mathematically proved that any single-dimensional nonlinear system with a stable period 3 behavior must also exhibit chaotic behavior and stable regimes of every other period.

Around r=4.0, the graph settles down again to its original stable state: x=0. The fecundity is so high that the population tends to overdrive and crash almost immediately.

Focusing on the regions of the bifurcations (such as zooming in on the first bifurcation, in the region bounded by r=2.9 and r=3.1) shows other intriguing things. For example, the formerly sharp line of the stable population thickens and gets fuzzy just before it splits. You can "sharpen" it by calculating, say, 150 iterations of x before you start graphing, but no matter how much you sharpen it, the fuzziness never completely goes away.

A computer program to display all of the above behavior is easy to write (I did it in less than 12 hours of intermittent hacking). You'll want to create user controls for at least the starting x, the starting and ending values of r, the number of "throwaway" iterations and the number of subsequent iterations to graph for each value of r, and maximum and minimum values of x. Apart from that, I abstracted out a plotter function, the logistic difference function itself, and a wrapper to coordinate the two and do some basic bounds checking. A field to display the current value of r being worked with may also prove useful.

Credit to James Gleick's Chaos for details of the logistic difference equation's behavior and its application.