Zopra/Charts
Guide
Getting startedAll chartsWhich chart to use?Domain specific
Base charts7
XY ChartTrendCandlestickHeatmapState TimelineFlame GraphBar Gauge
Derived charts73
Time SeriesHistogramStatus HistoryStatGaugeHoneyCombTracesNode GraphHeikin-AshiRenkoKagiPoint & FigureParetoIshikawaControl ChartBland-AltmanLollipopDumbbellSlopeBumpBack-to-BackWaterfallBulletFunnelMekkoForestBarcodeBeeswarmRidgelineHorizonSpectrogramAttention MapWaffleVennUpSetWarped WaffleWord CloudGanttSankeySankey MatrixTreemap ForceChord DiagramCircosArc DiagramAlluvialSankey FunnelDendrogramIcicleSunburstSpiderNightingale RoseParallel CoordinatesOscilloscopeEfficient FrontierPhase PortraitPoincaré MapBifurcationH-R DiagramRamachandranHarkerRoot LocusRadiation PatternQuiverHodographSmith ChartEye DiagramSequence LogoTernaryTernary ContourPiperStüveTephigramChoropleth

Charts/Science charts

Bifurcation

<Bifurcation /> · 10 examples

Where a repeated rule ends up, plotted for every value of its parameter.

Overview

Take a very simple rule: multiply a number by a constant and by one minus itself, and feed the answer back in. Do that a few hundred times and ask where the number ends up. For a small constant it settles to a single value. Turn the constant up and it starts alternating between two values, then four, then eight, and then somewhere past 3.57 it stops repeating at all. Nothing about the rule changed except one dial.

A bifurcation diagram shows all of those answers at once. The horizontal axis is the dial, the vertical axis is where the system lands after it has stopped fussing. It is the picture that made chaos theory legible to the public, and Robert May's 1976 paper on simple population models with very complicated dynamics is why biologists and mathematicians had to take it seriously. Mitchell Feigenbaum later found that the ratio between successive doublings approaches the same number, about 4.669, for a whole family of rules, whatever the details.

That last fact is the reason people still draw it. A trivial equation does not just produce chaos, it produces the same chaos as a dripping tap, a turbulent fluid and a population of insects, and the diagram is the proof you can hold in one image.

Props

API

<Bifurcation map={|r: f64, x: f64| r * x * (1. - x)} parameter={(2.5, 4.)} />
PropTypeDefault
mapFn(f64, f64) -> f64: the next x from the parameter and the current xrequired
parameter(f64, f64): the parameter rangerequired
stepsusize: parameter values across the range300
transientusize: iterations thrown away first300
keepusize: iterations plotted per parameter value60
startf64: the starting x0.5
x_label, y_labeltext"r", "x"
color, point_sizefirst series colour, 1.5
class

Values that leave the finite range are skipped.

Run them

10 examples

Press Run to load an example into the live render at the top of the page. Open one to read its code.

How to read it

  1. 01Start at the left. A single thin line is a stable fixed point: the system always goes to the same value.
  2. 02Follow it until it splits. Each fork is a period-doubling: the system now alternates between two values, then four.
  3. 03Find where the lines dissolve into a smear. That is chaos, and the density of the dots shows where the orbit spends its time.
  4. 04Look inside the smear for clean stripes, such as the wide window near r=3.83r = 3.83r=3.83 in the logistic map. Order returns, briefly, before breaking down again.

When to use it, and when not to

Reach for it when

  • You have a discrete-time rule with a tunable parameter, such as a growth rate, a feedback gain or a drive amplitude, and want to see how its long-run behaviour changes.
  • You are hunting for the parameter value at which behaviour changes qualitatively: onset of oscillation, period doubling, the edge of chaos.
  • You are teaching nonlinear dynamics and want one image that shows order, doubling and chaos.
  • You want to find windows of order inside a chaotic region, the periodic stripes in the fog.

Skip it when

  • Your system is continuous in time. Sample it first with a Poincaré section, or use a Phase Portrait of a single parameter choice.
  • You have several state variables. The chart plots one. Pick a variable you can defend, or a projection.
  • You want a quantity such as a Lyapunov exponent, which this chart does not compute. It draws the attractor, not its sensitivity.
  • Your map is expensive to evaluate. A hundred thousand calls is nothing for a quadratic and a lot for a simulation.

The math behind it

Iterating a map

You pass a function map taking (r,x)(r, x)(r,x) to the next state, and a parameter interval [rmin⁡,rmax⁡][r_{\min}, r_{\max}][rmin​,rmax​]. The chart evaluates rrr at steps evenly spaced values (300 by default), and for each one runs the same procedure from the same seed start (0.5 by default).

The logistic map is the standard test case, and is just a function you give it:

xn+1=f(r,xn)=r xn (1−xn)x_{n+1} = f(r, x_n) = r\,x_n\,(1 - x_n)xn+1​=f(r,xn​)=rxn​(1−xn​)

