Lesson 1 of 15

Logistic Map

Logistic Map

The logistic map is one of the simplest yet most fascinating examples of how complex, chaotic behaviour can emerge from a simple nonlinear equation:

xn+1=rxn(1xn)x_{n+1} = r \cdot x_n \cdot (1 - x_n)

Here xn[0,1]x_n \in [0,1] represents a normalised population at generation nn, and rr is the growth rate parameter.

Behaviour by Region

Range of rrBehaviour
r<1r < 1Population dies out → x=0x^* = 0
1<r<31 < r < 3Converges to stable fixed point x=11/rx^* = 1 - 1/r
3<r<3.573 < r < 3.57Period-doubling bifurcations (2, 4, 8, …)
r>3.57r > 3.57Chaos (mostly)

Fixed Point

For r>1r > 1, the non-trivial fixed point satisfies x=rx(1x)x^* = r x^* (1 - x^*), giving:

x=11rx^* = 1 - \frac{1}{r}

Lyapunov Exponent

The Lyapunov exponent λ\lambda measures the average rate of divergence of nearby trajectories:

λ=1Nn=0N1lnr(12xn)\lambda = \frac{1}{N} \sum_{n=0}^{N-1} \ln \left| r(1 - 2x_n) \right|

  • λ<0\lambda < 0: stable (convergent) dynamics
  • λ>0\lambda > 0: chaos (exponential divergence)

For the fully chaotic case r=4r = 4, the Lyapunov exponent equals ln20.693\ln 2 \approx 0.693.

Your Task

Implement three functions:

  • logistic_iterate(r, x0, n) — iterate the map nn times from x0x_0, returning a list of nn values
  • logistic_fixed_point(r) — return x=11/rx^* = 1 - 1/r for r>1r > 1, else 00
  • lyapunov_exponent(r, x0=0.5, n=1000) — compute λ\lambda, skipping the first 100 transient steps
Python runtime loading...
Loading...
Click "Run" to execute your code.