Thank you Ng Chung Tak for an excellent answer. I am trying to answer the Stack Exchange Mathematics Question, "Help with the indefinite integral $\int \frac{dx}{2x^4 + 3x^2 + 5}$", and I needed to put a few more steps into the answer to make it clear how you go from line to line. Otherwise, the answer does not makes sense to me, and I think also that a broader audience needs to be able to reference the results step-by-step since these answers are addressing new ground of how to compute the natural logarithm of a complex number in its simplest form.
In the process of answering that question, the difficult situation of "Taking the Inverse Tangent of a Complex Number" addressed here comes in to play, since the integrals involve $\int{\frac{1}{x^2+a^2}}$ where $a^2$ is a complex number, with two solutions for $x$, namely $x^2=(x^2)_+$ and $x^2=(x^2)_-$.
There are some conventions where
$\int{\frac{1}{x}} = ln (x)$ is only defined for $x>0$. If $x$ is a complex number, this creates a problem, since the equality greater than zero is hard to define for a complex number. Other conventions have $\int{\frac{1}{x}} =
ln (\left\lvert x \right\rvert)$. This answer provides a route for finding $\tan^{-1} z$ when $z<0$, as the final result does not depend on an absolute value of $z$. Indeed, it is well-know that $\tan(\pi)=-1$ so
$\tan^{-1} (-1) = \pi = \frac{i}{2}ln\frac{1+z}{1-z}$ so $-{2 \pi}i=ln\frac{1+z}{1-z}$ and
$1=\frac{1+z}{1-z}$ and $z=0$.
Since I am just providing some editing so I can understand your text, I am attempting to block-quote your contribution as well as the small edits going from step-to-step. Thank you for your help and insight!
Unfortunately, block quoting of the equations is not formatting correctly. So I will convey the quote start and finish as thus:
Beginning of Quote of Ng Chung Tak's Answer with Minor Step-by-Step Edits
A useful trick: $\frac{a}{b}=\frac{c}{d} \iff \frac{a+b}{a-b}=\frac{c+d}{c-d}$
\begin{align*}
\tan w &= \frac{\sin \theta}{\cos \theta} \\
\sin \theta &= \frac{1}{2}(e^{(i \theta)}
-e^{(i \theta)}) \\
\cos \theta &= \frac{1}{2}(e^{(i \theta)}
+e^{(i \theta)}) \\
i\tan w = i \frac{\sin \theta}{\cos \theta}
&= \frac{e^{iw}-e^{-iw}}{e^{iw}+e^{-iw}} \\
z=\tan \theta \underset{implies}{\implies}
i z = i \tan \theta =
\frac{iz}{1} &= \frac{e^{iw}-e^{-iw}}{e^{iw}+e^{-iw}} \\
1+iz=\frac{e^{iw}-e^{-iw}}{e^{iw}+e^{-iw}}+1
&= \frac{2*e^{iw}}{e^{iw}+e^{-iw}} \\
1-iz=-\frac{e^{iw}-e^{-iw}}{e^{iw}+e^{-iw}}+1
=\frac{-e^{iw}+e^{-iw}}{e^{iw}+e^{-iw}}+1
&= \frac{2*e^{-iw}}{e^{iw}+e^{-iw}} \\
\frac{1+iz}{1-iz} &= \frac{e^{iw}}{e^{-iw}} \\
e^{2iw} &= \frac{1+iz}{1-iz} \\
2iw &= \ln \frac{1+iz}{1-iz} \\
w &= \frac{1}{2i} \ln \frac{1+iz}{1-iz} \\
&= \frac{i}{2} \ln \frac{1-iz}{1+iz} \\
\tan^{-1} z &= \frac{i}{2} \ln \frac{i+z}{i-z}
\end{align*}
Finish of Quote of Ng Chung Tak's Answer with Minor Step-by-Step Edits