Elysia Tools

Navigation

Math

Barnsley Fern and the Chaos Game

Draw the Barnsley fern with four affine maps. Change their weights or coefficients to compare point density and shape.

Open static visualization

Tool usage guide

Learn when to use this tool, what it supports, and how real users apply it.

Overview

The Barnsley fern is the attractor of an iterated function system (IFS) made of four affine maps. Color the samples by map to see how the stem, main frond and two basal leaflets fit together. Keep the random seed fixed to compare changes one at a time.

How the four maps form the fern

Each row applies Fᵢ(x,y) = (ax + by + e, cx + dy + f). The coefficients a, b, c and d specify the linear part. The pair (e, f) translates the result. Both expressions use the coordinates of the same previous point.

For the classic maps, the attractor A is the union of the four images Fᵢ(A). F₁ collapses the whole fern onto the stem axis. F₂ draws the main frond, and F₃ and F₄ draw the basal leaflets. These pieces are affine images and can scale by different amounts in different directions, giving the fern its self-affine structure.

How the four maps form the fern
MapImage of the whole fernClassic weight
F₁Stem0.01
F₂Main frond0.85
F₃Left basal leaflet0.07
F₄Right basal leaflet0.07

Weights and point density

The chance of drawing a map is its weight divided by the sum of positive weights. With the same contractive maps and all weights positive, the limiting distribution can change while its support stays the same. Finite clouds can look quite different because the draws visit some regions more often.

A zero weight removes the map from the sampled system. The remaining maps determine the support of the sample distribution. The counters show which map produced each retained point. The density coloring uses accumulated counts in small canvas cells.

A run you can replay

The orbit starts at (0, 0). The viewer takes one Mulberry32 draw per step, discards the first 64 updates as warm-up and counts the following points. Replay with the same coefficients, weights, seed and point count to reproduce the draw sequence and coordinates.

Points per frame sets the pace of the animation. Color and background change the rendering. The last-point and largest-x values are read from the plotted samples. They describe this run.

How it works

  1. Choose Classic weights and set the random seed to 42 and Points to plot to 50000. Keep the color setting on Map to match the points to the rules.
  2. Choose Equal weights or Skip stem map. Wait until the run completes and compare the counts below the canvas.
  3. Return to Classic weights and edit a coefficient in the table. Keep the seed and weights fixed to isolate the effect of that coefficient.

Edge cases & common failures

  • Every weight is zero

    The viewer draws an empty cloud. Give at least one map a positive weight to resume sampling.

  • An active map can stretch the plane

    The contractive IFS theorem applies when each active linear part has a Euclidean operator norm below 1. An edited system can still be explored as a finite orbit. If its coordinates overflow, the viewer stops and keeps the retained finite points.

Examples

1. Compare classic and equal weights

How to use

Run Classic weights and then Equal weights for the same seed and point count.

Seed 42 · 50000 plotted points

Outcome

F₂ is drawn 42482 times with classic weights and 12397 times with equal weights. The four maps are identical in both runs.

2. Approach one fixed point

How to use

Choose Main map only and set Points to plot to 5000. Read the last point at the end.

Seed 42 · 5000 plotted points

Outcome

The last point rounds to (2.656, 9.959), near the solution to F₂(x,y) = (x,y).

3. Change the horizontal contribution of y

How to use

Start from Classic weights and edit b in the F₂ row from 0.04 to 0.08.

Seed 42 · 50000 plotted points

Outcome

The sample’s largest x moves from 2.655 to 4.985. The change leaves the map selection sequence intact.

FAQ

What does Normalize weights do?

It divides each positive weight by their sum. The table then shows the probabilities used in the draw, up to floating-point precision.

What counts as a plotted point?

Every retained iteration counts once, including repeated coordinates. The first 64 updates are warm-up. Several plotted points can land on the same pixel.

At a Glance

Interactive Preview

Barnsley Fern and the Chaos Game
Static preview of this visualization. Use the interactive panel above to explore it.

Verified Results

Typical Experiments and Results

