= Solution
For $z\ne0$, the <complex logarithm> is $\ln z=\ln r+i(\theta+2\pi k)$, where $k\in\mathbb Z$. Consequently
$$
\boxed{\operatorname{Re}\ln z=\frac12\ln(x^2+y^2),\qquad
\operatorname{Im}\ln z=\arg(x+iy)+2\pi k.}
$$
A specified branch chooses one continuous determination of the <complex argument> on an appropriate cut domain. For the usual principal-value convention use the <principal argument> $\operatorname{Arg}(x+iy)\in(-\pi,\pi]$. A formula using only $\arctan(y/x)$ would lose the quadrant information; it is a valid local angle only with the appropriate additive multiple of $\pi$.
Back to article page