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 | Merge Python key values to list
- Reading Python File-Like Objects from C | Python
- Python | Sort Python Dictionaries by Key or Value
- Python | Set 4 (Dictionary, Keywords in Python)
- Python | Add Logging to Python Libraries
- Python | Add Logging to a Python Script
- pow() in Python
- Python vs PHP
- Any & All in Python
- abs() in Python
- chr() in Python
- Python Set | pop()
- SHA 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 firstname.lastname@example.org. 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.