.. _periodicity:

Periodicity checking
====================

**Syntax**:(periodicity bool)

Periodicity checking is one way to speed up the calculation. Areas inside the
set always need :ref:`maxiter <maxiter>` iterations to determine that the point
is probably inside the set (while it is rare for areas outside to need anywhere
near that much). Often the orbital trajectory falls into a periodic, repeating
cycle; if that can be detected, the calculation can be stopped early, as
there's no way that the orbit can ever leave the cycle again (hence it cannot
diverge, hence the point must be inside the set).

Implementating this method efficiently is quite problematic. It slows down the
cases where cycles are not found, because cycle-checking is quite hard work and
has to take place for all points, even those that don't become cyclic. Because
of the inexactness of floating-point calculations, the cycles are never exact,
so you need to use an error value. Higher error values mean that cycles will be
detected sooner, while lower error values increase the exactness of the
calculation. Higher values can introduce serious errors, especially at the
front of the Mandelbrot set. XaoS detects this automatically and corrects for
it in most cases, but sometimes it might be wrong. Also, other optimizations in
XaoS (such as boundary tracing) don't give this method much of a chance to run,
since areas inside the set are usually not calculated at all.

That's why the advantages of this optimization are questionable. You should
probably experiment with enabling and disabling it. Sometimes XaoS is faster
with this enabled, sometimes when disabled. Also, this method works only when
:ref:`incoloring <incoloring>` methods are disabled, and only for some fractal
types (some fractal types, e.g. newton, don't have any concept of an area
'inside the set' at all.)

The tutorial chapter ":tutor:`Escape time fractals <escape.xaf>`" has
more information on fractal calculation in XaoS, and there is a lengthy section
in the hacker's manual (xaosdev.texinfo) devoted to the subject.

**Available as**: menu item, command line option, command
