Thursday, December 17, 2009

Mandelbrot Set

“There are more things in heaven and earth, Horatio, than are dreamt of in your philosophy.”- Hamlet

I’ve been a math geek most of my life; for example reading math books for fun in High School. During my college years, the Mandelbrot set was hot (see picture at right). Beautiful images of the set combined Art, Math, and Computer Science. Michigan State held talks on fractals and opened a gallery of images in the Computer department. I attended a Fractal Conference in Providence, Rhode Island. I tweaked computer programs trying to get images to display faster on my Macintosh.

What are fractals? Take a look at the Dow Jones average graph in a newspaper or online. It is a jagged line regardless of the time scacle. The average over decades – jagged; over years – jagged; over days - jagged; over hours – jagged. Time does not smooth it out and it is impossible to guess the time scale by looking at the graphed line. We call this behavior – fractal. Another example is coast lines. The edge of any continent has inlets and protrusions. If you zoom in on the coast you’ll find the pattern repeats with large bays, small bays, local beaches, etc.

Fractals are quite common in nature. In the early days of computer animation, it was easy to create a nature scene – to make a mountain start with a pyramid. Add medium size pyramids at random points, then add smaller pyramids on top of those and so on. After serveral iterations of this the result is quite realistic looking. Trees and rivers and clouds are also fractal. People are NOT fractal – it is very difficult to model humans and get the skin tones right. The movie Toy Story worked so well because the toys did not have to look “alive”.

So what is the Mandelbrot set and why is it such a big deal? After Newton published his laws on Gravity, scientists viewed the Universe as a giant mechanism that could be completely predicted given enough accurate measurements. This view was challenged in the early 20th century. Heisenberg’s Uncertainly Principle said that some measurements are mutually incompatible like speed and position. You can know one accurately but not both. Many scientists refused to accept this and continued to work on creating perfect mathematical models to predict the stock market and weather conditions.

As computers increased in power, researchers noticed two things:

1. There is a lot of positive feedback in the models. A small breeze can start a major storm with the right conditions. This became known as the Butterfly effect. A butterfly flaps its wings and changes the weather across the world.

2. Because of positive feedback, a small measuring error can grow into serious wrong results over time. This is called Sensitivity to Initial Conditions.

Benoît Mandelbrot decided to step away from the complex stock market models he was studying and examine a simple postive feedback loop. His formula was F(n+1) = F(n) ^2 + c which means the new function value F(n+1) is equal to the previous value F(n) squared plus a fixed constant. The first value F(0) is always zero.

Let’s look at some different values for c:
C=0. F(1) = 0^2 + 0 = 0 = F(0) so the values stay at zero forever.
C=1. F(1) = 0^2 + 1 = 1, F(2) = 1^2 + 1 = 2, F(3) = 2^2 + 1 = 5. This sequence grows to infinity.
C= -1. F(1) = 0^2 + -1 = -1, F(2) = (-1)^2 + -1 = 0 = F(0). This series jumps forever between 0 and -1.

Not very exciting so far. What Mandelbrot did next is move the function to two dimensions by using imaginary numbers on the x and y axis of a graph. Each point on the graph represents a value of c = x + i*y. Imaginary numbers are multplied like this (a +bi)^2 = (a^2 – b^2 +2abi). A point c is “in” the Mandelbrot set if the F(n) series does not go to infinity like (1+0i) does. When creating an image of the set on a computer, we can not wait for F(n) to grow to infinity so we pick a cut off point and say if F(n) gets this big then it will go all the way so we can stop computing. A good cutoff point is [a+bi] = sqrt(a^2+b^2) > 1. That means the size of the imaginary number result is greater than one. We also pick a cutoff point for n. Let’s say if F(n) is smaller than one after n=1000 calculations then we assume the number series will stay small forever and c is in our set.

Now we do something clever and artistic. We apply different colors to how fast the sequence built on c grows bigger than one. For example:

F(n) <= 1 after n=1000, color the point c black and consider it in the set F(n) >1 before n=100, color it dark blue
F(n) >1 before n=500, color it lighter blue
F(n) >1 before n=1000, color it white

Wow! A lot of background to describe the picture at the top. Now I’ll explain why this matters. Take a close look at the white fringe on the set. It represents numbers that almost made it in but grew too big just before our cutoff at n=1000. When the border fringe is magnified a thousand times or a billion times, it stays just as lacy or becomes an even more complicated fringe. The border of this set is a fractal that never becomes smooth. The smallest imaginable difference (in say the trillionth decimal place) can change if the series built on C will go to infinity or stay small.

In practicable terms, this means we can never hope for 100% accuracy in our weather and stock models. There will always be “fringe” events where errors smaller than our ability to measure will have huge impact on the results.

Bottom Line

Why bring this up now? One key idea that made the Mandelbrot set possible was placing the constant c in two dimensions as x + yi. For 20 years, scientists have been trying to find a way to extend the set to three dimensions but nothing worked – until this year. Here is a picture of a 3D fractal set. Details can be found at The Mandelbulb: first 'true' 3D image of famous fractal.

Labels: , ,

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home