Mathematics, mathematics education and computer programming.

Barnsley’s Fern

Barnsley’s fern is a mathematically generated image that resembles the Black Spleenwort fern as shown below

This fractal was first described by Michael Barnsley in his book Fractals Everywhere in 1993. It is surprisingly easy to generate and is an example of an iterated function system. It is based on randomly applying one of four affine transformations.

The initial point is set to be the origin, and subsequent points are generated by applying one of the above four transformations. Which transformation is chosen probabalistically – the probabilities are \(0.01,0.85,0.07\) and \(0.07\) for \(f_1,f_2,f_3\) and \(f_4\) respectively.

I wrote two (basic) functions in Matlab, one to generate the points and then one to plot them.

A video (generated using Matlab) showing the growth of the fern is below:

Here is the Matlab code I used to generate the video – it takes a relatively long time to run as it plots each frame separately.