Playing with Chaos

Rereading Gleick’s “Chaos” and decided to have a look myself at what it looks like.

Redoing this post – and adding 3 more images, with updated program code.

Here is a series of pictures I produced from the simple equation:
xp[next] = r.xp.(1 – xp)

To produce these images I simply ran the equation for each point on the x axis for a set of ranges of values of r (initially between 1 and 4). Starting the population at .1, I ran it for 600 cycles to reach stability if possible, then continued to run it, recording adding one to each y axis pixel corresponding to a result, recording until one pixel reached 3,200 hits. Then I ran a process over it to change those numbers into a visual rainbow – with red being the lowest numbers to violet being the highest (roy g biv). This makes it easy to see the curves of probability distribution of results in the chaotic zone between 3.6 and 4.

A link to the code I wrote is included below the images.

The first image shows the big picture,  as r increases from 1 to 4 the population increases until r gets to 3, when suddenly instead of settling to a single value, it starts to alternate between two values,   then at around 3.4 it changes behaviour again, now alternating between 4 values, then at about 3.55 it starts alternating between 8 values, and by around 3.66, it becomes completely chaotic, not settling into any particular repeating pattern, but over many cycles displaying interesting probability distributions.

big picture - r values 1 - 4

big picture – r values 1 – 4

The next image (Key) just shows what I have done with the two images that follow it.

Key showing areas expanded in following images

Key showing areas expanded in following images

The image following is the box A stretched to the left, to show more detail.

Box A - r value 3.5 - 4 expanded

Box A – r value 3.5 – 4 expanded

The final image is the tiny area shown in Box B – r values between 3.565 and 3.585  and y values between 0.8775 and 0.895.   This massively enlarged section shows the same fractal pattern almost (but not quite) repeating, at ever finer scales.

Box B -  r values between 3.565 and 3.585  and y values between 0.8775 and 0.895

Box B – r values between 3.565 and 3.585 and y values between 0.8775 and 0.895

Python 2.7 code is on my fishnet site –


About Ted Howard NZ

Seems like I might be a cancer survivor. Thinking about the systemic incentives within the world we find ourselves in, and how we might adjust them to provide an environment that supports everyone (no exceptions) - see
This entry was posted in Nature and tagged , . Bookmark the permalink.

7 Responses to Playing with Chaos

  1. “From Chaos eventually comes order “?

    More the other way round Jerv.
    From a nice orderly equation, comes chaos.
    There are approximations to higher level order within the chaos, and it is still chaos.
    It is more about the ability for infinite complexity to hide inside what looks like quite simple systems, that seem to behave in orderly and predictable ways, until you pass some critical threshold, then they suddenly spread out from a tight grouping to an infinite range of diversity and become predictable only in terms of probabilities at particular scales.
    It happens in this simple equation, and it can happen with people as individuals or as populations. Things can go along seemingly predictably for a long time, then suddenly, very quickly, change into utterly unpredictable behaviour in the old way of thinking, past a certain value.
    It seems to me that society as a whole is reaching such a point.
    Interesting times.


  2. Mmmmm. Verrrry interesting.


  3. Pingback: Capital/capitol | Ted Howard NZ's Blog

  4. Pingback: Soul mates / understanding | Ted Howard NZ's Blog

  5. Pingback: Universal Basic Income | Ted Howard NZ's Blog

  6. Pingback: Moneyball | Ted Howard NZ's Blog

  7. Pingback: Metamorphosis | Ted Howard NZ's Blog

Comment and critique welcome

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s