# Fractals/perturbation

Fast deep zoom

# Perturbation method edit

"The thing we call perturbation^{[1]} consist of 2 things:
Calculate one pixel with high precision and use it as a reference for all other pixels.

This method will fail though, however thanks to Pauldelbrot we have a trustable method of detecting the pixels where the reference fails to compute the pixel with hardware precision. These pixels can be rendered with a reference closer to these pixels, so a typical perturbation render use several references.
This method gives a speedup at about 10 times on depths of 10^100
Use a truncated Taylor series to approximate a starting value for a specific iteration, which make you able to skip all previous iterations.
This method gives a speedup of typically Another 10 times on depths of 10^100, and together the speed up is typically 100 times.
This, which we call Series Approximation, is where we have issues since we do not have any solid theoretically way of finding when too many iterations are skipped - for all pixels in the view. The more terms you include in the Taylor series, the more iterations you are able to skip. So if you stay below say 50 terms, it is not likely that you ever encounter any issues. Because some views can be correctly rendered 1000 or 100,000 times faster than full precision for each pixel with many terms - can you imagine a month turned into seconds! shocked
K.I.Martin originally used only 3 terms " - Kalles Fraktaler ^{[2]}

# Description edit

Very highly magnified images require more than the standard 64-128 or so bits of precision most hardware floating-point units provide, requiring renderers use slow "bignum" or "arbitrary precision"^{[3]} math libraries to calculate. However, this can be sped up by the exploitation of perturbation theory.^{[4]} Given

as the iteration, and a small epsilon, it is the case that

or

so if one defines

one can calculate a single point (e.g. the center of an image) using normal, high-precision arithmetic (*z*), giving a *reference orbit*, and then compute many points around it in terms of various initial offsets epsilon-zero plus the above iteration for epsilon. For most iterations, epsilon does not need more than 16 significant figures, and consequently hardware floating-point may be used to get a mostly accurate image.^{[5]} There will often be some areas where the orbits of points diverge enough from the reference orbit that extra precision is needed on those points, or else additional local high-precision-calculated reference orbits are needed. This rendering method, and particularly the automated detection of the need for additional reference orbits and automated optimal selection of same, is an area of ongoing, active research. Renderers implementing the technique are publicly available and offer speedups for highly magnified images in the multiple orders of magnitude range.^{[6]}^{[7]}^{[8]}

# Newton-Raphson zooming edit

One can "use newton's method to find and progressively refine the precision of the location of the minibrot at the center of a pattern. This allows them to arbitrarily select a magnification between the location they started at and the final minibrot they calculate to be at the center of that location."^{[9]}^{[10]}

# Glitches edit

Glitches^{[11]}^{[12]}

glitches in perturbation method How to detect glitches:

- heuristic developed by Pauldelbrot ( most common)
^{[13]} - heuristic using interval arithmetic developed by knighty
^{[14]}

How to choose reference point ( by Claude):

- simple method: "take the first reference to be the center of the image, and correct any glitches that result (including those resulting from the reference escaping too early) by adding more references within the glitches, recalculating only those pixels that need it. A simple approach can still yield accurate results, albeit in less than optimal time"
- " trying periodic points (the nuclei of the minibrot islands deep in the set) and preperiodic points (the Misiurewicz points at the centers of spirals), both of which can be found by Newton's method (finding their (pre)periods is a bit harder, but not impossible). Higher-period "structural" minibrot nuclei seem to be the most favoured as they are relatively easy to find while also emitting fewer glitched pixels than lower period nuclei"

Types of glitches by Claude:^{[15]}
1. Reference escapes early, this type can be avoided by picking a non-escaping reference
2. Too-different dynamics (detected easily by Pauldelbrot's heuristic, detected accurately by gerrit's backwards error analysis, think knighty had another method too)

Type 1 can be improved by picking a random glitched pixel as the new reference and retrying

