TITLE: Complex numbers as exponents
QUESTION [7 upvotes]: Is there any formula to calculate $2^i$ for example? What about $x^z$? I was surfing through different pages and I couldn't seem to find a formula like de Moivre's with $z^x$.

REPLY [8 votes]: By definition, for non-rational exponents,
$$
x^z=e^{z\log(x)}
$$
This definition is fine as far as it goes, but the limitation is on the values of $\log(x)$ for $x\in\mathbb{C}$.  Since $e^{2\pi i}=1$, logarithms, as inverses of the exponential function, are unique up to an integer multiple of $2\pi i$.
Usually, when the base is a positive real number, we use the real value of the logarithm, so
$$
2^i=e^{i\log(2)}=\cos(\log(2))+i\sin(\log(2))
$$
However, if $2$ is viewed as a complex number, we might equally well say
$$
2^i=e^{i\log(2)-2k\pi}=e^{-2k\pi}\cos(\log(2))+ie^{-2k\pi}\sin(\log(2))
$$
for any $k\in\mathbb{Z}$.