You are here: Home → Mathematics → Fractals → The Mandelbrot Set
The Mandelbrot set is possibly the most famous fractal of them all. (Alongside the Lorenz attractor, the Sierpinski triangle, the Koch snowflake curve, and Barnsley's IFS fern.) Numerous pages across the Internet attempt to describe this fractal. Many of them are aimed either highly technical, or are aimed at beginners but leave out huge amounts of interesting details. I will attempt to write something that beginners can understand, but without leaving too much out.
I have a page elsewhere about complex numbers, but for the purposes of this document, a brief summary will suffice.
A complex number (“complex” as in “shopping complex”, not as in “complicated”) as basically a two-dimensional coordinate in space. In other words, and X-coordinate and a Y-coordinate. The X-coordinate is sometimes called the real part of the number, and the Y-coordinate the imaginary part. Pay no attention to the names; they are for historical reasons.
A complex number may have two parts to it, but it is still one number. You can add, subtract, multiply, divide, and do all sorts of other things to complex numbers. In fact, you can do things to complex numbers which are impossible with other kinds of number. (This is in fact the whole point of complex numbers!)
Our journey begins with the quadratic Julia sets. Let us begin with a simple experiment. What happens if you take a number are repeatedly square it?
To “square” a number simply means to multiply it by itself. So, supposing we start with the number 7. So z0 = 7. Then we have z1 = z02 = 7 squared = 7 times 7 = 49. Next we do 49 squared = 49 times 49 = 2,401. And so on.
As you can see, the numbers get large pretty quickly. Let's start again, with a smaller starting figure:
Now it takes a bit longer to get going, but even so after 5 calculation loops we have a number that's well over four million.
So far, nothing very interesting is happening. I mean, if you keep multiplying a number by itself, of course it will get bigger and bigger!
What happens if we start with a negative number?
Exactly the same thing — because when you multiply two negative numbers together, the result is always a positive number!
Something a bit more interesting does happen if you pick 1 though:
Quite obviously, 1 times 1 = 1, and so the sequence never really does much. Similarly, since 0 times 0 = 0, the same thing happens with that.
Now watch what happens with, say, 0.5:
Instead of the numbers constantly getting bigger, now they keep getting smaller. And think about it — 0.5 is basically “half”. Half times half = half of a half = a quarter. If you keep multiplying something by a fractional quantity, you'll get smaller and smaller fractions as the answer.
OK, so what do we know? We know that if you feed a number into a computer and ask it to keep on multiplying that number by itself (“squaring it”), the number either endlessly grows bigger, endlessly grows smaller, or doesn't change at all. And we've worked out the rules which decide which thing it does:
The sequence of numbers generated from a particular start value is called the orbit of that value. In our case, the orbit is calculated by just squaring each number to generate the next one, but more complicated arrangements are possible.
So far, none of this is especially interesting. What we've worked out is that all the numbers between −1 and +1 move towards 0, and all the other numbers move towards infinity. How do we get from pages of numbers to pictures?
First, we use complex numbers. Now instead of a line going from low numbers to high numbers, we have a two dimensional grid, and every point on that grid is a complex number. And what we can do is for every such complex number, we calculate the orbit of that number.
Now, if we could just assign a colour to each point by examining some property of the orbit it produces. One way to do this is to colour it red if the orbit grows, and green if the orbit shrinks. Further, you can colour it a brighter shade depending on “how quickly” it grows or shrinks. And when you do all that, you get… something fairly uninteresting.
What you actually find is that all the complex numbers exactly 1 unit away from 0 stay exactly 1 unit away from zero. In other words, you have a circle of points who's orbits don't grow or shrink. (The orbits do dance around on that circle though.) All the points inside the circle have orbits that flow inwards towards 0 (either in straight lines or spiralling as they go). And all the points outside the circle just spiral outwards instead of inwards.
TODO: Add image.
So the end result of all our work so far is... a green circle on a red background. Great.
In the case above, all the orbits either flow towards zero or towards infinity. Zero and infinity are called attractors. (Because they “attract” orbits towards them.) The set of all points who's orbits end up at a particular attractor form the basin of attraction for that attractor. In the case above, the basin of attraction to zero is a filled-in circle with a radius of 1, and the basin of attraction to infinity is everything else.
Now, in our case, there are only two different attractors. However, it's possible to set up a system with much more than that. Also, in our case the basins of attraction have very simple shapes; again, this need not be the case.
Now look at the edge of the two basins — the place where they meet. All points actually on that circle stay stuck on it (although they dance around on it). All points inside that circle — even if they're inside by the tiniest little bit — eventually fall in towards zero.
If you like, the “pull” of the two attractors is exactly equal on the circle, so the orbits “can't decide” which way to go. But if a point is even slightly inside the circle, the pull of zero is very slightly stronger than the pull of infinity, and the orbit slowly moves inward. As it does, it gets closer to zero and further from infinity, and so the pull of zero gets stronger and the pull of infinity weaker, and it picks up speed.
The dividing line between the two basins of attraction — the actual circle itself — is called the Julia set of this system. People often use the word “Julia” or “Julia set” to mean the pretty picture drawn by using the method we've been looking at — calculate orbits, colour stuff. However, strictly speaking, the Julia set is the dividing line between the basins of attraction.
OK, let's change the rules now slightly. Instead of taking numbers and just squaring them, take each number, square it, and then add 0.2 to it.
It sounds like a simple thing, but it changes the game quite considerably. Let's take a look at a few orbits:
As before, numbers larger than 1 belong to the basin of attraction to infinity. But look at the small numbers. It seems zero is no longer an attractor. Indeed, if you start an orbit with any “small” value, they all seem to settle around the number 0.276393… But how small is “small”? Well, a quick test with a computer shows that 0.8 is attracted to infinity, but 0.7 is not. So the Julia set is somewhere between these two points.
(Why 0.276393…? Well, notice that it's one of the solutions to the equation z = z2 + 0.2. The other one is 0.723606…)
In fact, the shape of the Julia set has now become much more complicated:
TODO: Insert image here.
The formula we are using here is this:
zn+1 = zn2 + 0.2
But why 0.2? Why not any random number? Let us label this number as just “c”.
zn+1 = zn2 + c
In fact, c can be a complex number. And by choosing different complex numbers, we can get a wide variety of images. (!)
TODO: Add pictures.
The black areas are where the orbits all stay as small values. The brightly coloured parts are where the orbits spiral off to infinity; the colours indicate “how fast” they do this.
We we have seen above, changing c produces different Julia sets. In fact, it's very hard to predict which values will produce something interesting, and which ones will produce a blank screen. To see why, we need to look at the problem from another angle.
The Mandelbrot set is the set of all complex numbers which give “connected” Julia sets.
Generated by Indoculate Release #2b (17-Feb-2007) [Compiled by GHC 6.6]. Document generated on 2007-03-23 20:40:31.