The same motif in different colouring. The Julia set for a point in this domain.

Click on the pictures to see them in full size.

A Simple Mandelbrot Program

For the family of iterations z → z2 + c.

Download Mandelbrot.exe

and this brief Instruction_Mandelbrot.txt

When you right/left-click, you zoom in/out at the position of the cursor, so that the new widths of the section are 1/4 and 4 times the former, respectively. The number in the window states the ratio between the first and the present width of the section. You can zoom in to a magnification of one thousand million times. The program is closed by pressing Esc. Pressing any (random) key stops the drawing.

Key L produces lighting effect (or remove it) - the picture is then drawn more slowly. Each of the ten number keys produces a colour scale (number 8, 9 and 0 are for imported pictures of colour scales). The colouring is adjusted by scrolling up and down: the function of the scrolling is chosen by the five keys A-G:

      A density of the colours

      S displacement of the scale

      D density of the light

      F horizontal angle of the light

      G vertical angle of the light

After pressing Shift the scrolling is in smaller steps, and after pressing key Z the zooming is in smaller steps. The boundary is made twice as thin by key B.

The maximum iteration number is adjusted automatically, but it can be necessary to adjust it manually. The drawing runs faster when the number is low (if there is much black in the picture), and a faultless picture can require a high maximum iteration number. The keys I and O lower and raise it.

After keying J and right-clicking, the Julia set associated to the point of the cursor is drawn. Hereafter the procedure is the same as for the Mandelbrot set. A Julia set is self-similar, meaning that every part has the same structure as the whole, and this structure is identical to the structure of the Mandelbrot set at the locality of the Julia set point (when this is near the boundary of the Mandelbrot set). Keying J (again) brings you back to the Mandelbrot set.

A press on key P produces the actual picture as a file (in BMP format and named "Pict0"). When you have found a nice motif, you can draw it in large size (in BMP format and named "Pict"). In this drawing four times as many points are involved, in order to make the boundary more attractive. Therefore the drawing can take some time. Press first key Q and then one of the F-keys (except F1 and F10) to choose the width (in pixels) of the picture and begin this drawing: F2: 640, F3: 800, F4: 1000, F5: 1200, F6: 1600, F7: 2000, F8: 3200, F9: 4000, F11: 6400, F12: 8000. Following this the window closes, but under "properties" of the file you can follow the progress of the production (if the picture is not to be worked up, you should convert it to JPG format).

An imported colour scale must be in BMP format and has a width of 720 pixels. It is put in the folder with the program and given one of the names "scale1", "scale2" or "scale3", and it is chosen by key 8, 9 and 0, respectively. Such colour scales can be produced by the program Ratio.

The above section is taken from a microscopic mini-mandelbrot at the end of the main antenna.


The following pictures show sections of Julia sets for the iteration z → z2 + c, for various c-values:


Some colour scales

Download by clicking on the picture


Definition of the Mandelbrot set

The construction of the Mandelbrot set for a general complex function f(z) is based on the choice of two critical points z* and z** for f(z). These two points are solutions to the equation f'(z) = 0, but if for instance f(z) is a polynomial, the "point" ∞ is also a critical point. The Mandelbrot set associated to the family of iterations z → f(z) + c (where c is a complex parameter that indexes the members of the family) and the chosen points z* and z** consists of the complex numbers c such that the two sequences of iteration starting in z* and z**, respectively, do not have the same termination. Our program draws the usual Mandelbrot set, that is, the Mandelbrot set for the family of iterations z → z2 + c. The function f(z) = z2 has two critical points: 0 and ∞, therefore there is only one Mandelbrot set for this simple function. As the sequence of iteration starting at ∞ only consists of this point, the usual Mandelbrot set will therefore consist of the complex numbers c such that the sequence of iteration starting in 0 does not grow towards ∞. The domain outside the Mandelbrot set thus consists of the complex numbers c such that the iteration z → z2 + c starting in z = 0 grows towards ∞. The colouring is determined by the number of iterations needed to bring the sequence outside an extremely large circle with its centre in origo (in the program the radius is set to 10100). The iteration number is however replaced by a real number whose integral part is the iteration number, in order to obtain a continuous colouring. The "real iteration number" is calculated as follows: if the radius of the circle is N, and if z is the first point in the sequence outside the circle, and if this happens after n iterations, then the real iteration number is:

n - (log│z│/log N)/log 2.

The Mandelbrot set consists of an infinity of circular or cardioid shaped domains lying outside each other where some of them are touching, and the set is in itself not especially remarkable. It is when we make the boundary of the Mandelbrot set visible, that the set's astonishing shape stands out. The boundary consists of the points such that irrespective of how small a circle around the point we take, it will contain points from both the interior of the Mandelbrot set and from the exterior. But as this set is "infinitely thin" (and as the points we draw have some distance from one another), drawing the boundary requires a special technique, namely a formula for an estimation of the distance from a point outside the Mandelbrot set to the Mandelbrot set. If we had such a formula to express a value that converges towards the true distance when the point converges towards the Mandelbrot set, we could obtain a picture of the boundary by marking out the points whose distance is smaller than a given small number. There is in fact a relatively simple procedure for obtaining an estimation of the distance.

Let c be a point outside the Mandelbrot set. If the sequence of iteration generated by z → z2 + c, starting at z = 0, is denoted z0, z1, z2, ..., zk, ..., we have z0 = 0 and zk+1 = zk2 + c (for k = 0, 1, 2, ...). Now we - while calculating this sequence - calculate the sequence z'0, z'1, z'2, ..., z'k, ... (the "derivative" of zk with respect to c) given by z'k+1 = 2zkz'k + 1 and starting at z'0 = 0. Then the distance from c into the Mandelbrot set is approximately given by:

