Determine the value of $i^i$ as a real number, where $i = \sqrt{-1}$.
First let's get the "mathematical" answer: we can use Euler's formula, $e^{ix} = \cos x + i\sin x$ with $x=\pi/2$ to obtain $e^{i\pi/2} = i$. Therefore, $$i^i = e^{i^2\pi/2} = e^{-\pi/2} = 0.207879576\cdots.$$ This is the principal value: $i^i$ is multi-valued and in general $$i^i = e^{-\pi/2 + 2n\pi}, \;\; n=0,1,2,\cdots.$$
In the Python shell, the principal value is returned as a complex number object even though the answer is real:
>>> 1j**1j
(0.20787957635076193+0j)
but we can get the real part as a float
by accessing its real
attribute:
>>> (1j**1j).real
0.20787957635076193