Welcome to Fractal Forums

Fractal Software => Help & Support => Topic started by: greentexas on June 09, 2017, 04:04:14 PM




Title: Period Detection for Dummies
Post by: greentexas on June 09, 2017, 04:04:14 PM
I am not very interested in period detection, but here is a quick and dirty way to carry it out. (Many of you know how this works, so I'm mostly writing to amateurs, but the experienced members may be able to learn too!)

Period detection can be used to figure out the structure of many escape-time fractals near a given point x. We also take another number n. Decreasing n decreases the chance of underestimating the length of the period and increases the chance of overestimating the length of the period.

If we iterate -0.509 + 0.576i where n = 0.01, we end up with this result:

At the end of the first iteration, we have -0.5817 - 0.0103i.
At the end of the second iteration, we have -0.1707 + 0.588i.
At the end of the third iteration, we have -0.8257 + 0.3752i.
At the end of the fourth iteration, we have 0.03196 - 0.04356i.
At the end of the fifth iteration, we have -0.50987663 + 0.57321582i. This is less than 0.01 units away from -0.509 + 0.576i, so the period is five.

In fact, if we set n to a real number as low as 0.003 or as high as 0.338, we will still get a period of five. (If n is over roughly 0.338, the period will be said to be less than five; less than 0.003, and the period will be said to be greater than five.) If you use 0.0028 as the precision, the period will be ten, and not five.

There are period 5 structures near -0.509 + 0.576i. Near other points, the structures have a period equal to the period of the other points.

This could be useful if you want to determine the period of a shape in the Seahorse or Elephant Valley (since the periods are high). Simple iteration-bubble counting can also help you find the period, as it is a lot easier without programming.


Title: Re: Period Detection for Dummies
Post by: claude on June 09, 2017, 05:24:14 PM
I think your numbering of iterations is a little off: usually it is:  z_0 = 0 ; z_1 = c ; ...

A different way is to check that z_p is near zero, rather than z_{p+1} is near c.  They have the same effect in the end, but it's a little easier to calculate.

Then (what I call) "partials" are the iterations p where |z_p| is smaller than all previous |z_n|.  They are good candidates for possible periods.  I wrote a small program to calculate them, here's some output, lines with **** are the partials:

Code:
$ ./partials -0.509 0.576
   n    z                                                  |z|                      min
   1    -0.509000000000000008 + +0.575999999999999956 i    +0.768672231838772757    ****
   2    -0.581694999999999962 + -0.010368000000000044 i    +0.581787391105204277    ****
   3    -0.170738422399000056 + +0.588062027520000030 i    +0.612346762132562117
   4    -0.825665339327633863 + +0.375190434296955644 i    +0.906912958643195766
   5    +0.031955390579078591 + -0.043563474492556487 i    +0.054027060783695097    ****
   6    -0.509876629322802200 + +0.573215824315217226 i    +0.767170488467169953
   7    -0.577602204115791773 + -0.008538704752669046 i    +0.577665314588191370
   8    -0.175448603279432458 + +0.585863949370871162 i    +0.611570747800398218
   9    -0.821454354779731055 + +0.370421976742216996 i    +0.901110258425790955
  10    +0.028574816132972747 + -0.032569491802020845 i    +0.043327726841770761    ****
  11    -0.509244251679208726 + +0.574138665520425695 i    +0.767440496138881434
  12    -0.579305499377257949 + -0.008753630166097426 i    +0.579371631726838143
  13    -0.173481764432350638 + +0.586142052189469798 i    +0.611276065240121014
  14    -0.822466582754321607 + +0.372630085156343605 i    +0.902942113377815159
  15    +0.028598099383947528 + -0.036951585539979570 i    +0.046725485147749588
  16    -0.509547568385544269 + +0.573886509768666397 i    +0.767453223683425945
  17    -0.578707001646840746 + -0.008844951163781811 i    +0.578774590765840591
  18    -0.174176439406013128 + +0.586237270335409733 i    +0.611564852795244307
  19    -0.822336705086155639 + +0.371782559211755903 i    +0.902474336402979138
  20    +0.029015385197912136 + -0.035460889501387816 i    +0.045818852696383125

and here's the program:

Code:
// gcc -std=c99 -Wall -Wextra -pedantic -O3 -o partials partials.c -lm
// ./partials re im

#include <complex.h>
#include <stdio.h>
#include <stdlib.h>

int main(int argc, char **argv)
{
  if (argc != 3)
  {
    fprintf(stderr, "usage: %s re im\n", argv[0]);
    return 1;
  }
  double re = atof(argv[1]);
  double im = atof(argv[2]);
  double _Complex c = re + im * I;
  double _Complex z = 0;
  double minimum = 1.0 / 0.0; // infninity
  printf("   n    z                                                  |z|                      min\n");
  for (int n = 1; n < 100; ++n)
  {
    z = z * z + c;
    double absz = cabs(z);
    printf("%4d    %+.18f + %+.18f i    %+.18f", n, creal(z), cimag(z), absz);
    if (absz < minimum)
    {
      minimum = absz;
      printf("    ****");
    }
    printf("\n");
  }
  return 0;
}

The last partial (if it exists, and it usually does) is called the atom period, and plotting that using different colours in an image gives you connected atom domains, see:
http://www.mrob.com/pub/muency/atomdomain.html