- Complex Numbers
- The Mandelbrot Set
- Color and the Mandelbrot Set
- Generating the Mandelbrot Set
- The Demo Program
The Mandelbrot Set
Now that you understand how the complex plane works, we can start looking at how the Mandelbrot set is generated. The set is created on the complex plane, and any point on the plane is either in the set or not in the set. This is determined by a deceptively simple formula:
Z2 + C
In this formula, Z and C are both complex numbers. Here’s how it works. Take each point on the complex plane, one at a time, and plug it into the formula. In this example, Z0 is the complex number representing the point, and Z1 is the result:
Z1 = Z02 +Z0
Now repeat the calculation, this time using Z1 in the formula:
Z2 = Z12 +Z0
Note that the first part of the formula is always the previous result squared, whereas the second part is always the original complex number Z0. Thus, expressed generally we have this:
Zn+1 = Zn2 +Z0
As you iterate (repeat) this a number of times, one of two things will happen:
- The result will head off toward infinity.
- The result will remain finite.
If the result remains finite, the original point is part of the Mandelbrot set. If it heads off toward infinity, it’s not part of the set. Perform the calculations for each point on the complex plane, color points in the set black and points not in the set white, and you have a visual representation of the Mandelbrot set, as shown in Figure 2.
Figure 2 The Mandelbrot set.
One of the interesting things about this set is that it’s infinitely detailed. You can zoom in on the edges of the set as much as you want, and you’ll always find more details. It’s also completely connected—while some outlying points in the figure may look separate, that’s just because of the limitations of the graphics reproduction.