Monday, 19 September 2011

Mandelbrot Set Part One

Before we move on, interestingly we have now covered all the groundwork required to understand what the Mandelbrot set is, and why it is. This you may have heard of. It is the colourful weird shape that appears on t shirts, mouse mats and so on. It looks like this:


So what is it, or more accurately how do you make one? First of all the picture is drawn on the complex plane around the \(0\) position. The picture above is from about \(-2\) on the left to about \(1\) on the right hand side.

We now know that every point on the complex plane is actually a number. Numbers can belong to sets. We have already encountered some sets before, although we did not call them by that name. For instance, all the positive integers (the counting numbers we use for tractors and apples and so on) are called the set of natural numbers. In that set of numbers you have sub sets of even and odd natural numbers. If you add on the negative integers to the natural numbers you get the set of whole numbers (sometimes also called the set of all integers). If you add in fractions you now have a set of all rational numbers. If you add in irrationals you now have all the numbers at we have looked at, in a set called the real numbers. Once we add in the imaginary axis, we end up with a set of all complex numbers.

When we drew the circle of convergence for the infinite sums we were looking at, we could have described every point within that circle as belonging to the set of numbers which caused the infinite sum to converge. The mandelbrot set is like that kind of set. It defines an area on the complex plane, within which a number is in the set, and out with which a number is not in the set. Looking at the picture above though, it is a pretty complex figure. It must be created by a pretty complex mechanism, mustn't it? Well.....

Membership of the set is defined by whether or not the result of a mathematical operation converges or diverges. That is, just like an infinite sum, does it go off to infinity or does it approach an actual number? The operation you do here is a bit different to an infinite sum, but just like the infinite sum, we could keep on doing the maths for ever and ever. So what is this massively complicated operation?

Every starting number is used as the first in a long (actually infinity long) series.
The next number in the series is calculated by squaring the last number and adding the starting number.
If the numbers in the series head off to infinity (get larger and larger) then the number IS NOT in the Mandelbrot set.
If the numbers in the series do not head off to infinity, but settle down, then the number IS in the Mandelbrot set.

That's it. That is literally all there is to it. Squaring and adding. Frankly it looks a lot simpler than the infinite sums nonsense, or taking a limit. Bizarrely though, this simple process of squaring, and adding the first number you thought of generates the very, very, complex pattern we see above.

It would be very boring, not to mention fatal, to try to calculate an infinitely long series, so when you are testing for membership, you usually just calculate a fixed number of terms. The more terms you calculate the finer the detail you can draw at the boundary, but the longer it takes to do the calculations. Once it is obvious that a series has left the building, so to speak, you note down the number of terms you have in the series at that point, and you convert that number of terms to a colour for that point on the complex plane. That's how you get the gradual colouring effects. All of the colours are OUT of the Mandelbrot set, but the colour of the point determines how close it was to getting in.

Lets consider an example so we know exactly where we are. To keep things simple, lets look at the real number line only, so we get rid of the imaginary element. This is very like the step BEFORE we saw the circle of convergence on the complex plane. At that point all we had was zones on the real number line coloured red and blue. Let's do that with the Mandelbrot set. Where are the blue regions on the real number line for the Mandelbrot set? Let's start with zero.

\[0,(0^2+0)\]
\[0,0,(0^2+0)\]

Well this is easy. Zero squared plus zero is still zero. Square it again? Still zero. Never going to get to be more than two no matter how many times we do this. So zero is IN the Mandelbrot set.

What about two?
\[2,(2^2+2)\]
\[2,6,(6^2+2)\]
\[2,6,38,(38^2+2)\]

Can you see that that is never going to settle down now? There is nothing in the function (square and add two) which is capable of putting the brakes on the series. It is off into the wild blue yonder. Two is NOT in the Mandelbrot set. So zero in, two out. Lets look on the other side of zero, and find out if negative two is in:

\[-2,(-2^2-2)\]
\[-2,2,(2^2-2)\]
\[-2,2,2,(2^2-2)\]

A, ha! Negative two squared is four. Four plus negative two is two. TWO squared is four, plus minus two is two. So negative two IS in the Mandelbrot set because its series settles down to an infinite series of two's. But it is on a knife edge isn't it? It only settles down to all these two's because the starting point is EXACTLY the opposite of the amount that the next number in the series increases by when the last one is squared. So the squaring operation is precisely balanced by the addition of the starting number. If we increased the starting number by, say, a tenth, to \(2.1\) look what happens:

\[-2.1,(-2.1^2-2)\]

