# Reliable Mandelbrot

Mathematically reliable images, compare with

# 1 Plain Iteration

When iterating Z→Z2+CZ \to Z^2 + C, how much precision is necessary?

Suppose one says the image is reliable when the final ZZ, with all the rounding errors along the way, is equal to an exact ZZ for a C*C_* that is not too different from the input CC (for example, they are within a pixel distance).

Call the forward error in ZZ due to rounding, ΔZ\Delta Z, and calculate derivatives dZdZ1\frac{dZ}{dZ_1}, then the condition that there is a C*C_* near CC resolves to |ΔZ|<|ΔC||dZdZ1|,\left|\Delta Z\right| < \left|\Delta C\right| \left|\frac{dZ}{dZ_1}\right|, where ΔC<1Zoom×Height\Delta C < \frac{1}{Zoom \times Height}.

Rounding ZnZ_n gives (1+ϵn)Zn(1 + \epsilon_n) Z_n, where |ϵn||\epsilon_n| is at most 2−Precision2^{-Precision}. The forward error compounds like: ΔZn+1=2(1+ϵn)ZnΔZn+(ΔZn)2\Delta Z_{n+1} = 2 (1 + \epsilon_n) Z_n \Delta Z_n + (\Delta Z_n)^2 Assuming ΔZ\Delta Z is small (and ZnZ_n is large), ignore the squared term, to get ΔZn=ΔZ1(∏k2Zk(1+ϵk))=ΔZ1dZndZ1∏k(1+ϵk)\Delta Z_n = \Delta Z_1 \left(\prod_k 2 Z_k (1 + \epsilon_k)\right) = \Delta Z_1 \frac{dZ_n}{dZ_1} \prod_k(1 + \epsilon_k) and as Z1=CZ_1 = C all its error is from rounding, so ΔZ1≈2−Precision.\Delta Z_1 \approx 2^{-Precision}. Altogether in the worst case (1+2−Precision)Iterations2−Precision<ΔC=1Zoom×Height(1 + 2^{-Precision})^{Iterations} 2^{-Precision} < \Delta C = \frac{1}{Zoom \times Height} which logs to Iterations×log(1+2−Precision)−Precisionlog(2)<−log(Zoom×Height)Iterations \times \log(1 + 2^{-Precision}) - Precision \log(2) < -\log (Zoom \times Height) Now 2−Precision2^{-Precision} is small, so log(1+2−Precision)≈2−Precision\log(1 + 2^{-Precision}) \approx 2^{-Precision} which gives Iterations×2−Precision−Precisionlog2<−log(Zoom×Height)Iterations \times 2^{-Precision} - Precision \log 2 < -\log (Zoom \times Height) and then by WolframAlpha, Precision>W(IterationsZoom×Height)+log(Zoom×Height)log(2)Precision > \frac{W\left(\frac{Iterations}{Zoom \times Height}\right) + \log(Zoom \times Height)}{\log(2)} where W(z)W(z) is the inverse function of z→zezz \to z e^z. As WW grows very slowly, the commonly used approximation Precision=log2(Zoom×Height)+KPrecision = \log_2(Zoom \times Height) + K is generally reasonable even when KK is quite small.

# 2 Perturbed Iteration

When iterating Z→Z2+CZ \to Z^2 + C at one point (with plenty of precision) then rounding each ZZ to a working precision and iterating differences of nearby points z→2Zz+z2+cz \to 2 Z z + z^2 + c, how much precision is necessary?

I have not found a way to compute this other than as a per-pixel status, which tells if the pixel is inaccurate.

Compute: Δzn+1=Δzn(2|Zn|(1+2−Precision)+2|zn|+Δzn)+2|Zn||zn|2−Precision\Delta z_{n+1} = \Delta z_n \left(2 |Z_n| \left(1 + 2^{-Precision}\right) + 2 |z_n| + \Delta z_n\right) + 2 |Z_n| |z_n| 2^{-Precision} Then the pixel is inaccurate when: Δzn×Zoom×Height>dzndz1.\Delta z_n \times Zoom \times Height > \frac{dz_n}{dz_1}.

Ideally it would be better to know beforehand how much precision is required for every pixel.