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.
- Python | Merge Python key values to list
- Important differences between Python 2.x and Python 3.x with examples
- Reading Python File-Like Objects from C | Python
- Python | Index of Non-Zero elements in Python list
- Python | Convert list to Python array
- Python | Add Logging to Python Libraries
- Python | Sort Python Dictionaries by Key or Value
- Python | Add Logging to a Python Script
- Python | Set 4 (Dictionary, Keywords in Python)
- Python | Visualizing O(n) using Python
- max() and min() in Python
- SHA in Python
- Python Set | pop()
- Any & All 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.