Think of a number. Now multiply it with itself. Now add the number you first thought of. Multiply the result with itself. Again add the number you first thought of. Keep repeating that process. If the number you have keeps getting larger and larger, the number you first thought of is *not* part of the Mandelbrot Set. (For example, starting with 0.5 you get 0.75 -> 1.0625 -> 1.628 -> 3.153 ... and so on off to infinity, so 0.5 is not part of the Mandelbrot Set.)

You can also let the number you think of be a complex number of the form (a, b), where "a" is called the "real part" and b is called the "imaginary part". The only difference is that (a, b) multiplied by itself is (a^{2}-b^{2}, 2ab), so the next step in the sequence is (a^{2}-b^{2}+a, 2ab+b), but otherwise the game is much the same. (This Jonathan Coulton song explains the rules in lyrical form.)

The trick is that you can use (a, b) as the X and Y coordinates on a 2-dimensional chart. Color the chart black if (a, b) is in the Mandelbrot Set, and otherwise color it according to the number of steps it takes to get the complex number at those coordinates to get above size 2 (5 steps in our example for 0.5 above). Then, you get the beautiful and familiar representation of the Mandelbrot Set. (You can easily write a program to do this in the R language, since it support complex arithmetic natively.)

One of the amazing things about the Mandelbrot set is that it's infinitely complex: as far as you zoom into its crenellated edges, it never smooths out. This video enlarges the Mandelbrot Set as much as expanding a proton to the size of the Universe -- and then billions and billions of times more.

That's all for this week. See you back here on Monday!

## Comments

You can follow this conversation by subscribing to the comment feed for this post.