Home > Articles > Programming > Windows Programming

  • Print
  • + Share This
Like this article? We recommend

Generating the Mandelbrot Set

When writing a program to create the Mandelbrot set, several practical questions come up.

  • What exactly does "go to infinity" mean? Fortunately, a program doesn’t need to deal with this question. It has been shown that once the modulus of the result exceeds 2, the calculation will always, if iterated more, continue on to infinity. Therefore, all the program needs to do is determine that the modulus of the iteration calculation result has exceeded 2 to declare that it’s not part of the set. You’ll see how this is done when you look at the demo program source code.
  • What part of the complex plane is important? You can’t compute for the entire plane, of course. We know that the Mandelbrot set is entirely contained between the real values −2.1 and 1 and between imaginary values −1.2 and 1.2, so that’s where to start to see the entire set. Zoom into a smaller region to see more detail. For example, Figure 4 was done with the real range −1.5 to −1.2 and the imaginary range −.1 to .1.
  • How many iterations are necessary? In theory, we can never be sure that, no matter how many iterations we’ve done, the result will not go to infinity after another 10, 50, or 100 calculations. In reality, you can use 50–150 iterations and get decent accuracy. More iterations slow things down, of course, but give more detail at the edges.
  • + Share This
  • 🔖 Save To Your Account