Julia fractal in Python
Introduction to julia set
In the context of complex dynamics, a topic of mathematics, the Julia set and the Fatou set are two complementary sets (Julia ‘laces’ and Fatou ‘dusts’) defined from a function. Informally, the Fatou set of the function consists of values with the property that all nearby values behave similarly under repeated iteration of the function, and the Julia set consists of values such that an arbitrarily small perturbation can cause drastic changes in the sequence of iterated function values. Thus the behavior of the function on the Fatou set is ‘regular’, while on the Julia set its behavior is ‘chaotic’.
The Julia set of a function f is commonly denoted J(f), and the Fatou set is denoted F(f). These sets are named after the French mathematicians Gaston Julia and Pierre Fatou whose work began the study of complex dynamics during the early 20th century. [Source Wiki]
The equation to generate Julia fractal is:
where c is a complex parameter. The Julia set for this system is the subset of the complex plane given by:
So let’s now try to create one of the fractal in the above image.
To do so we need the Pillow module of python which makes it easy to dealt with images and stuff.
To install pillow through pip type the following command in the command prompt.
pip install Pillow
Now using this library to create the fractal image.
Also refer to this video by numberphile for more information.
After understanding the code try to draw the other fractals by changing the value of the variables and post your github link to the code down in the comment section and i’ll be happy to help you if any error comes up.
This article is contributed by Subhajit Saha. 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 write comments if you find anything incorrect, or you want to share more information about the topic discussed above.