The Barnsley Fern
The Barnsley Fern is a fractal named for the British mathematician Michael Barnsley, who described it in Fractals Everywhere. It is drawn to resemble the black spleenwort, Asplenium adiantum-nigrum, and it is one of the clearest pictures of an iterated function system.
A fern from a repeated formula
The fern is a basic example of a self-similar set: a pattern you can reproduce at any magnification. Like the Sierpinski triangle, it shows how a simple formula, used again and again, can build a picture that looks alive. Barnsley's 1988 book Fractals Everywhere grew out of the Fractal Geometry course he taught at the Georgia Institute of Technology. A later course, Fractal Measure Theory, continued the same work. Graphic artists have used that idea ever since, imitating plants with mathematical models.
An iterated function system
The fern code is an iterated function system, an IFS. The collage theorem says that if you can cover a shape with smaller copies of itself, the maps that make those copies have that shape as their attractor. Barnsley used fractals for many things in science and technology. Plants were the special case, because a branching frond really is made of smaller branching fronds. Nature is not a perfect copy at every scale. No two ferns match, and at some point a branch becomes a leaf. Barnsley later studied V-variable fractals, which keep a continuous dependence on parameters while allowing the pattern to vary from one scale to the next. He suggested that a geometric code which fits a plant may correspond to information stored in that plant's genes. The app's curl, leaflet size, and random mutants are a small, hands-on version of playing with those parameters.
Four affine maps
One transform is f(x, y) = a matrix [[a, b], [c, d]] times the column (x, y), plus a shift (e, f). Barnsley's black spleenwort uses four of them. The numbers below are his IFS code: a through f are the coefficients, and p is the chance that map is chosen. Stem, chosen 1% of the time: a = 0, b = 0, c = 0, d = 0.16, e = 0, f = 0. Successively smaller leaflets, chosen 85% of the time: a = 0.85, b = 0.04, c = −0.04, d = 0.85, e = 0, f = 1.60. Largest left-hand leaflet, chosen 7% of the time: a = 0.20, b = −0.26, c = 0.23, d = 0.22, e = 0, f = 1.60. Largest right-hand leaflet, chosen 7% of the time: a = −0.15, b = 0.28, c = 0.26, d = 0.24, e = 0, f = 0.44.
How a computer draws it
In principle you could plot the fern by hand. In practice it takes tens of thousands of points, so a computer is the practical tool. Any program that uses these constants draws the same fern. Start at the origin, x = 0 and y = 0. Then repeat: pick one of the four maps at random, using the probabilities, and replace the point with its image. The stem map is xn+1 = 0 and yn+1 = 0.16 yn. It only squeezes points onto the first bit of stalk, and that stalk fills in first. The second map, chosen most often, copies a leaflet into the next smaller leaflet up the stem. The third flips a leaflet across the stem onto the left pinna. The fourth lays the matching pinna on the right without that flip. The whole fern is a larger replica of each frond. For these constants it lies in about −2.1820 < x < 2.6558 and 0 ≤ y < 9.9983.
Mutant varieties
Shift the coefficients and the fern becomes a different plant. Barnsley called this freedom a superfractal. One published mutant looks like a Cyclosorus, in the family Thelypteridaceae: Stem: a = 0, b = 0, c = 0, d = 0.25, e = 0, f = −0.4, p = 0.02. Main copy: a = 0.95, b = 0.005, c = −0.005, d = 0.93, e = −0.002, f = 0.5, p = 0.84. Left: a = 0.035, b = −0.2, c = 0.16, d = 0.04, e = −0.09, f = 0.02, p = 0.07. Right: a = −0.04, b = 0.2, c = 0.16, d = 0.04, e = 0.083, f = 0.12, p = 0.07. A second four-map mutant, the leptosporangiate fern in the app, uses another published set of the same kind. Stem and copies drops the two side maps so you can see the stalk and the chain of smaller leaflets on their own.
Explore it in PictorX
Open Barnsley Fern and let the chaos game run. Drag to move, scroll to zoom into a leaflet, and switch the colour mode to By transform to paint each map in its own hue. Thelypteridaceae and Leptosporangiate load the mutant tables. Curl and Leaflet size bend the published coefficients, and Randomize invents a further mutant. Save a PNG or open the canvas in the PictorX editor. Pair it with Fractal generator or the Collatz Conjecture for more pictures that come from a short rule.
Frequently asked questions
Who designed the Barnsley Fern?
Michael Barnsley. He published the fern in Fractals Everywhere as a model of the black spleenwort, and as a classroom example of an iterated function system.
What is an iterated function system?
A small set of functions, here four affine maps, applied over and over. The collage theorem says the picture you get is the unique shape that is the union of its images under those maps.
Why is one map chosen 85% of the time?
That map builds the chain of smaller leaflets up the stem, which is most of the frond. The stem map is rare because the stalk is a thin set. The two side maps only have to seed the lowest pinnae; self-similarity fills in the rest.
Can I make a fern that is not in the list?
Yes. Curl and Leaflet size move the black-spleenwort coefficients, and Randomize perturbs a whole table. Extreme values can stop looking like a fern. That is the mutant, or superfractal, behaviour Barnsley described.
Ready to try it?
Open PictorX in your browser — no install, no credit card required to start.
Try Barnsley Fern