Visual C# 2005 (Windows) Guide
Fractals: The Mandelbrot Set
The term fractal was coined by the mathematician Benoit Mandelbrot. His name is given to the set of complex numbers that he used to produce the early computer representations of fractals.
The Mandelbrot set is based on the following formula,
z → z2 + c
Where z and c are complex numbers.
When plotting the Mandelbrot set, we start with a value of z as 0. We take a value for c and apply the formula. We take the result and use that as a value for z and reapply the formula. If we continue to do this we find that the result either stays quite small or quickly zooms off to infinity. We set a maximum number of times to do this, say 500. If the number remains small, we plot the number c using a black pixel. If the number zooms off to infinity, we plot it a shade of grey depending on how quickly it went to infinity.
The following image results from using this approach with values of c ranging from -2 - 2i to 2 + 2i.
The image itself is not particularly pretty at this stage although it is instantly recognisable as a zoomed-out view of the Mandelbrot set - you will know your program is working if you see this image. The interesting part is the boundary of the set. The images you saw in the gallery are all based on zooming in on the boundary. The way we colour the points that represent values of c that zoom off to infinity is the key to producing an interesting image.