Type 2 can sometimes be fixed by using pixel with minimum |z| at the glitch iteration (possibly using derivative for 1 step of Newton's method to make it closer to a miniset), but often picking a random pixel works just as well - the advantage for minimum |z| comes for Mandelbrot set where you don't need to restart iterations from the beginning because minisets are periodic through 0 and the period is the glitch iteration (I use this in my mandelbrot-perturbator thing)

KF uses an algorithm I don't really understand for finding the "glitch center" based on pixel regions, but also has options for random choice and minimum |z| (without the fancy stuff from mandelbrot-perturbator). Locations:

- "a minibrot near -2+0i at very deep zooms, chances are you'll end up with a Moire mess of stars, instead of concentric rings of rays (because the rays will be regularly spaced finer than the pixel spacing, leading to interference)."

Knighty's SMB which I think is still a bit faster than KF though being more of a testbed than a usable renderer puts the glitches in distinct sets (G1,.., Gn) with same iteration number where glitch was detected. Next references will then be 1 random pixel from each of the G1,..,Gn and is used only to recalculate the pixels in each set G. Secondary glitches simply generate another set G and you just put then in some queue or stack and keep going at it till no more G sets left. When dealing with glitched pixels you can use the same series expansion as a starting point. ( Gerrit)^{[16]}

# Rebasing edit

Rebasing^{[17]} means resetting the reference iteration to the start when the pixel orbit (i.e. Z+z , the reference plus delta) gets near a critical point (like 0+0i for the Mandelbrot set). If there is more than one critical point, you need reference orbits starting at each of them, and this test can switch to a different reference orbit. For this case, pick the orbit o that minimizes |(Z−Zo)+z|
, among the current reference orbit at iteration whatever, and the critical point orbits at iteration number 0 . Rebasing means you only need as many reference orbits as critical points (which for simple formulas like the Mandelbrot set and Burning Ship means only one), and glitches are avoided rather than detected, needing to be corrected later. This is a big boost to efficiency (which is nice) and correctness (which is much more important).^{[18]}

# Effects edit

Perturbation algorithm with series approximation ( 100 times faster on zoom levels around e100! ) ^{[19]}

# Precision edit

For deeper zooms there are 3 options:^{[20]}

- double/float64 (until e300 or so, some hardware has greatly reduced performance vs float32)
- float32 + separate int32 exponent ("floatexp") (or int16 could work for intermediate zooms until e9800 or so)
- fully software floating point (two uint32, one for mantissa, the other for sign and exponent)
- prec = 53 - log2(view_radius))
^{[21]}See also code: code.mathr.co.uk/fractal-bits/mandelbrot-perturbation-error/mandelbrot-perturbation-error.c

# history edit

- 2 independent descriptions :
- Fast Mandelbrot set with infinite resolution by Sergey Khashin (July 9, 2011)
^{[22]}^{[23]} - perturbation method by K.I. Martin (2013-05-18)
^{[24]}( only use 3 Series Approximation terms )

- Fast Mandelbrot set with infinite resolution by Sergey Khashin (July 9, 2011)
- Pauldelbrot's glitch detection method
^{[25]} - extending Martin's description to handle interior distance estimation too by Claude Heiland-Allen
^{[26]}

# Programs edit

- SuperFractalThing in Java by K.I. Martin
^{[27]}^{[28]} - mightymandel by Claude Heiland-Allen
^{[29]} - mandelbrot-perturbator by Claude Heiland-Allen : http://code.mathr.co.uk/mandelbrot-perturbator/
- persianney : fractalNotes.pdf
- Kalles Fraktaler for windows
- perturbation_algebra and et
- interactive SageMath worksheet explaining how it works, try changing the formula
- FractalZoomer
- MandelbrotPerturbation by ShiromMakkad

# Compare edit

# References edit

- ↑ 2021-05-14 deep zoom theory and practice by Claude Heiland-Allen
- ↑ Fractal Forums > Fractal Software > Help & Support > (C++) How to deep zoom in mandelbrot set?
- ↑ arbitrary precision at wikipedia
- ↑ perturbation theory in wikipedia
- ↑ "Superfractalthing - Arbitrary Precision Mandelbrot Set Rendering in Java by K.I. Martin 2013-05-18".
- ↑ "Kalles Fraktaler 2".
- ↑ Fast Mandelbrot set with infinite resolution, ver. 2 by Sergey Khashin, July 9, 2011
- ↑ Perturbation techniques applied to the Mandelbrot set by Claude Heiland-Allen October 21, 2013
- ↑ newton-raphson-zooming by quaz0r
- ↑ Newton-Raphson zooming and Evolution zoom method by Dinkydau
- ↑ pertubation-theory-glitches-improvement - fractal forum
- ↑ fractalNotes by Gerrit
- ↑ fractalforums " pertubation-theory-glitches-improvement
- ↑ fractalforums : *continued*-superfractalthing-arbitrary-precision-mandelbrot-set-rendering-in-ja/msg91505/#msg91505
- ↑ fractalforums.org : how-to-get-second-reference-when-using-perturbation-theory
- ↑ fractalforums.org : how-to-get-second-reference-when-using-perturbation-theory
- ↑ fractalforums.org : reference-compression
- ↑ 2022-02-21 deep zoom theory and practice again by Claude Heiland-Allen
- ↑ Kalles Fraktaler 2 by Bernard Geiger
- ↑ fractalforums.org: re-rescaling-with-32-bit-floats
- ↑ fractalforums.org : single-precision-is-not-enough-for-bilinear-approximation
- ↑ Fast Mandelbrot set with infinite resolution, ver. 2
- ↑ Fast calculation of the Mandelbrot set with infinite resolution by Sergey Khashin, October 12, 2016
- ↑ fractalforums : superfractalthing-arbitrary-precision-mandelbrot-set-rendering-in-java
- ↑ fractalforums - pertubation-theory-glitches-improvement
- ↑ Perturbation glitches by Claude Heiland-Allen
- ↑ superfractalthing By K.I. Martin
- ↑ sft maths.pdf ( original notes)
- ↑ mightymandel by Claude Heiland-Allen