8.2.1 Periodicity Logic
The "Mandelbrot Lake" in the center of the M-set images is the
traditional bane of plotting programs. It sucks up the most computer
time because it always reaches the iteration limit -- and yet the most
interesting areas are invariably right at the edge the lake. (See The
Mandelbrot Set (p. 43) for a description of the iteration process.)
Thanks to Mark Peterson for pointing out (well, he more like beat us
over the head until we paid attention) that the iteration values in the
middle of Mandelbrot Lake tend to decay to periodic loops (i.e., Z(n+m)
== Z(n), a fact that is pointed out on pages 58-61 of "The Beauty of
Fractals"). An intelligent program (like the one he wrote) would check
for this periodicity once in a while, recognize that iterations caught
in a loop are going to max out, and bail out early.
For speed purposes, the current version of the program turns this
checking algorithm on only if the last pixel generated was in the lake.
(The checking itself takes a small amount of time, and the pixels on the
very edge of the lake tend to decay to periodic loops very slowly, so
this compromise turned out to be the fastest generic answer).
Try a full M-set plot with a 1000-iteration maximum with any other
program, and then try it on this one for a pretty dramatic proof of the
value of periodicity checking.
You can get a visual display of the periodicity effects if you press
<O>rbits while plotting. This toggles display of the intermediate
iterations during the generation process. It also gives you an idea of
how much work your poor little PC is going through for you! If you use
this toggle, it's best to disable solid-guessing first using <1> or <2>
because in its second pass, solid-guessing bypasses many of the pixel
calculations precisely where the orbits are most interesting.
Mark was also responsible for pointing out that 16-bit integer math was
good enough for the first few levels of M/J images, where the round-off
errors stay well within the area covered by a single pixel. Fractint now
uses 16-bit math where applicable, which makes a big difference on non-
32-bit PCs.