Lesson 14 of 15

Bifurcation Diagram

Bifurcation Diagram

The bifurcation diagram of the logistic map is one of the most iconic images in chaos theory. It plots the long-term values of x_{n+1} = r · x_n · (1 - x_n) as r sweeps from about 2.4 to 4.

At low r, the orbit converges to a single fixed point. As r increases past 3, the fixed point becomes unstable and a period-2 cycle appears. This period doubles again at r ≈ 3.449 (period 4), then at r ≈ 3.544 (period 8), and so on, with doublings accumulating faster and faster until r ≈ 3.5699, beyond which chaotic behavior appears — the orbit fills a continuous interval rather than visiting a finite set of points.

Embedded within the chaotic regime are periodic windows — narrow bands of r where the orbit is periodic again before returning to chaos.

Implement the following functions:

  • logistic_attractor(r, x0, n_transient, n_keep) — return the n_keep attractor values after discarding n_transient transients
  • attractor_range(r, x0, n_transient, n_keep) — return (min, max) of the attractor values
  • count_attractor_points(r, x0, n_transient, n_keep, tol) — count distinct attractor points (within tolerance tol)
Python runtime loading...
Loading...
Click "Run" to execute your code.