Tag Archives: Mandelbrot set

The Mandelbrot Set is one of the most famous fractals. This fractal carries the name of the French mathematician Benoit Mandelbrot (1924 – 2010). The first ones how implemented the Mandelbrot Set with computer where mathematicians Robert Brooks and Peter Matelski.

The mathematical definition of the Mandelbrot Set

The Mandelbrot Set is set M, where belong all the points c, to which zn is finite, when n approaches infinity, where

z0 = c

zn+1 = zn2 + c

The initial point is (0,0i). Here both z and c are complex numbers. The c is held constant and z is variable that’s value changes.

The Mandelbrot Set on the complex plane

The Mandelbrot Set is typically generated from rectangle on the complex plane from bottom left (-2.25 -1.5i) and upper right (0.75 + 1.5i). The zooming of the Mandelbrot Set is done by selecting different coordinates on this rectangle from somewhere on the border of the set. See the picture below:

The set M is the black area in the picture. The other colors represent the distance from the set. In a way when you’re looking other colors than black, you’re watching infinity.

The helpful proof

Fortunately there’s is mathematical proof, that says that is sufficient to test that is the absolute value of iterated point > 2. If the absolute value of iterated complex number is greater than 2, the iterated point is to divergence to infinity and does not belong to the set. Otherwise the point belongs to the set.

The idea of the generating the Mandelbrot Set

The recursive formula will be implemented by iterative way.

The Mandelbort set is generated to computer screen by taking each pixel point and by choosing that point as constant C (after converting this to correspond the complex plane point). When each iteration loop begins, z is first set to (0 + 0i). Next the formula z = z + c is iterated with checking if z is to divergence to infinity by calculating the absolute value of z. If the absolute value of z > 2, the point is to divergence to infinity and does not belong to the set. Otherwise the point belongs to set.

Imagine each pixel point as a point on the chosen complex plane rectangle.

Pixel’s width and height on the complex plane are calculated as follows:

dr = (maxR - minR) / SCREEN_WIDTH
di = (maxI - minI) / SCREEN_HEIGHT

Other thing to consider is the scale of the picture: The complex plane rectangle’s ratio must be scaled to same as screen area’s ratio.

With greater amount of iterations it may be the case, that a point that doesn’t diverge to infinity with lower amount of iterations, diverges to infinity with greater amount of iterations. Thus, with computers in fact every generated Mandelbrot set picture is some kind of approximation of the Mandelbrot set.

Shortly about the colors

If the point c belongs to the set, the pixel is usually colored black. The other colors are calculated from the iterations. Easiest way to calculate different shades from the iterations is the following: