Select Page

Why is it so cool?

There are many videos on Youtube that show you the beauty of the Mandelbrot set. There are SO many videos and websites where you can just zoom in forever, and see the awesomeness of it. But what is this object? Well, to get the really formal definition, here is Wikipedia:

“Mandelbrot set images may be created by sampling the complex numbers and testing, for each sample point , whether the sequence  goes to infinity. Treating the real and imaginary parts of  as image coordinates on the complex plane, pixels may then be coloured according to how soon the sequence  crosses an arbitrarily chosen threshold. If  is held constant and the initial value of  is varied instead, one obtains the corresponding Julia set for the point.”

Wow, that is wordy! Let’s unwrap that a little bit.

To know exactly what this is a picture of, we need to understand what complex numbers are.

Intro to Complex Numbers

The first thing we need to understand is that this whole thing is in the world of imaginary and complex numbers. What is an imaginary number? An imaginary number has to do with the square root of negative one. Why does that not make sense? Well, the square root of negative one is asking: What number time itself equals negative one? Well, here are some values:

1• 1 = +1

-1• -1 = +1

-2• -2 = +4

-574• -574 = +?!?!?!?!?

So, as you can see, there is no way to calculate the square root of negative one. But people have fund it very useful to set the square root of negative one as the letter i, for imaginary.  Now, couple numbers have a real part and an imaginary part. So, for example, 3+2i is a complex number, with 3 as the real component, and 2 as the imaginary part.

The Mandelbrot set is drawn on what is called the complex plane, where the real component represents the position on the x-axis, and the imaginary component is the y-axis. So, the number 3+2i is equal to the point (3, 2).

Mandelbrot Set intro

To get the Mandelbrot set, let’s take a complex number, and call it c. And let’s associate to this complex number the following function: ƒc(z) = z2 +c, where z and c are complex numbers.

To get the Mandelbrot set, we are interested in the behavior of 0 iterated under ƒc(z). That means that, basically, we input 0 as z, and pick an arbitrary complex number, c.  Then we set the output as the NEW z, and keep repeating that. So let’s just say that c = 1, which is also 1+0i. Here is what happens.

02 + 1 = 1 (now 1 is the NEW z)

12 + 1 = 2 (now 2 is the NEW z)

22 + 1 = 5 (and so on.)

52 + 1 = 26

262 + 1 = 677

6772 + 1 = BIG NUMBER

BIG NUMBER2 + 1 = REALLY BIG NUMBER

And, you can already see what’s happening, the number is getting REALLY big.

What the Mandelbrot set is concerned about is if it gets BIG, or if it doesn’t. If it gets BIG, after, say, 500 iterations, then we color the point white on the complex plane, and if it stays at a reasonable value, we color the point black on the complex plane. So the point 1+0i is coloured white.

Let’s try another value of c, this time, -1.

02 – 1 = -1

-12 – 1 = 0

02 – 1 = -1

-12 – 1 = 0

02 – 1 = -1

-12 – 1 = 0

And so on. As you can see, this time, the values say at a reasonable number, because It keeps alternating between 0 and -1. That means that -1 IS in the Mandelbrot set.

So, to get the Mandelbrot Set, all you do is iterate EVERY number in the complex plane, and see if it gets REALLY big, or If it stays at a reasonable value, and this reasonable value is normally 2. And if it IS inside a radius of 2, after, say, 1000 iterations, then it’s coloured     black. If NOT, then it’s coloured white. And if it get’s big after a LONG time, we give it a color, and if it takes only a short time to get big, then we give it a different color, and that’s how we get these amazing pictures!

Sources

www.youtube.com/watch?v=NGMRB4O922I (The Mandelbrot Set – Numberphile)

medium.com/swlh/visualizing-the-mandelbrot-set-using-python-50-lines-f6aa5a05cf0f (Visualizing the Mandelbrot Set Using Python (< 50 Lines) )

davidgunter.com/2016/04/27/playing-around-with-the-mandelbrot-set/ (Playing around with the Mandelbrot Set)