Sunday, November 18, 2012

Introduction to the Mandelbrot Set


The Mandelbrot set, named after Benoit Mandelbrot, is a fractal. Fractals are objects that display self-similarity at various scales. Magnifying a fractal reveals small-scale details similar to the large-scale characteristics. Although the Mandelbrot set is self-similar at magnified scales, the small scale details are not identical to the whole. In fact, the Mandelbrot set is infinitely complex. Yet the process of generating it is based on an extremely simple equation involving complex numbers.


Understanding complex numbers

The Mandelbrot set is a mathematical set, a collection of numbers. These numbers are different than the real numbers that you use in everyday life. They are complex numbers. A complex number consists of a real number plus an imaginary number. The real number is an ordinary number, for example, -2. The imaginary number is a real number times a special number called i, for example, 3i. An example of a complex number would be -2 + 3i.
The number i was invented because no real number can be squared (multiplied by itself) and result in a negative number. This means that you can not take the square root of a negative number and get a real number. By definition, when you take the square root of a number, you find a number that can be squared to get that number. The number i is defined to be the square root of -1. This means that i squared is equal to -1. So when you square an imaginary number you can get a negative number. For example, 3i squared is -9.
Real numbers can be represented on a one dimensional line called the real number line. Negative numbers like -2 are plotted to the left of zero and positive numbers like 2 are plotted to the right of zero. Any real number can be graphed on the real number line.
Since complex numbers have two parts, a real one and an imaginary one, we need a second dimension to graph them. We simply add a vertical dimension to the real number line for the imaginary part. Since our graph is now two-dimensional, it is a plane, the complex number plane. We can graph any complex number on this plane. The colored dots on this graph represent the complex numbers [2 + 1i], [-1.5 + 0.5i], [2 - 2i], [-0.5 - 0.5i], [0 + 1i], and [2 + 0i].

Graphing the Mandelbrot set

The Mandelbrot set is a set of complex numbers, so we graph it on the complex number plane. However, first we have to find many numbers that are part of the set. To do this we need a test that will determine if a given number is inside the set or outside the set. The test is based on the equation Z = Z2 +  C.C represents a constant number, meaning that it does not change during the testing process. C is the number we are testing, the point on the complex plane that will be plotted when testing is complete. Z starts out as zero, but it changes as we repeatedly iterate this equation. With each iteration we create a new Z that is equal to the old Z squared plus the constant C. So the number Z keeps changing throughout the test.
We're not really interested in the actual value of Z as it changes, we just look at its magnitude. The magnitude of a number is its distance from zero. For example, the number -9 is a distance of 9 from zero, so it has a magnitude of 9. The magnitude of a complex number is harder to measure. To calculate it, we add the square of the number's distance from the x-axis (the horizontal real axis) to the square of the number's distance from the y-axis (the imaginary vertical axis) and take the square root of the result. In this illustration, a is the distance from the y-axis, b is the distance from the x-axis, and d is the magnitude, the distance from zero.
As we iterate our equation, Z changes and the magnitude of Z also changes. The magnitude of Z will do one of two things. It will either stay equal to or below 2 forever, or it will eventually surpass two. Once the magnitude of Z surpasses 2, it will increase forever. In the first case, where the magnitude of stays small, the number we are testing is part of the Mandelbrot set. If the magnitude of Z eventually surpasses 2, the number is not part of the Mandelbrot set.
As we test many complex numbers we can graph the ones that are part of the Mandelbrot set on the complex number plane. If we plot thousands of points, an image of the set will appear:

The Mandelbrot set is an incredible object. It's really amazing that the simple iterated equation Z = Z2 +  C can produce such beautiful works of mathematical art.

No comments:

Post a Comment