← Math

🌿 Barnsley Fern 3D

IFS variant:
Points: 150k
IFS Chaos Game
f₁ — Stem (1%)
f₂ — Main frond (85%)
f₃ — Left leaflet (7%)
f₄ — Right leaflet (7%)
xₙ₊₁ = a·xₙ + b·yₙ + e
yₙ₊₁ = c·xₙ + d·yₙ + f
z extruded for 3D depth
Points: 0  |  Transforms: 4  |  Variant: Classic Fern

🌿 Barnsley Fern — Iterated Function System

Four affine transformations applied randomly at probabilities 0.01/0.85/0.07/0.07 generate a mathematically perfect fern leaf from a single starting point. This is an iterated function system — a fractal defined not by an equation but by a set of contractions.

🔬 What It Demonstrates

Each transformation maps the current point to a new location. 85 % of the time the 'blade' map slightly scales and rotates the point upward — this builds the main frond. The three remaining maps create the stem, small bottom leaflets and the overall bending. The attractor has fractal dimension ≈ 1.74.

🎮 How to Use

Press Start to scatter individual dots; watch the fern materialise pixel by pixel. Adjust the colour scheme to colour by transformation index. Use the preset panel to switch to Cyclosorus, Fishbone or Maple-leaf IFS systems.

💡 Did You Know?

Michael Barnsley developed IFS theory in 1988 while working on image compression. The fern fits in 36 bytes of numbers — versus kilobytes as an image. His company Iterated Systems briefly held the patent for fractal image compression, used in some CD-ROM encyclopaedias of the 1990s.

About Barnsley Fern — Iterated Function System Fractal

The Barnsley Fern is a fractal generated by an Iterated Function System (IFS) using the Chaos Game algorithm. Starting from a single point, one of four affine transformations is chosen randomly — with probabilities of 1%, 85%, 7%, and 7% — and applied repeatedly. After tens of thousands of iterations, the scattered points converge onto the shape of a perfect fern leaf, revealing the attractor of the IFS with a fractal dimension of approximately 1.74.

Michael Barnsley introduced IFS theory in 1988, partly as a method for image compression. The entire fern shape is encoded in just 24 numbers (the coefficients of four 2D affine transformations), yet unfolds into an infinitely detailed self-similar structure used as a canonical example in fractal mathematics and chaos theory courses worldwide.

Frequently Asked Questions

What is an Iterated Function System (IFS)?

An Iterated Function System is a finite collection of contraction mappings on a complete metric space. When applied repeatedly and randomly according to assigned probabilities, these mappings converge to a unique fixed set called the attractor. For the Barnsley Fern, the four affine maps each contract space and together produce the self-similar fern shape as their shared attractor.

How do I use this simulation?

Select an IFS variant (Classic Fern, Thelypteridaceae, Tree-like IFS, or Spiral IFS) from the dropdown. Drag on the canvas to orbit the 3D point cloud, scroll to zoom, and use the Points slider to increase or decrease the number of plotted chaos-game iterations between 50k and 250k. The colour of each dot indicates which of the four transforms produced it.

Why does one transformation have a probability of only 1%?

The first transformation (f1, shown in deep green) collapses the entire plane down to the narrow stem of the fern. Because the stem is a small part of the overall shape, it needs far fewer points than the main frond transformation (f2, 85%) which handles the bulk of the leaf blade. The two leaflet transforms (f3 and f4, 7% each) produce the small bottom pinnae at either side of the base.

What are the exact affine transformation coefficients for the classic Barnsley Fern?

Each transform follows xn+1 = a*xn + b*yn + e and yn+1 = c*xn + d*yn + f. The classic fern uses: f1 [a=0, b=0, c=0, d=0.16, e=0, f=0, p=0.01] for the stem; f2 [a=0.85, b=0.04, c=-0.04, d=0.85, e=0, f=1.6, p=0.85] for the main blade; f3 [a=0.2, b=-0.26, c=0.23, d=0.22, e=0, f=1.6, p=0.07] for the left leaflet; and f4 [a=-0.15, b=0.28, c=0.26, d=0.24, e=0, f=0.44, p=0.07] for the right leaflet. Together these 24 numbers completely define the infinite fern attractor.

