Just Another Mandelbrot Visualization

generated grayscale fractal mandelbrot image

I haven’t done something in Processing for a while and I thought those “Mandelbrot sets” looked cool.

What is a Mandelbrot set?

The Mandelbrot set is the set of complex numbers c ∈ C for which the sequence z_{n+1}=z_n^2+c stays bounded when n → ∞. The initial value of z is given as z_0=0.

How is this visualized?

Every pixel on the screen is used to represent a complex number c. For each of those numbers the sequence above is calculated. If the sequence does not reach a given threshold after a given number of iterations n_max, it is believed to converge, thus c is believed to be in the Mandelbrot set.

The coloring can be done based on the magnitude of z_{n_max} or the number of iterations n_max.

And what is a Julia set?

To find all z ∈ C which are in a (filled) Julia set, we take the same sequence from before, z_{n+1}=z_n^2+c, but this time we are interested in all the different initial values z_0 for a given parameter c. If the sequence falls below a given “escape radius”, for a large enough n, the initial value z_0 is considered to be in the filled Julia set. The animation shows Julia sets with a varying parameter c.

animation showing the filled julia sets with different values