Mostly Musing – Rebuilding the Logistic map

I love building Excel files. In the grand scheme of things I’m not great at it, but it is something I very much enjoy and I get to use it on my job from time to time. Because of my hike It’s been over a year since I have done any real analysis work, and I can feel how much my blades have dulled. It’s true – If you don’t use it you lose it. Recently, a friend showed me a this YouTube video which talks about a basic population model. Before reading this post, go watch the video; it’s only about ten minutes, and is very well done! It seemed simple enough to recreate, so I figured it was the perfect opportunity to resharpen my blades and have a little fun while doing it. 

The ultimate goal of the exercise was to produce a plot like [Figure 1]. This plot describes how the population will settle (or not) given the Growth rate. There is nothing particularly interesting between the growth rates of 0 and 3 — The population stabilizes at a single value over time. But Growth rates 3-4 are where the real action is. As the growth rate ascends from three, the population progresses to a bistable state, that is the population flips back and forth between two values each iteration. Then – at about a growth rate of 3.45 the stabilization splits again into a quad-stable cycle, and then once again into an 8-stable cycle. After that are a few more splits and then – complete chaos; The iterative cycle of calculating the population yields no discernible pattern and you get an effectively random number every successive year. Looking at it a bit closer, even in the chaotic region there are brief moments of clarity where the growth rate yields a ‘stable cycle’ — pretty cool.  

[Figure 1] The goal

My first pass (after correcting a dumb bug) looked like [figure 2] . What’s important here is that this is a plot of every iteration from the initial population of 0.05 to iteration 100. The goal image is slightly different because it only shows stable values between 0 and three. I figured 100 iterations would be enough to tell if things were converging or not. Overall, you can see the shapes you want, but the first few iterations really deviate from the intended image and it doesn’t really paint the right picture of hat is going on. 

[Figure 2] first pass

Filtering out the first 30 iterations, you get [figure 3]. This looks a lot better, but isn’t all the way there. ‘Hard Coding’ in the removal of the first 30 iterations gets you a much more refined overall shape, but it’s missing a few things. For one, the knee at a growth rate of 1 is not well defined, and the other things is that pulling out the first 30 iterations means they are not included in the chaotic region so it’s not a complete picture – we can do better.

[Figure 3] First 30 iterations filtered out

Next I simultaneously did two things: 1. I rounded all my data to three decimal places and 2. Wrote a function to check for convergence. Three decimal places seemed sufficient to check for convergence – After all I am an engineer, and not a mathematician. Much to my surprise, after some tooling around I found out that my initial assumption about 100 iterations being enough was not correct. Updating my file to 700 iterations, applying the convergence analysis, and filtering out all the non-stable data for stable growth rates yields [figure 4]. Pretty damn on the nose if you ask me!

[Figure 4] Final plot

One of the other things I was very interested in was how quickly the stable regions converged onto their values. [plot 5] Shows the number of iterations it took to find stability at a precision level of three decimal places; this includes growth rates that are bi/tri/quad/etc.-stable.

[Figure ] Wildly different convergence times.

If you’d like to check out the files I built, You can do so here: https://docs.google.com/spreadsheets/d/1zcPLkH7N2TnYDLj1NRo6WOhNykmu1av_Y_StbqdFMXw/edit?usp=sharing A few other things I would like to explore at a later date. I’m sure these are already answered questions, but this is about me going through the exercises of figuring it out, not just looking up the answer.
-Does the initial stating population significantly effect the behavior of anything? I chose 0.05 as the starting population, but didn’t exploration anything else.
-Can the Feigenbaum constant be analytically derived? I can put together a more detailed file to empirically derive it, but it would never be an exact value.
-The chaotic region has well defined boundaries. What are these boundaries, why do they exist, and can they be empirically calculated?

A bonus photo showing only the 10 first iterations. Purdy.

Leave a Reply

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

WordPress.com Logo

You are commenting using your WordPress.com 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 )

Connecting to %s