Published:
14K Views

# Perturbation for the Mandelbrot set

Perturbation for rendering the Mandelbrot set has been around for a while. I would have written a journal before because it's very awesome, but right from the start there was a fundamental problem: reliability. A recent discovery by Pauldelbrot on fractalforums.com indicates that perturbation can now be used to render the Mandelbrot set reliably. Is the project approaching completion? "Correctness" now appears to be achieved.

## Discovery

Roughly a year ago, Kevin Martin published a relatively short document about the Mandelbrot set, containing some equations that staggered everyone. His idea was to apply the principle of perturbation to rendering the Mandelbrot set, and combining that with something he called series approximation. Perturbation allows the iteration count of a pixel to be derived from a different, fully calculated pixel "nearby" (to be called a reference pixel). In practice this means that it's possible to calculate just one single pixel in an image, and derive the rest using perturbation. At great depths with millions of iterations, this saves an enormous amount of render time, which is the main result.

Series approximation allows large number of iterations of pixels to be skipped entirely, good for another enormous speed-up, but it doesn't stop there. In addition, no arbitrary precision calculations are required to do the "deriving" work. Floating point calculations, which are much faster to perform, are sufficient. Martin concludes his document with the following statement:
Using [the equations] means that the time taken rendering Mandelbrot images is largely independent of depth and iteration count, and mainly depends on the complexity of the image being created.
The implications of this are enormous and such a theory is of course yelling to be implemented. Along with the mathematics, Martin also published a simple software implementation of the theory dubbed SuperFractalThing, so that everyone could see that it works. Since then, more software developers have started working on their own implementations.

The simple equation of the Mandelbrot set has long been famous of being so computationally intensive that it can bring any supercomputer to it's knees, as long as you zoom in deep enough. Although that is still the case even with perturbation, the barrier has been shifted significantly. To get an idea of the speed-up we're talking about, consider the following deviation:

Fractal extreme has been the fastest software to calculate the Mandelbrot set for a long time, using traditional optimizations. If the deviation above were to be rendered in Fractal extreme, the render would take roughly 6 months. The actual image was rendered in 6 hours using an implementation of perturbation by Botond Kosa. What you're looking at right there is something that, without perturbation, would have been totally out of reach for many years, no matter how optimized the software is. As Bruce Dawson, the man behind Fractal extreme, commented on fractalforums.com: good algorithms beat optimized code.

## Glitches

Although there is no doubt that perturbation is a "good algorithm", it came with severe problems right from the start, that Kevin Martin couldn't solve himself. If you have been paying attention, you may have noticed the requirement of a reference pixel to be "nearby". More specifically, usage of floating point numbers to do the calculations requires some numbers in the perturbation equation to be "small". Mathematically, this is completely useless, because there's no exact definition of what "small" is. Indeed, the results of the calculations were shown to be unreliable in many cases. It turned out that the results were correct "most of the time", but sometimes not. Incorrect parts of renders have since been called glitches.

An example of such a glitch can be seen in the image below.

Look closely at the largest spirals. The render on the left contains glitches; the render on the right is correct.

Several attempts have been done to get rid of these inaccuracies. There have been made workarounds where the computer was taught what glitches usually look like, so that they can be automatically recognized and solved. A way to do it is to calculate a second reference point inside the glitched area and do the perturbation calculations again. Having a new reference point more "nearby" solves the glitch. Karl Runmo made notable contributions to this automated glitch solving in his software implementation called Kalles Fraktaler.

As you may understand, it is very difficult to teach a computer to distinguish between correct and incorrect renders visually, especially because glitches can occur in such an enormous variety of types. Even fractal structures can sometimes appear as glitches, which is interesting on its own, but very, very difficult to auto-recognize. As such, manually solving glitches appeared to be a necessity: a very time-consuming process.

It might seem reasonable to spend some time to solve the glitches. Considering how many months of render time (and hundreds of euros worth of electricity) can be saved, spending a day solving glitches doesn't seem so bad. This idea slowly started to change as more difficult types of glitches were found where the "extra-reference-trick" didn't even work. Where does it stop? How many more types of glitches are there and can there ever be made workarounds for all of them? What was needed was more insight in where the inaccuracies come from, so that they can be avoided instead of worked around.

## Correctness: now achieved?

Recently, Pauldelbrot on fractalforums.com published an algorithm to find reliably which pixels of a render are correct and which aren't. This information can then be used to reliably solve the glitches as well. This was somewhat unexpected, because the algorithm doesn't help in preventing glitches, instead, it helps to detect them afterwards. This is somewhat similar to the approach of Karl Runmo, except Pauldelbrot detects glitches in a non-visual way. The algorithm has shown to be reliable. It automatically solves all the hard-to-detect glitches and no counterexample that slips trough has been found so far. That is great news!

This doesn't mean the project is really finished. There may still be a better way to get rid of glitches still to be discovered and many of the programs that currently use perturbation are still under development. It may even be possible to extend the method of perturbation to be used with different fractals. A good first candidate would be the Mandelbrot set with a power of 3 (instead of 2), but applications in 3d fractal rendering cannot be excluded in the future. The search continues. Mathematics never ends.

## Applications in art

I haven't been sitting idle as the developments went on. As such I can now present to you a new video. I once remarked on YouTube that I could do so many more interesting things if just my computer was 1000 times faster. Here you have it. This is one of the things I was thinking of at the time.

More is coming "soon".
© 2014 - 2022 DinkydauSet