Function to calculate the period of a Mandelbrot Set point I'm trying to implement a program to calculate the period of a Mandelbrot Set point.
I'm using the multipliers of periodic points as explained here:
https://rlbenedetto.people.amherst.edu/talks/mhc_ug14.pdf
I've already implemented a first version but it's not detecting well all periods inside the bulbs.
I'm using this formula:

where "phi prime" is 2*z and "phi N" the Nth iteration of the Mandelbrot formula z²+c.
UPDATE:
I want to calculate the cycle of a point. Basically I want to build this image.
I'm not a mathematician but what I understood from the λ function, "n" is the minimum period/cycle of the orbit for the complex point "a".
The way to get the minimum "n" is by using brute force iterating "n" from 1 to MAX_PERIOD you want to check.
There is another explanation here for this method to get the period.
LINKS:

*

*The program I'm implementing.

 A: As the comments already have stated, the value of $\lambda$ is not the period of the point $a$, but rather, it refers to a property of the dynamics of $a$; specifically, whether the $n$-cycle that $a$ belongs to is an attractive, repelling, or indifferent one.  What we mean by these terms is this:

*

*Attractive:  points in the attraction basin--loosely speaking, some neighborhood of the cycle of periodic points--will have a forward orbit whose limit will tend toward the cycle.  This is sort of analogous to the concept of a stable equilibrium in physics, where small perturbations away from the equilibrium will still return to that equilibrium.

*Repelling:  points in a neighborhood of the cycle are repelled from the cycle, even though the cycle itself is periodic.  This is like an unstable equilibrium (e.g., balancing a pencil on its tip is impossible but there is a theoretical point where the pencil's center of gravity is directly above the balancing point).

*Indifferent:  the dynamics of this case are complex--it's neither attracting nor repelling.  The ways in which orbits in a neighborhood of a cycle behave are not all the same.  See how many known classifications and types of indifferent fixed-points are there? for more information.

That said, all of this has nothing to do with the period of the cycle itself.  A naive calculation of the period would be done by calculating a sufficiently large number of iterations $\{z_0, z_1, \ldots \}$ and then comparing $z_n$ against $z_{n-k}$ for $k \in \{1, 2, \ldots, m\}$ where $m$ is the largest period you want to detect.  If you can find that $|z_n - z_{n-k}| < \epsilon$ for sufficiently large $n$, this suggests a cycle of length $k$ and you would confirm by looking at $$\{|z_n - z_{n-k}|\}_{n=n'}^{n'+k}$$ and seeing that these are all sufficiently small. There are more sophisticated approaches, but this is the elementary way.
A: What I do to create an image like the one you link, for $f_c(z) = z^2 + c$:

*

*start iteration from $z_0 := 0$, with $m := \infty$

*for each $n = 1, 2, 3, ...$ in order

*

*calculate $z_n := f_c(z_{n-1})$

*if $|z_n| < m$

*

*set $m := |z_n|$

*use Newton's method to solve $w = f_c^{\circ n}(w)$ with initial guess $w^{(0)} := z_n$ (this may fail to converge, in which case continue with the next $n$), the steps are $$w^{(i+1)} := w^{(i)} - \frac{f_c^{\circ n}(w^{(i)}) - w^{(i)}}{{f_c^{\circ n}}'(w^{(i)}) - 1}$$

*calculate the derivative of the cycle $\lambda := {f_c^{\circ n}}'(w)$

*if $|\lambda| < 1$, then the cycle is attractive and $c$ is within a hyperbolic component of period $n$, stop (success).  $\lambda$ may used as "interior coordinates" within the hyperbolic component. $w$ and $n$ can be used for interior distance estimation.





The point of using Newton's method is to accelerate the computation of $w$, a point in the limit cycle attractor.  Computing $w$ just by iterating $f_c$ could take many 1000s of iterations, especially when $\lambda$ is close to $1$.
I have no complete proof of correctness (but this doesn't mean I think it is incorrect; the images seem plausible).  It relies on the "atom domains" surrounding each hyperbolic component of a given period.
It also relies on the cycle reached by Newton's method being the same cycle as the limit cycle approached by iteration: this is true for the quadratic Mandelbrot set because there is only one finite critical point, $0$ ($\infty$ is a fixed point) and each attracting or parabolic cycle has a critical point in its immediate basin (see https://math.stackexchange.com/a/3952801), which means there can be at most one attracting or parabolic cycle.
For an implementation in C99 you can see my blog post at https://mathr.co.uk/blog/2014-11-02_practical_interior_distance_rendering.html
A: Here is "my" algorithm:

*

*choose parameter c

*compute critical orbit ( forward orbit of critical point ) and find period of it's limit cycle:

Steps:

*

*start with critical point: z = z0 = 0.0

*make n forward iterations of z0 to (possibly) fall into attracting cycle
now z = zn

*make n forward iterations of zn to compute attracting cycle

*check backwards whether the last iterate z has already been visited before

Max iteration and precision ( epsilon ) might need to be adjusted
Here is the code for complex quadratic polynomialand  for the other polynomials
Comparison of "my" and Claude's methods:




"my"
Claude's




compute z,n
compute z,n,lambda


gives only attracting z
gives all z, also repelling


checks dynamics by using forward iteration
uses numerical method for finding roots


need very small epsilon and very large n for points near boundary
can use bigger epsilon and smaller n



