## Algorithm for Mandelbrot cardioid

A good way to speed up a Mandelbrot set plotter is to eliminate the main cardioid and the largest circle. It turns out that there are simple equations for these, which can be found if you know that the cardioid consists of all the points which converge to a single point and the largest circle consists of all the points which converge to a cycle of period 2.

First the main cardioid. For each c, we can find the fixed point of iteration $z_f$ such that $z_f^2+c = z_f$. There are two solutions, $\displaystyle \frac{1}{2}(1 \pm \sqrt{1-4c})$. Then we can look at what happens when we iterate a nearby point $(z_f+d)^2+c = z_f^2+c + 2dz_f$. If $|2z_f|<1$ then the fixed point is stable. It turns out that this only happens for the $\displaystyle \frac{1}{2}(1 - \sqrt{1-4c})$ solution, so points in the cardioid are $|1 - \sqrt{1-4c}| <= 1$, with equality for the boundary.

Having to compute a complex square root is a bit ugly, though - can we do better? It turns out that we can. It's a fiddly calculation but if you multiply out all the square roots and simplify, you can get the formula $|c|^2(8|c|^2-3) <= 3/32 - Re(c)$.

For the period-2 circle, we solve $(z_f^2+c)^2+c = z_f$ and eliminate the period-1 solutions to get $\displaystyle \frac{1}{2}(-1 \pm \sqrt{-3-4c})$. In this case, both solutions are equally valid, since the cycle consists of both. Picking one and doing the same derivative analysis (this time applying two iterations) gives us the circle with center at -1 and radius 1/4.

### 2 Responses to “Algorithm for Mandelbrot cardioid”

1. [...] I use two methods for determining if a point is in the set. I have explicit formulae for the main cardioid and the period-2 bulb, and I look for periodic orbits using Floyd’s [...]