# Why does the Mandelbrot set appear when I use Newton's method to find the inverse of $\tan(z)$?

Why does the Mandelbrot set appear when I use Newton's method to find the inverse of $\tan(z)$

Specifically for the equation $y = \tan(z)$ I use Newton's method ($20$ iterations) to solve $0 = \tan(y) - z$ for $y$, where $y_0 = \tan(z)$ ($y_0$ doesn't seem that important in this case, both $0$ and $z$ worked The resolution was actually just too low to see any differences in the original image. $y_0 = 0$ produces the best results). I didn't expect this to converge for most $z$, but why are there Mandelbrot set shaped regions that did converge?

Here are the results:

To be a bit more explicit:

$f(y) = \tan(y)-z$, where $z$ is the point on the complex plane I am finding an inverse for in $y = \tan(z)$.

The function I am iterating per newtons method is

$$y_{n+1} = y_n - \frac{f(y_n)}{f'(y_n)} = y_n - (\sin(y_n)\cos(y_n)-z\cos^2(y_n))~~~\text{with}~~~y_0 = 0$$

Here is a clearer picture along with a picture generated with the regular equation for the Mandelbrot set, each with 100 iterations.

The $y_{n+1}$ equation above:

The Mandelbrot set, $y_{n+1} = y_{n}^2 + z$:

Coloring: For colors I take the result of each recursion, $y_{100}$, and convert to HSV colors as $H=-\arg(y_{100})+\pi$, $S=1$, $V=\frac{1}{\ln(c|y_{100}| +e)}$, which are then converted to RGB. $c$ was some constant, I think $c=0.1$ in the above images.

Essentially this is domain coloring with cyan indicating the positive real axis, red indicating the negative real axis, yellow/green indicating the positive imaginary axis, and purple indicating the negative imaginary axis. Black indicates the number either went to infinity or was indeterminate.

You'll notice that the sign of my recursion seems to have flipped since the first picture. I'm not quite sure what the cause of that is, but distributing the negative sign in my recursion so

$$y_{n+1} = y_n - \sin(y_n)\cos(y_n)+z\cos^2(y_n)$$

seems to resolve the issue.

Regardless, it is clear that that numbers that result from my recursion are large, while the numbers that result from the Mandelbrot recursion are small.

It seems the fractals occur where $z\approx m\pi$, where $m$ is an integer (besides $0$).

I found something else interesting. If you alter the recursion which gives the Mandelbrot set to be $y_{n+1} = y_{n}^2 - m\pi(z-m\pi)$ then the mandelbrot set appears at the exact location as in the other equation, and is the same size! I would really like to know why.

Here is an example

My $y_{n+1}$ equation:

Modified Mandelbrot equation, $y_{n+1} = y_{n}^2 - m\pi(z-m\pi)$, $m=-1$:

Closely zoomed in you can see the shapes of the two fractals are not entirely the same (unless that's a numerical error). Still, the similarity is striking.

On further inspection the Mandelbrot set (or something like it) appears in a lot more places in this fractal than I initially thought. Just zooming around I can see lots of them.

They appear on all the spindles coming off the colorful area around $z=0$ (the center of the original image).

To the upper left of the big orange blob above the set in the previous image:

And you might have seen this in the earlier images, but the sets on the real axis aren't just at $m\pi$. The big one on the left is the one at $-\pi$. The center one is at about $2.12$, but note that there are a lot of smaller ones as you move to the right. Really it seems like the Mandelbrot-like sets appear for

$$y_{n+1} = y_n - \sin(y_n)\cos^m(y_n)+z^s\cos^t(y_n)$$

Where $m,s,t$ are nonzero integers.

• – Winther Dec 23 '16 at 4:13
• Unfortunately that equation doesn't appear to converge, though I see why it should produce the mandelbrot set if it did. Thanks for the link. I guess I see why Newton's method could produce the mandelbrot set in general, but I'd be interested in knowing why it happens in this case. – Will Bolden Dec 23 '16 at 5:13
• On which basis such an interesting question, with evidence of a lot of work from the asker, should be closed ??? – Jean Marie Dec 23 '16 at 7:42
• Could you be a little more specific about your iteration procedure? What is your stopping criterion, for example? How do you determine shades and colors? – Mark McClure Dec 23 '16 at 15:34
• Do you know the coordinates of the little Mandelbrot sets in your first image? A Taylor expansion of the recursion around those points might reveal something. – user856 Dec 23 '16 at 21:58

There are two research papers worth looking at to get a general idea of what's going on:

Both of these papers make it clear that close copies of the Mandelbrot set often appear in the bifurcation locus for a parametrized family of holomorphic functions. While the focus is on rational families of functions, many of the results extend to transcendental families when properly restricted. So, first, let's try to make it clear how it is that a parametrized family arises in your context. You're trying to invert the tangent function. That is, given a complex number $c$, you want to solve $$\tan(z)=c$$ and you want to do so using Newton's method. Put another way, you want the roots of $f(z)=\tan(z)-c$. Thus, the corresponding Newton's method iteration function is $$N_c(z)= z-f(z)/f'(z) = z-\sin (z) \cos (z) + c \cos ^2(z).$$ This is exactly what we mean by a parametrized family; each $N_c$ is a function of $z$ that also depends upon the parameter $c$.

Next, what exactly do we mean by the bifurcation locus $B(F_c)$ of a parametrized family $F_c$? This is defined in the first paper above as the set of all complex parameters $c$ such that the number of attracting cycles of $F_c$ is not locally constant. For the now classic family $F_c(z)=z^2+c$, this results in the boundary of the Mandelbrot set. For points on the boundary of the Mandelbrot set, there are $c$ values nearby but in the exterior such that $F_c$ has only the point at $\infty$ as an attracting cycle. But there are also points nearby in the interior which have a finite attracting cycle. There are two other characterizations of the bifurcation locus given in the paper but I think that this is the simplest.

Now, how do we plot a bifurcation locus for a more general family? A standard technique is to compute the orbit of a critical point under iteration of $F_c$ for each $c$ chosen from a grid of values and then shade the point $c$ according to the type of periodicity found. Often, this involves some escape criteria but, as we move from $z^2+c$ to more general types of functions, a bit of analysis is sometimes necessary.

Unfortunately, your family isn't quite "polynomial-like". I'm not going to worry about the precise definition here as it's easy to see what the problem is by examining some iterates. In fact, to motivate the next step, let's examine the orbit of the point $z_0=0$ under iteration of $N_{\pi}$. As the $c$ and $z_0$ are both real, we can do so with a cobweb plot:

The orbit is clearly unbounded yet a mini-Mandelbrot appears in your picture at $c=\pi$; thus, it seems we should have some sort of attractive behavior. The picture suggests, though, that perhaps we should just mod out by $2\pi$. That is, we define $$NM_c(z) = N_c(z) \: \text{mod} \, 2\pi$$ and we study the dynamics of $NM_c$ on the strip $0\leq \text{Re}(z) <2\pi$. In fact, this works perfectly, because $$N_c(2\pi) = c+2\pi \: \text{ and } \: N_c'(2\pi) = 0 = N_c'(0).$$ That is, $NM_c$ is continuous and differentiable. Technically, we are iterating on a complex manifold and the dynamics of $N_c$ on $\mathbb C$ are conjugate to $NM_c$ on that manifold.

Taking all this into account, I came up with the following image for the bifurcation locus of $NM_c$ on the strip $0\leq \text{Re}(z) <2\pi$:

This image is obtained as follows: We iterate $NM_c$ from the critical point $z_0=0$ until either the imaginary part of the iterate exceeds in 10 in absolute value or we reach 100 iterates. If the iterate did escape, we shade the point blue-ish based on how fast the iterate escaped. If the iterate did not escape, we shade the point yellow if the iterate converged to a root of $\tan(z)-c$ or black otherwise.

The black region is exactly where we see Mandelbrot like sets and we can use it to find fun Julia sets. The red point shown in the figure lies at $c\approx 3.5613938602255226$. The critical orbit of the corresponding function $NM_c$ is super-attracting with period 4 and it Julia set looks like so:

• Is it just my imagination or is this similar to how the harmonic oscillator is "universal" in physics for equilibrium points? The harmonic oscillator is in a quadratic potential, and this approximates many physical potentials well near a point of stable equilibrium, and thus you get harmonicity for small perturbations around that point. – The_Sympathizer Jan 17 '17 at 2:56

The abstract of the paper The Mandelbrot set is universal by McMullen is:

We show small Mandelbrot sets are dense in the bifurcation locus for any holomorphic family of rational maps.

This is an indication of what may be happening, even if your map is not a rational map.

• – lhf Dec 23 '16 at 22:49
• @MarkMcClure, I have the same feeling but I'll leave the answer there just in case it is useful... I think I've seen something about the Mandelbrot set appearing in Julia sets, but I can't find it now. It's not this: math.stackexchange.com/questions/406275/…. – lhf Dec 24 '16 at 0:54
• What is the distinction exactly? The value of $z$ changes per pixel just like in the Mandelbrot set, wouldn't the boundary be bifurcation locus then? – Will Bolden Dec 24 '16 at 2:36
• @MarkMcClure do you know? – Will Bolden Dec 28 '16 at 20:44

Let's consider the two different iterative equations in play here. The first is (making notation parallel),

$$z_{n+1}=z_n-\sin(z_n) \cdot \cos(z_n)+c_1 \cdot \cos(z_n)^2$$

The second is,

$$z_{n+1}=c_1 \cdot z_n^2+c_2$$

If we draw a cobweb diagram for both of these on the real line for $-c_1=c_2=-\pi \$ we get this,

Since the first graph is periodic with respect to the dynamical line, we see that the recursion relation for the first equation will always approximate the dynamics of this second recursion relation. Essentially we have a parabola shape that repeats periodically and traps dynamics to finite regions. In fact, for any $-c_1=c_2=\pi \cdot n$ will have this approximation. This can be simply proved by Taylor expansion about $z=\pi \cdot n$. For the case of $c_1=c_2=0$, it just so happens that the parabola approximation becomes a flat line.

$$z_{n+1}=z_n^2-m\pi \cdot (z-m\pi)=z_n+c$$ $$\Rightarrow c=-m\pi \cdot (z-m\pi)$$ $$\Rightarrow z=m\pi-\cfrac{c}{m\pi}$$
Thus, in relationship to the standard Mandelbrot set, this Mandelbrot set is the same up to a scaled $c$ constant. Thus, for $m=-1$, the space for the Mandelbrot set will translate $\pi$ to the left, and will be scaled down by $\pi$.
The only thing left to do is check that the Mandelbrot Set for $z_{n+1}=c_1 \cdot z_{n}^2+c_2$ looks like the Mandelbrot Set for $z_{n+1}=z_n^2+c_1 \cdot (c_2+c_1)$ for the appropriate values. We have,
• Thanks for the response, but I don't quite understand. Your $c$ notation is confusing me somewhat. There is no $c_1$ in the original Mandelbrot recurrence, is there a reason you introduced it here? Shouldn't that parabola be pointing down for your choice of constants? As for $z_{n+1}=z_{n}^2 -m\pi (z-m\pi)=z_n+c$ (Did you miss the squared in your response, or was that intentional?) I understand why it looks like and offset and scaled Mandelbrot set, that was my goal in writing it, but I don't understand is why it's boundary is almost identical to the boundary of the first equation. – Will Bolden Dec 24 '16 at 5:27
• I'm not familiar with Cobweb diagrams. From the wikipedia article it sounds like it only tells you about the long term stability of a recurrence. In their example it seems like small changes can have quite a big affect on stability. Why should the equations aproximating eachother near $0$ say anything about long term stability then the cross the diagonal at rather different points? – Will Bolden Dec 24 '16 at 5:33
• @WillBolden Oh my, that's a lot of questions ;) Ok, I fixed up the notation. I wrote this in one go so sadly I forgot to tidy things up. Technically speaking, on the cobweb diagram, the trick I used in the post was that the function is periodic relative to the $y=x$ so it essentially always converges to something. The approximating parabola has dynamics that can diverge. Thus, only in the range that the two functions are close do you get similar dynamics. The range for this just so happens to be wide enough to produce Mandelbrot look alike sets. – Zach466920 Dec 24 '16 at 6:06
• Thanks. But could you clarify what equation 2 is and why you decided to introduce it (and choose $c$ values as you did). The original Mandelbrot recurrence doesn't have that $c_1$ term and it wasn't in my original post. I also just made an edit to the original post pointing out some more places the Mandelbrot set occurs besides $m\pi$. – Will Bolden Dec 24 '16 at 7:51