This page gives an explanation of how the Mandelbrot set fractal is generated on a computer.
Take axes on an Argand - Diagram so that the X axis is the real axis,
and the Y axis the imaginary axis. This means that a point has co-ordinates
x + iy where x and y are real, and i = sqrt(-1);
Now pick any point on this so called complex plane, and call it C,
where C = p + iq. C is a constant.
Now pick another point, Z, where Z = x + iy.
Starting with Z = 0, calculate the value of the expression:
Z2 + C
Take this result, and make it the new value of Z, then redo the calculation.
Take this answer, and call it Z, and redo the calculation again, and
so on.
i.e. Perform the function:
Z(n+1) = Zn2 + C
This is the Mandelbrot equation.
For some values of C, |Z| tends to infinity, and for other values of C, |Z| does not tend to infinity. That then determines how to colour the point. If |Z| tends to infinity, then the point C is coloured white, if |Z| does not tend to infinity then the point C is coloured black. This is illustrated below, and is the source of the now famous "squashed beetle" picture:

In fact, since computers cannot handle complex numbers immediately, what is actually done is this:
Z2 + C = (x + iy)2 + p + iq
= (x2 + 2ixy + i2y2) + p + iq
= x2 + 2ixy - y2 + p + iq (Since i2
= -1)
= [x2 - y2 + p] + i [2xy + q]
let xn = [x2 - y2 + p] and yn = [2xy
+ q]
and |Z| = xn2 + yn2
The equations in bold are what the computer actually iterates. Every iteration, the computer checks if |Z| > 4 (ie |Z| is tending to infinity), and whether or not the maximum number of iterations has exceeded a certain limit. If either of these are true, then the computer colours point C (or a point representing C ie (p,q) ). If the first is true (|Z| tending to infinity) then the point is coloured white. If the second is true (|Z| not tending to infinity after a certain number of iterations) then the point is coloured black. This process is repeated for every point on the screen (in the diagram above p from -2.5 to 1.5 in steps of 0.00625, and q from -1.5 to 1.5 in steps of 0.00625). p is represented by the X axis, and q by the Y axis. Note most fractal generation programs don't just use black and white. Instead of plotting a point outside the set white, it is coloured according to how many iterations it took for that point to 'bail out' (ie for |Z| to exceed 4) - if a point took 5 iterations, then colour that point with colour 5 etc.. With carefully chosen palettes, this can produce stunning visual images. Strictly speaking though, the Mandelbrot set is the black bit; the colours are just decoration. See the gallery page for more images.