## Fractals from iterating sines

August 23rd, 2013 | Categories: Fractals, general math, mathematica | Tags:

In a recent blog-post, John Cook, considered when series such as the following converged for a given complex number z

z1 = sin(z)
z2 = sin(sin(z))
z3 = sin(sin(sin(z)))

John’s article discussed a theorem that answered the question for a few special cases and this got me thinking: What would the complete set of solutions look like? Since I was halfway through my commute to work and had nothing better to do, I thought I’d find out.

The following Mathematica code considers points in the square portion of the complex plane where both real and imaginary parts range from -8 to 8. If the sequence converges for a particular point, I colour it black.

LaunchKernels[4]; (*Set up for 4 core parallel compute*)
ParallelEvaluate[SetSystemOptions["CatchMachineUnderflow" -> False]];
convTest[z_, tol_, max_] := Module[{list},
list = Quiet[
NestWhileList[Sin[#] &, z, (Abs[#1 - #2] > tol &), 2, max]];
If[
Length[list] < max && NumericQ[list[[-1]]]
, 1, 0]
]
step = 0.005;
extent = 8;
AbsoluteTiming[
data = ParallelMap[convTest[#, 10*10^-4, 1000] &,
Table[x + I y, {y, -extent, extent, step}, {x, -extent, extent,
step}]
, {2}];]
ArrayPlot[data]

I quickly emailed John to tell him of my discovery but on actually getting to work I discovered that the above fractal is actually very well known. There’s even a colour version on Wolfram’s MathWorld site.  Still, it was a fun discovery while it lasted

Other WalkingRandomly posts like this one:

1. How much of this depends on the function being sine and how much of the first n terms of the power series, for n =1, 2, 3, …?

2. Very nice image. I discussed the iterated sine on my blog here

It is always amazing, how simple things can lead to mathematical beauty.