Explaining the Mandelbrot Set, visually

The Mandelbrot set is noe of the most interesting objects of Computer Graphics. Videos of zooming into Mandelbrot sets reveal extremely intricate and complex shapes and borders, yet the actual definition of the Mandelbrot set is, surprisingly, very simple. So how is the Mandelbrot set defined, and how do we get to these intricate graphics from the definition? Let us try to get a visual and intuitive understanding of the process.

Let us begin with a mathematical definition. Formally, the Mandelbrot set is defined as the set of complex numbers cc for which the following sequence, starting at 0, does not diverge:

zn+1=zn2+cz_{n+1}=z_{n}^{2}+c

This equation means that we have an iterative process. We start with an initial value, which in this case is 0, plug it in to the znz_{n} part of the equation and calculate the result. We then take the result and put it back into the equation to calculate the next iteration. We repeat this process again and again, up until infinity. So let's try to visualise this process.

But first, let's do a little refresher on how complex numbers work. A complex number takes the form of:

a+iba+ib

where ii is the imaginary number, is defined as:

i=1i = \sqrt{-1}

In our complex number, aa is called the real part, and bb the imaginary part. Since complex numbers basically have two components, this means that we can visualise them nicely in a 2D graph. By convention, the real part is the x-axis and the imaginary part the y-axis.

Here you can see the complex number 0.20+0.30i0.20+0.30i on a 2D plane. Drag the point on the left to see the value change!

Now that we have our complex numbers visualised, let's see how our Mandelbrot equation behaves when we iterate from different starting points. Here is a chart that shows the path that a complex number takes as it is iterated. Go ahead and play around with it! Get a feeling for how different values behave.

Here you can see the path that 0.20+0.30i0.20+0.30i takes after iterations. Adjust the number to iterations to see how the pattern continues!

As you play around with the value, you will notice that some of the values seem to get closer and closer to a certain point, forming beautiful spirals along the way . Other values seem to shoot off into infinity, either pretty quickly or after . We can start to already feel the boundries of our Mandelbrot set.

Now, if we remember our definition from earlier, the Mandelbrot set is defined as the set of complex numbers for which our equation does not diverge, i.e. the values that don't go to infinity. Let us visualise this by coloring in all the pixels. We will use the following rule:

So if we expand our iteration process to all points on the plane, we can see our Mandelbrot set emerge after just a few iterations:

The path that 0.50+0.50i-0.50+0.50i takes after 15 iterations.

Additionally, the values of all points after 15 iterations are colour-coded - the slower they diverge, the darker they are.

We can see a lot of interesting patterns emerge, like how if you move the dot into one bulbs, it starts to cycle, either in polygon or star patterns. Its fascinating to see how all this complexity came from this one simple equation in the beginning: zn+1=zn2+cz_{n+1}=z_{n}^{2}+c

Note that, since the Mandelbrot set is defined as the values that don't diverge afer an infinite number of iterations, that means that the more we increase the number of iterations, the closer we get to the set's true form.

Lastly, it is well known that fun part about Mandelbrot sets is the zooming in, so for the end I present an interactive widget where you can explore the Mandelbrot set and zoom in for youself! Have fun: