Why does the Mandelbrot set appear when I use Newton's method to find the inverse of $\tan(z)$?
There are two research papers worth looking at to get a general idea of what's going on:
- The Mandelbrot set is universal (already pointed out by lhf), and
- On the dynamics of polynomial-like mappings.
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:
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.
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.
You also asked about the recurrence relation given by,
$$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,
On a square centered on the origin with side length 2. Looks like the Mandelbrot Set, we're in business. Where I'm assuming it's more intuitively clear why this set is similar in appearance to the Mandelbrot Set. If you have any other questions feel free to ask!