Fractals/Mathematics/Period

=external angle= All rays landing at the same periodic point have the same period: the common period of the rays is a (possibly proper) multiple of the period of their landing point; therefore one distinguishes: the ray period from the orbit period.

=The doubling map = How to find the period of angle under doubling map
 * visual
 * numerical
 * read period from denominator of decimal fraction ( reduced rational fraction m/n )
 * find period/preperiod in the binary expansion ( binary sequence)
 * string matching algorithms, for instance, naive or brute-force search, Knuth-Morris-Pratt algorithm
 * discrete Fourier transform
 * read it from the itinerary of angle under doubling map

Period of binary expansion of reduced rational fraction m/n is equal to the multiplicative order of 2 modulo n:

$$ Period_2(m/n) = {ord}_n(2)$$

Maxima CAS version
DoublingMap(r):= block([d,n], n:ratnumer(r), d:ratdenom(r), mod(2*n,d)/d)$

/* Tests : GivePeriod (1/7) 3 GivePeriod (1/14) 0 GivePeriod (1/32767) 15 GivePeriod (65533/65535) 16

Gives 0 if :
 * not periodic ( preperiodic )
 * period >pMax

GivePeriod (r):= block([rNew, rOld, period, pMax, p],     pMax:100,      period:0,      p:1,       rNew:DoublingMap(r),      while ((p<pMax) and notequal(rNew,r)) do        (rOld:rNew, rNew:DoublingMap(rOld), p:p+1 ),     if equal(rNew,r) then period:p,      period );

Haskell version
Haskell version

Conversion from an integer type (Int or Integer) to anything else is done by "fromIntegral". The target type is inferred automatically

=Real quadratic map =

=Complex quadratic map =
 * island
 * distortion of the island
 * centers of componenets
 * math.stackexchange question: function-to-calculate-the-period-of-a-mandelbrot-set-point

What c parameters are hard cases when computing period ?

 * boundary and near boundary points ( parabolic, Siegel, Cremer)
 * "for example, c=1/4−10^{−10} takes over 800000 iterations to reach a fixed point in double precision floating point, but 20 iterations of Newton's method suffice to reach a fixed point. The two fixed points are slightly different, but both are fixed (each to themselves) in double precision." - Claude Heiland-Allen
 * " You may need very small epsilon and very large n, otherwise for example c=−3/4+10{−10} will probably give an incorrect period of 2 instead of the correct period of 1, which error will compound to an incorrect interior distance estimate (for example distance 3.8e-8 with your method (epsilon 1e-12, n 79,573,343) instead of 2e-10 with my method). " Claude Heiland-Allen
 * "one can iterate a "whole lot" of times, then see if the last iteration equals any of the previous iterations. However, such methods are never foolproof. Typically, they fail when used on points that are comparatively close to the boundary of their mu-atom. In such cases the algorithm will usually "find" an integer multiple of the actual period. This happens because as you get close to a child mu-atom, the points approaching the limit cycle converge in a spiral or pinheel-like manner. For example, imagine the period is actually 5, and our point is close to a child mu-atom with period 35. If you look at each 5th iterate, you'll typically find a pattern that spirals in on a limit point, taking 7 steps to go each time around the spiral. Because of the spiral pattern, the 7th step (35th iteration) is a lot closer than the 1st step (5th iteration), and simple period-finding algorithms will catch the closer one." Robert Munafo From the Mandelbrot Set Glossary and Encyclopedia

Solution:
 * do not use naive method for computing period by iteration
 * use Robert P. Munafo's Jordan curve method

checking the period using position of parameter = periodicity checking

 * https://www.shadertoy.com/view/4sdXWX
 * Period_detection on the parameter plane

Jordan curve method

 * Period from the Mandelbrot Set Glossary and Encyclopedia, by Robert Munafo, (c) 1987-2017.
 * periodicity_scan using the box period Jordan curve method by Claude Heiland-Allen

There is a greatly enhanced period detection algorithm (using the jordan curve method) that locates islands in the view even if they are far too small to see at the current magnification level. Robert Munafo

C code from mandelbrot-numerics library by Claude Heiland-Allen

Finding period of the orbit
Methods :
 * direct period detection from iterations
 * the spider algorithm
 * "methods based on interval arithmetic when implemented properly are capable of finding all period-n cycles for considerable large n." (ZBIGNIEW GALIAS )
 * Floyd's cycle-finding algorithm

Finding period is used to :
 * draw components of Mandelbrot set
 * Interior DEM/M

Period of critical orbit
Finding period of critical orbit using forward iteration of critical point :

Maxima CAS
/* b batch file for maxima

kill(all); remvalue(all);

/* =================== functions ============ */

/* https://en.wikibooks.org/wiki/Fractals/Iterations_in_the_complex_plane/qpolynomials complex quadratic polynomial

f(z,c):=z*z+c;

/* iterated map */

fn(p, z, c) := if p=0 then z elseif p=1 then f(z,c) else f(fn(p-1, z, c),c);

/* https://en.wikibooks.org/wiki/Fractals/Mathematics/Period#Complex_quadratic_map

period of c under complex quadratic polynomial f GivePeriod(c):=block(

[z: 0.0, k2Max:200, /* to big values couse bind stack overflow */ k1Max:100, ER:2.0, dMax:0.0003, /* if too low then gives smaller period then */ period:0 /* no period found = (period > k2Max) or ..... ???? */

],

/* to remove non periodic points, iterate and do not use it */ for k1:1 thru k1Max do   (z: f(z,c),   if  (cabs(z)>ER) then  (period : -1, /* escaping */ go(exit)) ),

/* after k1Max iterations z SHOULD BE inside periodic orbit  */ zOld:z,

for k2:1 thru k2Max do   ( z: f(z,c),    if  (cabs(z)>ER) then  (period : -1,  go(exit)), /* escaping */   if  (cabs(zOld-z) k2Max G(-1.119816337988403 +0.264371090395906*%i); gives 0 when k2Max =100 gives 108 when dMax = 0.003 but  true period = 162  ( set k2Max = 200 and dMax= 0.0003

--- G(0.37496784+%i*0.21687214); http://fraktal.republika.pl/period.html gives 0



G(c):=GivePeriod(c);

compile(all); /* input value -- */

c : 0.25 +0.5 * %i$

/* ============== compute =============== */ p:GivePeriod(c)$ p;

c

 * code by Claude

Comparison of 2 functions for finding a period :

Non-linear scale shows bigger periods ( along real slice of Mandelbrot set ) :

c#
User:Simpsons_contributor: periodicity_checking

=References=

=See also=
 * Cycle detection at wikipedia
 * Period at wikibooks
 * Periodic point at wikibooks
 * Finding period of angle under doubling map
 * periodic points in wikipedia
 * Period_detection