Éxperiences

Julia set / fractal-gif generator

Algorithm
Dev
Math

I developped in python and in rust a fractal generator based on the Julia Set.

complex number = -0.8 + 0.16i

algorithm

HOW DOES IT WORK

The julia_set function works by creating a 2D array of size x_res*y_res, and then filling it with the iteration ratio of each pixel (the number of iterations it took to reach the max_iter value) and then plotting it using imshow from matplotlib (the iteration ratio is used to determine the color of each pixel).

The generator works with all types of resolutions although it is recommended to use even and similar numbers for x_res and y_res.

Here’s some example with c = -0.8 + 0.16j and a resolution of 100x100 :

100x100

And here’s the same c value but 2000x2000 as resolution instead :

2000x2000

The julia.py file is completely callable from a Powershell terminal and will ask, how you want it to behave.

zoom cmd


Other than simply plotting images and saving them, the generator is also able to generate GIFs, there are two modes for now, one zooming progressively into one part of the fractal :

zoom gif

And there’s the second mode, making the c value fluctuate, to see how these changes impact the output.

gif b2b


You can test it yourself by clicking here