Complex numbers

At some point, mathematicians were making calculations and faced a situation where it was impossible to make their mathematical calculations using ordinary numbers.

For example, find the correct root in the equation on the left.

Then they came up with a non-existent number that can't count anything, but which helped them solve the equation. This is the number i, equal to the root of minus one. A completely abstract, but useful experiment.

Complex numbers appeared, in which, in addition to the normal, understandable part, there was also an incomprehensible one, where there is this i. The understandable part is called real, and the incomprehensible part is called imaginary.

Complex plane

Since complex numbers consist of two parts (real and imaginary) and the coordinates of pixels on the screen also consist of two parts (how many are horizontal and how many are vertical), you can draw a map of complex numbers on the screen. Or, in another way, a complex plane.

Any complex number can be marked on this complex plane, for example –1,3 + 0,8i

The Mandelbrot Set

The Mandelbrot set is a group of complex numbers that pass a certain face control.

The rules are as follows: we take zero, multiply it by itself and add it to the complex number that we want to check. Then we multiply the result by ourselves and add it to our number again. Then again and again, again and again. And so on indefinitely. With each approach, a new complex number is obtained, which either goes further and further from the center, or not.

If it goes to infinity, it means that the original number did not pass face control. If it remains, welcome to the Mandelbrot set.

As you can see, the number –1,3 + 0,8i has moved away from the second approach, and –0,1 + 0,1i has not gone anywhere.

Let's check every pixel on the screen:

It turns out an interesting picture (in scientific terms, "cardioid"). What is painted white is included in the Mandelbrot set. Everything else is not.

If we zoom in on the picture, we will see more and more new details on the borders of the cardioid. The part of the previous image is on the screen. It is increased by 13 times. The point is that the plane can be approximated as much as you want, something new will always appear, although similar to the previous one. Such a matter is called a fractal.

Some area of the fractal, enlarged by 210,000 times. Only a few small cardioids are visible. We can zoom in further, but we will still get circles and new cardioids. Not very impressive.


Let's remember that the picture is drawn like this: we check each complex number many times until we understand whether it passes face control. Let's add to the picture: the faster the number goes to infinity, the darker the color. Instantly flew into the void? Almost black. Barely crawling? Almost white. Here's what happens:

Amazing, isn't it?

Almost all points on the screen are not included in the Mandelbrot set, but all are moving away from it at different speeds.

You can color the picture not in black and white, but like this:

Recursive palettes

There is another cool way to colorize a picture. You can take one set of colors and not fill them all at once, but paint only 50% of the fastest-moving ones. Take 50% of the remaining ones again and color them. Then another 50% and so on. Here's what happens if you take only black and white colors:

The drawing has become more contrasting and interesting in detail.

It remains to add a color.

Black jellyfish.

A cyclone.

Jellyfish crawl out of the crack.

Julia Island. This is the official name. A branch of the Julia set in the Mandelbrot set.

In the center of the island, an infinite number of cyclone cordon guards the king of Cardeoid.

The big cyclones in the cordon have their own ball on a thread.

Layers of guards near the sting of King cardeoid. Each cordon has its own atmosphere, which seeps between cyclones.

The cardioid without protection was overgrown with a two-pronged electric mold.

The predatory cardeoid killer spread its venomous paws in anticipation of the victim.

Valley of forks.

Valley of half-forks

Valley of the super-forks



The sun.


The burning ship

If you slightly change the rules on face control, and before multiplying something by yourself, remove the disadvantages from the real and imaginary parts, you will get a different fractal.

The fleet is on fire.

The falling Cathedral.


Water under the keel of the flagship.