limk→∞│zk│log│zk│/│z'k│.

This number is calculated when the iteration stops, that is when │zk│ exceeds the large number N. In the program we colour a point black (the same colour as the Mandelbrot set itself) when the estimated distance is smaller than the width of the section divided by 4000 (when the window is 640 pixels).

The program must of course have a maximum number of iterations: when the number of iterations has reached this limit (and if it has been set high enough), the point c can be regarded as belonging to the Mandelbrot set. We must increase the maximum number of iterations while zooming. In the program, the maximum iteration number is set at 200 times the fourth root of the magnification.


The Julia sets

In the definition of the Mandelbrot set we are dealing with a family of iterations z → z2 + c, because we imagine that c varies. In reality we are dealing with a family of Julia sets, as the iteration z → z2 + c, where c is fixed, determines a Julia set. Now let us fix a c and see what can happen when the starting point z runs through the points of the plane. It appears that each sequence of iteration falls within one of these four classes:

      1 The sequence converges towards ∞ (which is a super-attracting fixed point).

      2 The sequence converges towards a finite cycle of (finite) points (an attracting cycle).

      3 The sequence goes into a finite cycle of (finite) polygon shaped or (infinite) annular shaped revolving movements (this sort of attraction is in reality not attracting, but neutral).

      4 In the above three cases we have that all the points within a sufficiently small neighbourhood of z behave in the same way. This means that the set of points that fulfill one of the conditions is an open domain. The complement to the union of these domains is closed and consists of the points z, for which the sequence of iteration generated by z fulfills one of these two conditions: A) it goes (at a certain stage) into a finite cycle, but (contrary to condition 3) z is isolated having this property; or B) the distance between the iterations of z1 and z2 is greater than the distance between z1 and z2 when these two points are sufficiently close to one another. Condition B implies that the sequence behaves in a chaotic manner - a phenomenon called determinated chaos.

The set of the points fulfilling condition 4 is always non-empty and non-enumerable, and it is "infinitely thin" (like the boundary of the Mandelbrot set). This set is called the Julia set associated to the point c. The Julia set is mapped onto itself by the mapping z → z2 + c, and it is this property that causes self-similarity. The set of points in the Julia set fulfilling condition A is infinite but "only" enumerable, therefore we can say that the iteration on the Julia set (which itself is non-enumerable) is always chaotic in its entirety. The Julia set can be a curve (for c = 0 it is the unit circle and for c = -2 it is the line segment between -2 and 2), but most frequently it is a fractal. A fractal is a set whose so-called Hausdorff-dimension (which is its "true" dimension, and which is not necessarily a whole number) is greater than its topological dimension (which is the immediate dimension of the set, and which is a whole number).

The set of points z fulfilling condition 1 is always non-empty (in the case of our function z2). There are now two possibilities for c: there are no points z fulfilling conditions 2 or 3, or there are such points. In the latter case, the set of these points z will fulfill either condition 2 or condition 3, and all their sequences of iteration will terminate in the same set of points. This terminal set is consequently either a finite (attracting) cycle of (finite) points or a finite (neutral) cycle of polygons or annular shaped curves.

The open domains in which the domain outside the Julia set can be divided naturally, as their sequences of iteration behave in exactly the same way, are called the Fatou domains associated to the point c. For a given point c there are (in our simple case) either one or two Fatou domains, and the idea of the Mandelbrot set is precisely to illustrate this fact graphically. For c outside the Mandelbrot set there is only one Fatou domain, namely that containing ∞, and for c belonging to the interior of the Mandelbrot set (that is, the interior of one of the circles or cardioids), there is a Fatou domain more, and this is of finite extent. A Fatou domain will always contain a critical point. As the critical points in our case are 0 and ∞, the finite Fatou domain - if it exists - will contain 0. If it does not exist, then 0 will either belong to the Fatou domain containing ∞, which implies that the sequence of iteration generated by 0 converges towards ∞, or 0 will belong to the Julia set, in which case we can regard the inner Fatou domain as degenerated.

When c belongs to the Mandelbrot set, the Julia set is connected, and when c lies outside the Mandelbrot set, the Julia set is not connected, and it is even totally disconnected (= a "dust cloud"). This fact is (in the case of the function z2) also used as a definition of the Mandelbrot set.

If c lies in the Mandelbrot set or on its boundary, there are three possibilities:

A) c lies in the interior of the Mandelbrot set, that is, in the interior of one of the mentioned circular or cardioid shaped domains. In this case, the inner Fatou domain consists of points z satisfying condition 2, and the terminal set is thus an attracting cycle (and super-attracting for the centre of the circle or the cardioid).

B) c lies on the boundary of one of the circles or cardioids. In this case, the inner Fatou domain consists of points z satisfying condition 3, and whether the mentioned (neutral) terminal set is finite (consisting of polygons) or infinite (consisting of rings), is determined by whether c is a point of contact or not for two circles or cardioids (that is, whether the angle of the point - modulo 2&pi - is rational or not).

C) c lies outside the circles and cardioids, but is a point of accumulation for the union of these sets (that is, has points of a circle or a cardioid infinitely close to it). The Julia set is then still connected, but it does not divide the plane into two parts: the inner Fatou domain is empty - this is for instance the case for the end point of the mean antenna (the point (-2, 0)) for which the Julia set is the line segment from -2 to 2.


The program

The written program Mandelbrot is written in assembly language and assembled with flat assembler (the version for Windows programming). The folder with the program must contain the document flat_macros, containing some general macros and headers.

The fractal site


Updated: July 2010