# Period Doubling

Explore period doubling behavior in a simple function

## Overview

This p5.js sketch allows you to explore a simple function that exhibits some unusual properties. The graph, called a ‘bifurcation diagram’, is generated by repeatedly applying a simple function **x _{next} = rx(1-x)** to generate a range of values. Despite the simplicity of the function, it creates a complex pattern. Initially, with low values of

**r**, the values generated fall into a narrow range. Then, as

**r**increases, they split, so that the function returns just two possible values, then split again to yield four possible values, a phenomenon called period doubling bifurcation. After that, the regularity of the outputs breaks down, and they become completely chaotic. But even in the chaotic area, it is possible to see hints of structure.

The equation above was actually used to model animal populations, where the size of the population one year is related to the size of the population the previous year. ‘Common sense’ might tell you that you could easily predict the population next year just by knowing the population this year and the rate of growth (**r** in the equation). But researchers studying the problem soon found that when **r** increased above a certain point, their models predicted wild potential variations in population size, as shown in this diagram.

By varying the start and end values with the controls above, you can ‘zoom in’ on different parts of the graph. By changing the ‘settle’ and ‘plot’ settings, you can see more structure in the results. Click the Update button to regenerate the diagram with your new settings.

## Further reading

If you’d like to learn more about this, chapter 3 of James Gleick’s book “Chaos” has a very clear discussion of this topic.

A clear, readable introduction to chaos theory for interested laypeople.