The Mandelbrot

Classic Mandelbrot set fractal.

z(0) = c = pixel;

z(n+1) = z(n)^2 + c.

Two parameters: real & imaginary perturbations of z(0)

This set is the classic: the only one implemented in many plotting programs, and the source of most of the printed fractal images published in recent years. It is simply a graph: the x (horizontal) and y (vertical) coordinate axes represent ranges of two independent quantities, with various colors used to symbolize levels of a third quantity which depends on the first two. So far, so good: basic analytic geometry.

Now things get a bit hairier. The x axis is ordinary, vanilla real numbers. The y axis is an imaginary number, i.e. a real number times i, where i is the square root of -1. Every point on the plane -- in this case, your PC's display screen -- represents a complex number of the form: x-coordinate + i * y-coordinate

If your math training stopped before you got to imaginary and complex numbers, this is not the place to catch up. Suffice it to say that they are just as "real" as the numbers you count fingers with (they're used every day by electrical engineers) and they can undergo the same kinds of algebraic operations.

OK, now pick any complex number -- any point on the complex plane -- and call it C, a constant. Pick another, this time one which can vary, and call it Z. Starting with Z=0 (i.e., at the origin, where the real and imaginary axes cross), calculate the value of the expression Z^2 + C

Take the result, make it the new value of the variable Z, and calculate again. Take that result, make it Z, and do it again, and so on: in mathematical terms, iterate the function Z(n+1) = Z(n)^2 + C. For certain values of C, the result "levels off" after a while. For all others, it grows without limit. The Mandelbrot set you see at the start -- the solid-colored lake (blue by default), the blue circles sprouting from it, and indeed every point of that color -- is the set of all points C for which the value of Z is less than 2 after 150 iterations. All the surrounding "contours" of other colors represent points for which Z exceeds 2 after 149 iterations (the contour closest to the M-set itself), 148 iterations, (the next one out), and so on.


What is the difference between Julia sets and Mandelbrot set?

Julia sets are strictly connected with Mandelbrot set. The iterative function used to produce both Mandelbrot and Julia sets is: Z2 + C.
What is different is the way this formula is used. Each point of the complex plane is associated with a Julia set, so you can think to the Mandelbrot set as an "index" for Julia sets: each point of the Mandelbrot set is associated with a particular Julia set.


How can I build a Julia set?

The process to build a Julia set is the same used for the Mandelbrot set. The only difference is that for the Julia set C is fixed, while Z varies.

Pick a point on the complex plane (let's call it C). The corresponding complex number has the form: x_coordinate + i*y_coordinate. The following algorithm will produce the Julia set associated with C.
To see if a point (Z) of the complex plane belongs to the Julia set associated with C, you must iterate the function Z2+C using Z as the initial value. What happens to the initial point Z when the formula is iterated? Will it remain near to the origin or will it go away from it, increasing its distance from the origin without limit? In the first case, it belongs to the Julia set; otherwise it goes to infinity (infinity is an attractor for the point) and we assign a colour to Z depending on the speed the point "escapes" from the origin. To produce an image of the whole Julia set associated with C, repeat the process above for the points of the complex plane whose coordinates are included in this range: -2 < x_coordinate < 2 ; -1.5 < y_coordinate < 1.5 . Whilst the Mandelbrot set is connected (i.e. it is a single piece), a Julia set is connected only if it is associated with a point in the Mandelbrot set.

Example: the Julia set associated with C1 is connected; the Julia set associated with C2 is not connected (see image below).

Example of connected and not connected Julia sets


Where is the trick this time?

The method used to produce images representing the Julia sets is the same used for the Mandelbrot set. If the distance of the point from the origin becomes bigger than two, we are sure that it will grow without limit. So, if this distance reaches the value of two, we can stop the iteration process because we know that the point will go to infinity, and we can colour the point according to the number of iterations already done (a great number of iterations means that the point is going to infinity slowly). If the point belongs to the Julia set, its distance from the origin will never become greater than two, no matter how many iterations we do. Even if the point does not belong to the Julia set, it could take a really huge number of iterations to reveal that it is attracted by infinity. In either case, we set a maximum number of iterations, after which we assume it is part of the Julia set (colouring it black). The more iterations we use, the more detailed our image will be, but the longer it will take to generate.