mdbtxt1
mdbtxt2
Proceed to Safety

Distance Estimator    

Robert P. Munafo, 2023 Jun 13.



A less common representation function for the Mandelbrot Set. Distance Estimator allows you to see every pixel that contains any points in the Mandelbrot Set (no matter how few such points there are). This makes the filament structure much easier to see.

The Distance Estimator algorithm, presented below, is similar to algorithm "DEM/M" in The Science of Fractal Images. Most images in this encyclopedia show the filaments and were computed with a Distance Estimator algorithm.

The algorithm is based on the derivative of the iteration function and works because the dwell bands are spaced closer together as you approach a point in the Mandelbrot set. Calcuating the derivative is equivalent to measuring the spacing of the dwell bands.

Distance-Estimator is the best representation function for exploring the Mandelbrot set, and it is used in many good color schemes. The DEM-Dwell Hybrid article illustrates the difference.

function distance_estimator param(c) : complex param(max_iterations) : integer param(escape_radius) : real       should be 2.0 or larger result: real begin function declare z, z2, dz : complex declare iterations : integer declare still_iterating : boolean    let still_iterating = true let iterations = 0 let z = c let dz = 0 let escape_radius = 2.0    or larger value    while (still_iterating) do let z2 = z2 + c let dz = 2 * z * dz + 1 let z = z2 let iterations = iterations + 1 if (magnitude(z) > escape_radius) then let still_iterating = false else if (iterations >= max_iterations) then let still_iterating = false end if end while    let z = magnitude(z) let dz = magnitude(dz) let result = log(z*z) * z / dz end function

The value of result is a real giving the approximate distance between the point z and the nearest point that is in the Mandelbrot Set. If you are viewing an area that contains Filaments, then nearly all of the 'interesting' parts of the view will have values of result that are very small positive numbers, like 0.01 or 0.00001.

The most important part of the calculation is the iteration which is shown above (the first three lines after "while (still_iterating) do") using complex values for the variables c, z, and dz. To calculate this using separate real components (cr,ci), (zr,zi), and (dzr,dzi), replace those lines with:

let dzr2 = 2 * (zr*dzr - zi*dzi) + 1 let dzi = 2 * (zi*dzr + zr*dzi) let dzr = dzr2 let zr2 = zr * zr let zi2 = zr * zr let zi = 2 * zr * zi + ci let zr = zr2 - zi2 + cr

which uses three extra temp variables dzr2, zr2, and zi2.

Since images are usually plotted through a color table, and since color tables require an index (like a number from 1 to 100), you will probably want to convert the result of distance_estimator to a color table index. A good formula that accomplishes this is:

let color_table_index = 0 - k * log(distance_estimator(z, max_iteraions))

where k is a constant that depends on the size of your color table and the maximum zoom magnification factor according to the following formula:

k = color_table_size / log(maximum_zoom_magnification)

For example, if your color table has 200 elements and the maximum magnification is 1010, and if log is a base-10 logarithm, then k would be 200/10 = 20.

Distance Estimator for Julia Set Images

According to Milnor (in Dynamics in One Complex Variable, appendix G), the distance estimate for Julia sets is close to the ratio magnitude(G)/G', where G and G' are defined as follows:

G(Z0) = limit(k→infinity) [ log(magnitude(Zk)/2k ]
G'(Z0) = limit(k→infinity) [ magnitude(dZk) / (2k magnitude(Zk)) ]
dZk = 2k Zk-1 Zk-2 ... Z2 Z1 Z0

When one of the Zk is close to 0 (that is, for points near the origin and any points with an iterate that maps onto the origin) the distance estimate is inaccurate.

See also interior distance estimate


Acknowledgments

The Distance Estimator method was pioneered by Thurston, and was made known to the general community by Peitgen and Richter in their book The Beauty of Fractals. A precise algorithm is given in The Science of Fractal Images, page 198, where it is called DEM/M.


revisions: 20080319 oldest version on record; 20100505 fix some typos in the source code; 20100907 replace "2.0" with escape_radius; 20110228 link to DEM-Dwell Hybrid article; 20111208 slight rewrite and add a couple xrefs; 20230613 expand iteration to real/imag. components




From the Mandelbrot Set Glossary and Encyclopedia, by Robert Munafo, (c) 1987-2024.

Mu-ency main pageindexrecent changesDEMZ


Robert Munafo's home pages on AWS    © 1996-2024 Robert P. Munafo.    about    contact
This work is licensed under a Creative Commons Attribution-NonCommercial 4.0 International License. Details here.

This page was written in the "embarrassingly readable" markup language RHTF, and was last updated on 2023 Jun 23. s.27