Tetration fractal algorithm

105 Views Asked by At

In the code example at http://code.activestate.com/recipes/577917-tetration-fractal/ the author seems to implement the operation of a complex number, $z=x+iy$, raised to the power of itself, $z^z$, as $$ z^z = e^{-\pi y / 2}\left(\cos\frac{\pi x}{2} + i\sin\frac{\pi x}{2}\right). $$ In my own implementation, I expressed $z = re^{i\theta}$ and got: $$ z^z = \left(r^xe^{-y\theta}\right)\left[\cos(\theta x + y\ln r) + i\sin(\theta x + y\ln r)\right]. $$ How can these possibly be the same thing?