Barnsley Fern in Python:

This code was created by the great Mathematician Michael Barnsley. It is fractal in shape, and the geometric features resemble that of a natural fern, and so it gets its name from this. It is there by iteration over a large number of times on four mathematical equations. So, it was introduced by Barnsley and is known as the iterated function system(IFS). Now, we will create one such code in python for data science.

Barnsley uses the following formula for transformation.

How to write Barnsley Fern Code in Python for Data Science - PST Analytic

The letters have the following values:

p is the probability.

The four equations are as follows:

How to write Barnsley Fern Code in Python for Data Science - PST Analytic

We will create the fern using the above equations. Now we will see the same in Python 3.

How to write Barnsley Fern Code in Python for Data Science - PST Analytic

OUTPUT:

Note: The output will depend on the coefficients of the equation.

So, to learn more about it in python for data science, you can check this and this as well.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.