# Reliable Mandelbrot
Mathematically reliable images, compare with
# 1 Plain Iteration
When iterating \(Z \to Z^2 + C\), how much precision is necessary?
Suppose one says the image is reliable when the final \(Z\), with all the rounding errors along the way, is equal to an exact \(Z\) for a \(C_*\) that is not too different from the input \(C\) (for example, they are within a pixel distance).
Call the forward error in \(Z\) due to rounding, \(\Delta Z\), and calculate derivatives \(\frac{dZ}{dZ_1}\), then the condition that there is a \(C_*\) near \(C\) resolves to \[\left|\Delta Z\right| < \left|\Delta C\right| \left|\frac{dZ}{dZ_1}\right|,\] where \(\Delta C < \frac{1}{Zoom \times Height}\).
Rounding \(Z_n\) gives \((1 + \epsilon_n) Z_n\), where \(|\epsilon_n|\) is at most \(2^{-Precision}\). The forward error compounds like: \[\Delta Z_{n+1} = 2 (1 + \epsilon_n) Z_n \Delta Z_n + (\Delta Z_n)^2\] Assuming \(\Delta Z\) is small (and \(Z_n\) is large), ignore the squared term, to get \[\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 \(Z_1 = C\) all its error is from rounding, so \[\Delta Z_1 \approx 2^{-Precision}.\] Altogether in the worst case \[(1 + 2^{-Precision})^{Iterations} 2^{-Precision} < \Delta C = \frac{1}{Zoom \times Height}\] which logs to \[Iterations \times \log(1 + 2^{-Precision}) - Precision \log(2) < -\log (Zoom \times Height)\] Now \(2^{-Precision}\) is small, so \(\log(1 + 2^{-Precision}) \approx 2^{-Precision}\) which gives \[Iterations \times 2^{-Precision} - Precision \log 2 < -\log (Zoom \times Height)\] and then by WolframAlpha, \[Precision > \frac{W\left(\frac{Iterations}{Zoom \times Height}\right) + \log(Zoom \times Height)}{\log(2)}\] where \(W(z)\) is the inverse function of \(z \to z e^z\). As \(W\) grows very slowly, the commonly used approximation \[Precision = \log_2(Zoom \times Height) + K\] is generally reasonable even when \(K\) is quite small.
# 2 Perturbed Iteration
When iterating \(Z \to Z^2 + C\) at one point (with plenty of precision) then rounding each \(Z\) to a working precision and iterating differences of nearby points \(z \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: \[\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: \[\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.