(It's not obvious how to square \(-2.1\), but if we write it as \(\tfrac{-21}{10}\) and then multiply it by itself \(\tfrac{-21}{10}\cdot \tfrac{-21}{10}\) we get \(\tfrac{-21\cdot -21}{10\cdot 10}\) or \(\tfrac{441}{100}\) which is \(4.41\).)

\[-2.1,2.41,(2.41^2-2)\]
\[-2.1,2.41,3.8081,(3.8081^2-2)\]
\[-2.1,2.41,3.8081,12.50162561,(12.50162561^2-2)\]

It's off as well isn't it? The minus two that is applied is no longer big enough to hold back what happens when the previous term is squared. So precisely at negative two is a boundary of the set on the real number line. We can conclude something about the mandelbrot set already: it is not symmetrical about the zero point on the real axis. Negative two is in, while positive two is out. Let's try to find the boundary on the positive side of the real axis. Two is out, so let's try one:

\[1,(1^2+1)\]
\[1,2,(2^2+1)\]
\[1,2,5,(5^2+1)\]
\[1,2,5,26,(26^2+1)\]

It's gone, hasn't? The fact that you are squaring one to get one doesn't help because the one that you then add increases your number. Because the increase is above one, the next square operation increases it further. There is no suitable brake. The next number is always going to be much bigger than the previous one.

With negative numbers, what was important was having a starting number half the value of the resulting square to pull the square back. Every time you squared, when you applied the starting number it brought you back to the same place. You squared two up to four, and took off two, back to two. Two steps forwards and precisely two steps back. Is there a starting number that will work for us on the positive side, or is zero the boundary? Well, the number that you add cannot be the brake for the positive starting numbers, because it is always going to increase the next term in the series - it's positive! What we need to find then is a number which, when you square it, gets smaller. That will be a number between zero and one. Numbers between zero and one get smaller when they are squared because they are reduced be the same amount as they were less than one to begin with. It is easier to see with fractions less than one, because the number on the top of the fraction does not increase as much as the number on the bottom of the fraction, so the ratio between the two gets smaller. But our special number may not be a fraction. We could just test all the numbers between zero and one to find the special one, but that could take an infinitely long time. Let's find it by logic instead.

Lets work backwards, and not look for the starting number in the series. Let's look for the number the series is going to settle down to. Let's call that number \(a\). \(a\) has to be a number whose square is also half of itself. Why? Well we would square \(a\), reducing it by half, and then add back on the half we just removed. That would completely balance the squaring and addition process. We can write this out mathematically as:

\[a^2=\frac{a}{2}\]

That says \(a\) squared is the same as half of \(a\). From there we can rearrange the right hand side to look like this:

\[a^2=\tfrac{1}{2}\cdot a\]

We can then divide both sides by \(a\):

\[\frac{a^2}{a}=\frac{\tfrac{1}{2}\cdot a}{a}\]

That's the same as:

\[\frac{a\cdot a}{a}=\tfrac{1}{2}\cdot \tfrac{a}{a}\]

And:

\[a\cdot \tfrac{a}{a}=\tfrac{1}{2}\cdot \tfrac{a}{a}\]

We know that \(\tfrac{a}{a}\) is just one, so:

\[a\cdot 1=\tfrac{1}{2}\cdot 1\]

The ones cancel, and we are left with:

\[a=\tfrac{1}{2}\]

So we have our magic number. It is a half. This is what the series will settle down to. So what is the first number in our series? It is the square of a half, which is a quarter. (A quarter is half of a half). So the prediction is that from our series, if we plug in the first number as a quarter, the series should never go flying off to infinity. It will get closer and closer to the magic number of a half. This is because if it ever reached a half, it would bounce right back with the next step in the series. Let's see what the first ten terms in the series starting with a half are:

\[0.25,(0.25^2+0.25)\]
\[0.25,0.3125,(0.3125^2+0.25)\]
\[0.25,0.3125,0.3476\ldots,(0.3476\ldots^2+0.25)\]
\[0.25,0.3125,0.3476\ldots,0.3708\ldots,(0.3708\ldots^2+0.25)\]
\[0.25,0.3125,0.3476\ldots,0.3708\ldots,0.3875\ldots,(0.3875\ldots^2+0.25)\]
\[\begin{multline}
0.25,0.3125,0.3476\ldots,0.3708\ldots,0.3875\ldots,\\
0.4001\ldots,(0.4001\ldots^2+0.25)
\end{multline}\]
\[\begin{multline}
0.25,0.3125,0.3476\ldots,0.3708\ldots,0.3875\ldots,\\
0.4001\ldots,0.4101\ldots,(0.4101\ldots^2+0.25)
\end{multline}\]
\[\begin{multline}
0.25,0.3125,0.3476\ldots,0.3708\ldots,0.3875\ldots,\\
0.4001\ldots,0.4101\ldots,\\
0.4182\ldots,(0.4182\ldots^2+0.25)
\end{multline}\]
\[\begin{multline}
0.25,0.3125,0.3476\ldots,0.3708\ldots,0.3875\ldots,\\
0.4001\ldots,0.4101\ldots,0.4182\ldots,\\
0.4249\ldots,(0.4249\ldots^2+0.25)
\end{multline}\]
\[\begin{multline}
0.25,0.3125,0.3476\ldots,0.3708\ldots,0.3875\ldots,\\
0.4001\ldots,0.4101\ldots,0.4182\ldots,0.4249\ldots,\\
0.4305\ldots,(0.4305\ldots^2+0.25)
\end{multline}\]

In fact I can tell you, because I have done the sums, that the 100th term is \(0.490604220129385\ldots\) and the 1,000th is \(0.49900860913856\ldots\). So, it turns out we were right. Which ever way you look at it, one quarter is IN the Mandelbrot set, and the more times you run through the process the closer and closer to one half the result gets - just as we predicted. If we started with a number just a sliver higher than a quarter, this would not work. It would not be balanced by the addition of the quarter, so that when the long series, like the one above, got near a half, it would eventually pop over a half. Why? Well a half times a half plus a quarter and a little bit, is bigger than a half. So eventually the series of numbers is going to get to the point where the gap between the last number in the series squared and a quarter is LESS than the little bit your starting number is bigger than a quarter. Once that point is reached, the next term in the series must be bigger than a half. As soon as it is, the brake fails, and the series will eventually reach infinity.

So we can say, on the real number line, the limits of the mandelbrot set are negative two and one quarter. What about the limits on the complex plain? Well there it gets more complicated, and strangely more simple. Let's look at that next time.

No comments:

Post a Comment