Throw away the transient, keep the attractor

For each rrr the chart iterates transient times (300) without recording anything, to let the orbit forget where it started and fall onto the attractor. It then iterates keep more times (60) and records each value. If a value stops being finite, iteration for that rrr stops and what was gathered so far is kept.

The recorded values are sorted and near-duplicates are removed: two values are merged when they differ by at most 10−6(1+∣x∣)10^{-6}(1 + |x|)10−6(1+∣x∣). So a fixed point shows as one dot, a period-ppp orbit as ppp dots, and a chaotic band as up to 60 dots scattered across it. Dots are small (1.5 px) and drawn at 60 percent opacity, so regions the orbit visits often come out darker.

Cost, and what the picture can hide

The total work is steps ×\times× (transient + keep) calls to your map: about 108,000 with the defaults, and it is recomputed only when a numeric prop changes. A periodic orbit with period larger than keep shows only part of itself, and a periodic window narrower than one step Δr=(rmax⁡−rmin⁡)/(steps−1)\Delta r = (r_{\max}-r_{\min})/(\text{steps}-1)Δr=(rmax​−rmin​)/(steps−1) can be missed entirely. The y axis is unfixed and fits the data.

Δr=rmax⁡−rmin⁡steps−1,δ=lim⁡k→∞rk−rk−1rk+1−rk≈4.669\Delta r = \frac{r_{\max} - r_{\min}}{\text{steps} - 1}, \qquad \delta = \lim_{k\to\infty}\frac{r_k - r_{k-1}}{r_{k+1} - r_k} \approx 4.669Δr=steps−1rmax​−rmin​​,δ=k→∞lim​rk+1​−rk​rk​−rk−1​​≈4.669

Real life usage

Fourteen thousand fish and a bad year

Nomvula ran a small fisheries lab for a river authority, and her problem was a fish. The authority stocked a trout called the silver chub (a fictional name for a real kind of headache) and set the annual catch limit on a simple model of how a generation turns into the next. Every few years the population crashed for no reason anyone could name, and a crash cost the authority about a fifth of its licence income.

The model had one parameter that mattered, the growth rate. It had been estimated at 2.8 and the board had been told, correctly, that at 2.8 the population settles to a steady number. A second estimate from a new survey put the rate at 3.3. The board asked whether that was the same thing but slightly better. It was not.

What Nomvula needed was a picture of behaviour against growth rate, for the whole plausible range, so that the board could see not one answer but the shape of all of them. She could have described it as a period-doubling cascade, which would have lost the room by the second hyphen.

She used <Bifurcation> with the model as map, a parameter range from 2.5 to 4, 600 steps and a longer transient, since the population took a while to settle. One thin line ran along the left, split at 3 into two, split again at about 3.45, and then went to fog. A vertical rule drawn by hand at 2.8 sat on the thin line. A second, at 3.3, sat in the part with two branches.

That was the whole conversation. At 3.3 the model does not settle on a steady number, it alternates between a high year and a low year, forever. The crashes were not random, they were the low branch of a two-year cycle, and the authority had been setting the same catch in good years and bad. Nobody had been negligent, they had been averaging.

The new rule set a catch limit that tracked the cycle, about 30 percent lower in the low year and 12 percent higher in the high one. Over six years the low-year population stayed above 9,000 fish, up from a trough of 4,100, and licence income stopped bouncing.

Nomvula's slide had one line of text on it: the fish had never been unpredictable, just two-faced.

Pitfalls

  • Too short a transient. If orbits near a bifurcation take a long time to settle, the plot shows the journey rather than the destination. Raise transient and see whether the picture changes.
  • Too few steps. Thin periodic windows are narrower than the gap between sampled parameters. If a narrow stripe seems to flicker in and out, increase steps.
  • Map signature. The closure receives the parameter first and the state second: map(r, x). Swapping them gives a plausible and entirely wrong plot.
  • Escaping orbits. If the map sends values off to infinity for some parameters, those columns come out empty or sparse. For the logistic map, keep r≤4r \le 4r≤4 and the start in [0,1][0, 1][0,1].

From around the web

Watch and read

YouTubeThis equation will change how you see the world (the logistic map)VeritasiumBuilds the logistic map and its bifurcation diagram from scratch, including the period doubling, the chaotic region and the Feigenbaum ratio.

Keep going

Related charts

Poincaré MapWhen you want to see the rule behind one particular parameter value, as a return map of its sequence.Phase PortraitWhen you want to see the flow of a continuous system, not the long-run values of a discrete one.HeatmapWhen you want to show density across two dimensions and do not have a rule, only measurements.
PreviousPoincaré MapNextH-R Diagram

On this page

  • Live
  • Overview
  • API
  • Examples
  • How to read it
  • When to use it
  • The math
  • Story
  • Pitfalls
  • Watch and read
  • Related