Home > Articles > Programming > Visual Studio

Fun with Fractals in Visual Studio .NET

  • Print
  • + Share This
If you're old enough to remember the 1970s, the current popular fascination with fractals probably flashes you back to those halcyon days of big hair and wild imagery. Whatever your age, you'll enjoy Peter Aitken's explanation of how fractals work. You can even plug in his Visual Studio demo program and make some fractals of your own.
Like this article? We recommend

You may have heard of fractal images, and you’ve likely seen them more than once because they’re frequently used to adorn calendars, T-shirts, and the like. But did you know that you can generate fractal images on your computer? This article shows you how to create what is perhaps the most famous fractal—the Mandelbrot set—using Visual Studio .NET. First, however, a little necessary background material.

Complex Numbers

The name complex numbers is sort of misleading. Complex numbers are not called that because they’re complicated, but rather because they have two parts. Any complex number is represented as follows:

a + bi

The components a and b are "regular" numbers such as 2, −1.09, or 306. These are called real numbers. The "i" component is what makes things interesting—it stands for the square root of −1. You probably remember from your high school math class that negative numbers can’t have square roots, but mathematicians have found out that you can do all sorts of interesting calculations, including fractals, if we pretend that they can. Such numbers are called imaginary numbers. So a complex number has a "real" part and an "imaginary" part.

When working with complex numbers, the complex plane is often used. This is very much like the graphs you did in high school math, where the x value was plotted on the horizontal axis and the y value on the vertical axis. In the complex plane, however, the real part of a complex number is plotted on the horizontal axis and the imaginary part on the vertical axis. Figure 1 shows the complex plane with a few points plotted on it.

Figure 1

Figure 1 The complex plane.

  • + Share This
  • 🔖 Save To Your Account