The Barnsley Fern
[ref: https://scipython.com/book/chapter-7-matplotlib/examples/the-barnsley-fern/]
The Barnsley Fern is a fractal which resembles the Black Spleenwort species of fern. It is constructed by plotting a sequence of points in the (x,y) plane, starting at (0,0), generated by the following affine transformations f1, f2, f3, and f4 where each transformation is applied to the previous point and chosen at random with probabilities , , and .
First we import necessary libraries for arrays and plotting:
Next we set up the affine transformations:
Then we set the number of points and width and height:
Then we use a for
loop to repeatedly apply the affine transormations:
Finally, plot the resulting image:
Thank you for generating the Barnsley Fern!
#test
#Thank you for generating the Barnsley Fern!
hello