Mandelbrot Set Animation

The Mandelbrot set isn't that tricky to understand if you are familiar with complex numbers (numbers with the "i") and if you have done some recursive functions.

The Fibonacci sequence is recursive, it's F[n] = F[n-1] + F[n-2]. So, the Fibonacci sequence is always the sum of the previous two values, because (n-1) is one less than n and (n-2) is two less than n. You also have to have a place to start, so we also say that F[1] = 1 and F[2] = 1. The sequence starts as:

1, 1, 2, 3, 5, 8, ...

The next number would be 13, the sum of the previous two values.

The Mandelbrot set is defined a little differently. It is

M[0] = c
M[n] = M[n-1]^2 + c

The initial value is c, and you can make that any number you want. To find the next value, square the last value then add the value of c. This doesn't look very exciting, and initially it isn't. But, if you let c be a complex number, with i=sqrt(-1), then it gets incredibly complex and makes fantastic graphs.

The following is an animation of the Mandelbrot set, and the first few values of M[n] are shown. When you graph a complex number, like (1+2i), you put it at the point (1,2), where x represnets the real part of the complex number and the y is the complex (or imiginary) part.

Let's look at one example. Take the number (2+3i). To find the next number, we have to square it and add it to itself. To do this, we FOIL and combine like terms.

(2 + 3i)^2 + (2 + 3i)
(4 + 6i + 6i + 9(-1)) + (2 + 3i)
(-5 + 12i) + (2 + 3i)
-3 + 15i

On the animation below, this would make a line segment between (2,3) and (-3,15). I have Geogebra do this process about 15 times.

You may see that if I were to repeat this again 100 times by squaring the result and adding it to the original, the numbers would get very large very quickly. When it gets larger and larger as you repeat the process, we say that it diverges. That's why most of the numbers that are in the mandelbrot set are very small, with the real and complex parts less than 1.

So, I have Gegebra figure out the first few values of M[n]. That's what the lines are coming out of the point. For every line segment that turns white as it gets too big, the point lightens a little bit. The pattern of light and dark points is the Mandelbrot set.

Animate by clicking on play the the lower corner and enjoy. It won't be completely drawn until t=1000, so be patient!