# Test to determine if a point is inside a cardioid whose cusp is not at the origin

The Mandelbrot set is the set of all complex numbers $$c$$ that cause the function $$z_{n+1} = z_n^2 + c$$ to remain bounded within a circle of radius 2 when iterated from $$z_0 = 0$$. Plotted in the complex plane it includes a main cardioid, formed by rolling a circle of radius $$0.25$$ around another circle of the same radius centered on the origin with its cusp at $$0.25 + 0i$$; and a main bulb, also a circle of radius $$0.25$$, centered on the value $$-1 + 0i$$ and touching the main cardioid at the value $$-0.75 + 0i$$. These two regions are the only regions with well-defined boundaries.

When calculating the Mandelbrot set, in general the only way to be sure a given value of $$c$$ is in the set is to iterate it in the generating function an infinite number of times to see if it remains bounded. Because that is impossible in reality, a large integer is picked as a threshold value, and any points which do not exit the bounding circle within that number of iterations is declared to be part of the set. This means that every point inside the set requires the maximum number of iterations to be performed before moving on to the next value.

To save on calculation time, it helps to have an alternate way to determine if a given value is inside the set. This is easy for the largest circular region: if $$|c + 1| ≤ 0.25$$, $$c$$ is inside the disk and no further calculation is necessary.

Does a similar test exist for the main cardioid? I haven't been able to figure one out. My instinct is to check if the magnitude of $$c$$ is less than some function of the argument of $$c$$, but I can't find a function that works perfectly. The closest I've come is $$\frac{1}{2}(\sin(\frac{φ}{2}))^{3/4} + \frac{1}{4}$$, which is pretty close, but it isn't exact.

The points in the main caridoid are those values of $$c$$ such that there is a fixed point $$z_0$$ with $$|f_c'(z_0)|<1$$. Now, the fixed points are
$$z_{\pm} = \frac{1\pm \sqrt{1-4c}}{2}$$ and $$f'(z)=2z$$ so I guess you need to check if
$$\left|1 + \sqrt{1-4c}\right| \leq 1 \: \text{ or } \: \left|1 - \sqrt{1-4c}\right| \leq 1.$$