What is the fractal dimension of the Barnsley Fern?

The Barnsley Fern has a Hausdorff fractal dimension of approximately 1.74. This value lies between 1 (a line) and 2 (a filled plane), reflecting the fact that the fern is a complex self-similar curve that partly fills the plane but is not dense in any 2D region. The fractal dimension can be estimated by box-counting: covering the fern with boxes of shrinking side length and counting how many are needed scales as a power law with exponent ~1.74.

How is the Barnsley Fern used in real-world image compression?

Barnsley and Alan Sloan founded Iterated Systems Inc. in the late 1980s to commercialise fractal image compression (FIC). The idea is to decompose any image into overlapping self-similar regions and encode each region as a contractive affine map. The decoder iterates these maps until the attractor converges to the original image. FIC achieved compression ratios of 100:1 or more and was used in Microsoft Encarta and other CD-ROM encyclopaedias in the 1990s before JPEG and MPEG became dominant.

What is the Chaos Game and who invented it?

The Chaos Game is a probabilistic algorithm introduced by Michael Barnsley in his 1988 book "Fractals Everywhere." Rather than computing the attractor analytically, you pick a random starting point and repeatedly apply a randomly chosen contraction map (weighted by probability). Barnsley proved that, for almost every starting point, the orbit eventually traces the exact attractor. The method is computationally efficient and visually compelling because the fern shape emerges from apparent randomness.

What is a common misconception about the Barnsley Fern?

A common misconception is that the Barnsley Fern is a biological model of an actual fern species. In reality it is a purely mathematical construction — a set of four linear maps chosen by Barnsley specifically because their attractor resembles a fern. Real fern growth is governed by genetics, differential equations of cell division, and environmental factors, not by four fixed affine maps. The visual similarity is a coincidence that illustrates how simple mathematical rules can produce natural-looking complexity, a theme central to fractal geometry.

What other IFS fractals are related to the Barnsley Fern?

Many natural-looking IFS fractals exist alongside the Barnsley Fern. The Sierpinski Triangle is generated by three contraction maps with equal probability and was one of the first IFS attractors studied. The Pythagoras Tree uses branching IFS maps to produce a self-similar tree. Dragon curves, Levy C curves, and the Heighway Dragon are also IFS attractors. The four preset variants in this simulation — Classic Fern, Thelypteridaceae (mutant fern), Tree-like IFS, and Spiral IFS — each use a different set of four affine coefficients to produce distinct plant-like or geometric shapes.

How is IFS theory used in modern computer graphics and procedural generation?

IFS remains a practical tool in procedural graphics. Game engines and 3D rendering pipelines use IFS-derived L-systems and stochastic grammars to generate vegetation, terrain textures, and cloud shapes at multiple levels of detail. Machine learning research has revisited fractal compression using neural networks (deep fractal autoencoders) to learn optimal contractive maps from data. IFS theory also underpins multifractal analysis used in medical imaging, financial time-series analysis, and turbulence modelling, where signals are decomposed into self-similar components at multiple scales.

What are current research directions in IFS and fractal attractors?

Active research areas include the inverse IFS problem — automatically finding the optimal set of affine maps to approximate any given shape or image, now tackled with genetic algorithms and deep learning. Researchers are also studying random IFS where the maps themselves vary stochastically, leading to "fuzzy" attractors with probabilistic dimension spectra. In pure mathematics, open questions remain about the exact Hausdorff dimension of self-affine attractors when the maps are not conformal. Connections between IFS attractors and number theory (via Bernoulli convolutions) and to the geometry of Julia sets in complex dynamics continue to be explored.