Barnsley fern is a fractal shape created by mathematician Michael Barnsley. The geometric features of this fractal resemble a natural fern and hence it gets its name. Barnsley fern is created by iterating over a large number of times on four mathematical equations, introduced by Barnsley, known as Iterated Function System (IFS).
The transformation Barnsley used had the formula :
where, the letters had following value :
and “p” is the probability.
Thus the four equations are:
With the help of above equations, the fern is created. Now lets see the Python3 implementation for the same.
Note: The whole output depends upon the coefficients of the equations. One experiment might be to change the coefficients and get a new pattern every time.
- Important differences between Python 2.x and Python 3.x with examples
- Python | Set 4 (Dictionary, Keywords in Python)
- Python | Sort Python Dictionaries by Key or Value
- chr() in Python
- Python Set | pop()
- Any & All in Python
- Python | a += b is not always a = a + b
- zip() in Python
- SHA in Python
- SQL using Python | Set 1
- pow() in Python
- bin() in Python
- try and except in Python
- gcd() in Python
- set add() in python
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.