What is the Mandelbrot set?
The Mandelbrot set is the domain of convergence of the series built up by the complex sequence defined by the recursion law: Zn = Zn-12 + C. In other words, with a simple algorithm it is possible to separate the points of the complex plane into two categories:

  • points inside the Mandelbrot set
  • points outside the Mandelbrot set
    The image below shows a portion of the complex plane. The points of the Mandelbrot set have been coloured black.

    It is also possible to assign a colour to the points outside the Mandelbrot set. Their colour depends on how many iterations have been required to determine that they are outside the Mandelbrot set, and it can be interpreted as their "distance" from the Mandelbrot set.


    How can I build the Mandelbrot set?
    Pick a point on the complex plane (let's call it C). The corresponding complex number has the form: x_coordinate + i*y_coordinate. Calculate the value of this expression: Z2 + C, using zero as the value of Z. The result is obviously C. Assign the result to Z and repeat the calculation: now the result is the complex number C2+C. Assign the value to Z and repeat the process again and again. In mathematical terms, this is the iteration of the function Zn = Zn-12 + C. I like to imagine this process as the "migration" of the initial point C across the plane. What happens to the point when we repeatedly iterate the function? 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, we say that C belongs to the Mandelbrot set (it is one of the black points in the image); otherwise, we say that it goes to infinity and we assign a colour to C depending on the speed the point "escapes" from the origin.

    Let's take a look to the algorithm from a different point of view. Let's imagine that all the points on the plane are attracted both by infinity and by the Mandelbrot set. This makes easy to understand why

  • points far from the Mandelbrot set rapidly move towards infinity
  • points close to the Mandelbrot set slowly escape to infinity
  • points inside the Mandelbrot set never escape to infinity


    What is the trick?
    As you can see, it is impossible to apply the process described above, because we can't iterate the function an infinite number of times to see whether or not the point goes to infinity. It's easy to prove that if the distance of the point from the origin becomes greater than two, it will grow without limit. As a result of this, if the distance of the point from the origin reaches the value of two we can stop the iteration process, because we know that the point will go to infinity, and we can assign a colour to it according to the number of iterations performed (a small number of iterations means that the point is rapidly going to infinity).
    On the other hand, if the point belongs to the Mandelbrot 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 Mandelbrot set, it could take a really huge number of iterations to reveal that it will escape to infinity. In either case, we set a maximum number of iterations, after which we assume it is part of the set (and we paint it black).
    The more iterations we use, the more detailed our image will be, but the longer it will take to generate.


    Examples:
    Let's see how to assign a colour to a particular point of the plane. Let's start with a point outside the Mandelbrot set: C = -0.5 + i (this means that the x_coordinate of C is -0.5 and the y_coordinate of C is 1).
    Iterating the function Zn = Zn-12 + C will produce the following values: (the image shows the corresponding points on the complex plane).

    Step #Current_ValueDistance from
    the origin
    1 -0.5 + i 1.12
    2 -1.25 1.25
    3 1.06 + i 1.46
    4 -0.37 + i * 3.1 3.15
    Click here to see this process in action
    (a Java1.1.5 enabled browser is required)

    At the third iteration, the distance of the point from the origin becomes greater than two. This means that the initial point C does not belong to the Mandelbrot set. As it took 3 iterations to determine this, we paint C with the colour labelled #3 in our palette. All the points with the same colour require the same number of iterations to reveal that they are attracted by infinity.

    Let's repeat the same process with a point inside the Mandelbrot set: C = 0.2 + i * 0.5. In this case, the distance of the point from the origin never becomes greater than two. When we reach the maximum number of iterations (for example, 200), we assume that the initial point C belongs to the Mandelbrot set and we paint it black.

    Step #Current_ValueDistance from
    the origin
    1 0.2 + i * 0.5 0.54
    2 -0.01 + i * 0.7 0.7
    3 -0.29 + i * 0.490.57
    4 0.05 + i * 0.22 0.22
    5 0.15 + i * 0.52 0.54
    6 -0.05 + i * 0.660.66
    7 -0.23 + i * 0.440.48
    8 0.06 + i * 0.3 0.3
    . . . . . . . . . . . . . . . . . .
    Click here to see this process in action
    (a Java1.1.5 enabled browser is required)

    You can give me feedback about this page by filling out the feedback form.


    © 1996-2000 fabioc @ yahoo.com


    This page hosted by Get your own Free Home Page