Given a complex number $z$, consider the sequence

\begin{align*} a_0 & = 1\\ a_1 & = (cos(1))^z\\ a_n & = (cos(a_{n-1}))^z \end{align*}

This question is about trying to understand periodicity in such sequences. For real $z < 2$, the sequence converges to a fixed point. For larger real $z$, the sequence oscillates between two distinct limit points. This behavior can be explained by elementary dynamics, and one can find that the transition point is around $2.188$.

I was surprised to find that the behavior for general complex $z$ is, well, complex! Define a function $P$ from the complex plane to $\mathbb{N}$ as follows:

$$P(z) = \mathrm{number\ of\ limit\ points\ of\ the\ sequence}\ \{1, cos(1)^z, cos(cos(1)^z)^z, \ldots\}$$

Here is a picture of $P$: this is the region $[-8,8] \times [-8,8]$ and the pixel at $z$ is given color $n$ by some software that estimates $P(z)$.

Black pixels are points where the software cannot detect periodicity. The correspondence between colors and numbers is as follows, where 'Unk' means 'Unknown':

In particular, one can see the behavior along the positive real axis matches the description above. (Although there are no axes in this picture, I have verified separately that the transition point in the picture is correct.) Unfortunately, I have no idea how to explain the rest of the picture! Although I have been careful writing the software, I can't say with certainty that the picture is correct anywhere other than the positive real axis.

This question is in danger of being too general, so here is one
specific question to answer: **Is the cardoid-shaped region colored 1
correct?**

I would, of course, also be happy to hear any other verifications of features in this picture, or other behavior of $P(z)$ not depicted.

## Sin and exp

At the risk of going on too long, I think it's natural to also address a similar question for the sine and exponential functions. Here is the picture for exp:

And the picture for sin is below:

This last one, for the sine function, is even *more* bewildering to
me. There is something that looks very much like a Mandelbrot set
there. Why?

## Motivation

Two of my colleagues were discussing the behavior of cos along the positive real axis on our department mailing list. I was curious about the complex behavior, but this is outside my field, so started making pictures like the ones shown here. I've been thinking about these off and on for a little over a year, but not really made any progress or had anyone give me a useful reference. So I wanted to see what the wider MO community has to say.

If you want some higher-resolution pictures for cos, see this G+ post:

https://plus.google.com/u/0/+NilesJohnson/posts/1JqWahhwGbh

## Notes on the software

The software computes 500 iterates, and then looks at the next 30 iterates. It returns the minimum $n$ such that there are two successive subsequences of length $n$ whose corresponding terms are within $\varepsilon = .001$. If no such $n$ is found, it computes 500 more iterates and tries again. This is repeated 6 times. If no such $n$ is found, the pixel is colored black.

Decreasing $\varepsilon$ by a factor of $10^4$ or so takes longer but does not result in a substantially different picture.