Every parameter set and result below is a fixed output of this page's built-in model (each asserted before delivery) and reproduces directly: set the Parameters column in the interactive panel.

ScenarioParametersResult
Classic weightsClassic, seed 42, 64 warm-up steps, 50000 plotted points.F₁–F₄ selections = 498, 42482, 3476, 3544.
Equal weightsEqual, seed 42, 64 warm-up steps, 50000 plotted points.F₁–F₄ selections = 12477, 12397, 12634, 12492.
Skip the stem mapSkip stem map, seed 42, 64 warm-up steps, 50000 plotted points.F₁–F₄ selections = 0, 42902, 3530, 3568.
Approach a fixed pointMain map only, seed 42, 64 warm-up steps, 5000 plotted points.F₂ is selected 5000 times. The last point is approximately (2.656, 9.959).
Increase the point budgetClassic, seed 42, 64 warm-up steps, 5000 → 50000 plotted points.The first 5000 points match exactly. F₁ is selected 39 and 498 times, respectively.
Change one coefficientClassic with b₂ = 0.04 → 0.08, seed 42, 64 warm-up steps, 50000 plotted points.Sample max x increases from 2.655 to 4.985. The map sequence matches.

Sources

References

Papers and datasets underlying this visualization - every formula, algorithm, and data anchor on the page traces back to the sources below.

  1. [1]

    Michael F. Barnsley (1993). Fractals Everywhere. Academic Press, 2nd ed..

    View source→ Table III.3 · fern Aᵢ, bᵢ, pᵢ · Algorithm 8.2
  2. [2]

    John E. Hutchinson (1981). Fractals and Self-Similarity. Indiana University Mathematics Journal 30(5), 713–747.

    View source→ §3.1, §4.4 · A = ∪ Fᵢ(A) · support of the invariant measure
  3. [3]

    M. F. Barnsley and S. Demko (1985). Iterated function systems and the global construction of fractals. Proceedings of the Royal Society of London. Series A, Mathematical and Physical Sciences 399(1817), 243–275.

    View source→ p-balanced measures · IFS attractor as measure support
  4. [4]

    Michael F. Barnsley and Andrew Vince (2011). The chaos game on a general iterated function system. Ergodic Theory and Dynamical Systems 31(4), 1073–1079.

    View source→ Theorem 1 · random orbit tail and the attractor
  5. [5]

    Ian D. Morris and Natalia Jurga (2021). How long is the chaos game?. Bulletin of the London Mathematical Society 53(6), 1749–1765.

    View source→ §1 · finite coverage versus the limiting attractor
  6. [6]

    Michael F. Barnsley (1996). Fractal Image Compression. Notices of the AMS 43(6), 657–662.

    View source→ 2D affine parameters · Hutchinson union operator

Related

Related tools and workflows

Format Conversion

AsciiMath LaTeX MathML Equation Converter

Convert equations between AsciiMath, LaTeX and MathML: auto-detect the input format, produce canonical LaTeX, presentation MathML with an embedded TeX annotation, a best-effort AsciiMath back-translation, a screen-reader aria-label snippet (role=math), and a KaTeX HTML preview.

Document Tools

PDF Formula Extractor (LaTeX / MathML / MathJax) with AMS Equation-Number Preservation

Detect and reconstruct embedded math formulas from vector PDFs: math-font recognition (CMMI/CMSY/CMEX, STIX, Cambria Math), Unicode math, super/subscripts and stacked fractions, AMS equation numbers ((2a)/(2b) subequations) preserved; outputs copyable LaTeX, presentation MathML (MathJax/KaTeX-compatible) and a downloadable .tex bundle.

AI Tools

AI Math Solver/Photomath

Solve math problems from images using AI vision models with step-by-step explanations

Math & Numbers

Fibonacci Sequence Generator

Generate Fibonacci sequence with customizable start numbers, length, and output format. Includes golden ratio analysis and mathematical properties.

Next

More visualizations nearby

Cookie settings

Essential cookies keep the site running. Analytics and personalized ads are optional.

Cookie policy