Mandelbrot Orbits

In this article I’ll dive into the Mandelbrot formula itself, and take a look at how the formula behaves at different points within the fractal.

What are the orbits?

As I mentioned in an earlier article, the Mandelbrot fractal is based around a single simple formula, which is often represented using complex numbers. I won’t bore you with complex number theory, because it’s irrelevant to the fractal. For now just think about each iteration of the formula as a function which acts on a 2 dimensional point in space.

For each iteration of the Mandelbrot formula a simple formula is used which takes the x,y position on the fractal as an input, and is iterated multiple times.

The pseudocode for the mandelbrot is

newx = x*x – y*y + cx;
newy = 2*x*y + cy;

Now we carry on doing this series of calculations and see what happens to the x and y coordinates. Specifically we’re watching to see whether or not this formula exceeds the circle of radius 2. If it does, then the x and y coordinates will rapidly accelerate away from the centre with each following iteration, the formula is unstable with the cx and cy values that we entered. If the iteration continues to stay within that circle, then we assume the formula is stable.

To colour the fractal we then colour the stable points a fixed colour (normally black). And for all points with an unstable formula, we colour the point based on how many iterations of the formula it took before it exceeded the radius 2 circle.

Simple orbits

We can look at this visually to observe how the x and y coordinates behave on each iteration. First up lets take a look at a stable point inside the main cardioid of the Mandelbrot.

Orbits within the main cardioid

As you can see, not much going on… The box on the top left shows each iteration point up to a total of 32 iterations. The first black dot in the middle is 0,0. This goes immediately left to about -0.3, 0.05, and then rapidly hones into a stable coordinate in the white dot.

If I move the cursor close to the edge with the main cardioid something interesting starts to happen.

Orbits to the left of the main cardioid

This time around the iteration points rapidly move out to the coordinates at the edge of the main cardioid, but instead of settling down to a single point, they start oscillating around in a circle. This formula may still remain stable under large numbers of iterations, but it may also start to escape the boundary. We don’t know until we continue to iterate the formula.

Now for something really strange I’ll move the cursor into the main bulb of the fractal (the large circle to the left of the main cardioid).

The main bulb to the left of the cardioid

This time around the formula rapidly becomes stable once again, but now it has two stable locations which it continues to oscillate between.

And if we move into the bulb to the left of this one…

More complex stable orbits

…we suddenly have 4 stable locations within the formula.

I’d strongly advise you to try this yourself by following this link to try it in realtime on your browser.

More complex orbits

The next thing to mention is that the really interesting orbits within the formula happen close to the edges of stability. If we move the cursor within a sidebulb, and close to the edge, the orbits can start to make very elaborate patterns.

More complex orbits around the edges of stability

But what remains really difficult to predict, is whether or not a sequence of positions will remain stable within the radius of 2, or whether it will become unstable. And the only real way to find out is to carry on iterating that formula, and the more you iterate, the more likely you are to find that an orbit is unstable in the longer term.

For example, here’s a fractal with an iteration count of 256.

256 iterations in the deeper edges of stability

All of the points in black here have an orbit which is stable up to 256 iterations. Now lets change the fractal to use 512 iterations and see what happens.

512 iterations at the same point in the fractal

The colour palette has changed a bit, but if you look at the black areas of the fractal you can see that there is now a much more clearly defined circular boundary to the dark areas, and previously black pixels now have a colour. Any pixels that are now coloured represent a Mandelbrot orbit which became unstable between 256 and 512 iterations.

You can continue upping the iteration count which will continue to uncover more points on the fractal with unstable iterations, but there are some points within this fractal that will never become unstable. That’s the fundamental beauty of the Mandelbrot fractal.

Leave a Reply

Your email address will not be published. Required fields are marked *