Lesson 2 of 15

Lyapunov Exponents

Lyapunov Exponents

The Lyapunov exponent λ quantifies how quickly nearby trajectories diverge (or converge). For a 1D map f, it is computed by averaging the log of the absolute derivative along the orbit:

λ=1ni=0n1lnf(xi)\lambda = \frac{1}{n} \sum_{i=0}^{n-1} \ln |f'(x_i)|

For the logistic map f(x) = r·x·(1−x), the derivative is f'(x) = r·(1−2x). By computing λ numerically, you can determine whether the system is in a stable, periodic, or fully chaotic regime.

A positive Lyapunov exponent means chaos: infinitesimally close initial conditions separate exponentially fast, making long-term prediction impossible. At r = 4, the logistic map is fully chaotic with λ = ln(2) ≈ 0.693. Note: when the derivative is exactly zero (as at a fixed point), skip that term to avoid a domain error.

Implement the following functions:

  • logistic_lyapunov(r, x0, n) — compute the Lyapunov exponent for the logistic map at parameter r, starting from x0, using n iterations (skip terms where |f'(x)| ≤ 1e-10)
  • is_chaotic(lam) — return True if the exponent indicates chaos (λ > 0)
Python runtime loading...
Loading...
Click "Run" to execute your code.