I had been following the MOOC “Scientific Computing with Fortran” for a week and currently doing the exercises. This is one of the assignments which has piqued my interests - Logistic map. Here’s a neat animation from Wikimedia for the same.
As Wikipedia states it, “The logistic map is a polynomial mapping (equivalently, recurrence relation) of degree 2, often cited as an archetypal example of how complex, chaotic behaviour can arise from very simple non-linear dynamical equations”. It is given by the equation, $$ x_{n+1} = rx_n(1-x_n) $$ where,
- $x_n \in (0, 1)$
- $r \in [-2,4]$ (just to keep the final $x_n$ values bound to $[-0.5, 1.5]$)
I have written the following Fortran code (along with a simple GnuPlot script) to generate the plot.
|
|
And the following is store in the logisticmap2.plt file.
|
|
I have generated the plot for various initial r values,which pertains to different zoom levels.
I like how such chaotic behaviour rises out of seemingly simple equation and that too in just 3 iterations! Just to put in perspective, this is how the initial conditions looked like.
:)