I know how to integrate
$\sqrt{tan}$, using the "classical approach" which I know has been illustrated on another question before. However, I have just recently learnt to factorise using complex numbers and hence wanted to try it out using that. What I have done is essentially :
$$
\sqrt{tanx} = t,\\ tanx = t^2,\\ sec^2xdx =2tdt,\\ dx = \frac{2tdt}{1+ t^4}
$$
This, I reached from the classical way of approaching the sum. Hence my integration has been transformed to:
$\int{\frac{2t^2dt}{1+t^4}}$. Nothing out of the blue, it is after this that I do the following, inspired from a black-pen red pen video. That is : $$ \int{\frac{t^2+i+t^2-i}{(t^2+i)(t^2-i)}}dt \\ = \int{\frac{dt}{t^2+i}+ \int{\frac{dt}{t^2 -i}}} $$ While I Can integrate this, I get an answer that is complex, which is not what I can write in any way as the answer to my original integration which is actually real. Some direction or help with how to approach such concepts would be helpful.
You may recover the real answer by simplify the complex result as follows
\begin{align} & \int{\frac{2t^2}{1+t^4}}dt\\ =& \int{\frac{1}{t^2+i}dt+ \int{\frac{1}{t^2 -i}}} dt\\ =&\ \frac1{\sqrt i}\tan^{-1}\frac t{\sqrt i}+ \frac1{\sqrt {-i}}\tan^{-1}\frac t{\sqrt {-i}}\\ =& \ e^{-i\frac\pi4}\tan^{-1}( e^{-i\frac\pi4} t)+ e^{i\frac\pi4}\tan^{-1}( e^{i\frac\pi4} t)\\ =&\ \frac1{\sqrt2}\left[\tan^{-1}(e^{-i\frac\pi4} t)+\tan^{-1}( e^{i\frac\pi4}t)\right] \\ &\>\>\>\> -i\frac1{\sqrt2}\left[\tan^{-1}(e^{-i\frac\pi4} t)-\tan^{-1}( e^{i\frac\pi4}t)\right] \\ =& \ \frac1{\sqrt2}\tan^{-1}\frac{\sqrt2 t}{1-t^2} -i\frac1{\sqrt2} \tan^{-1}\frac{i\sqrt2 t}{1+t^2}\\ =& \ \frac1{\sqrt2}\tan^{-1}\frac{\sqrt2 t}{1-t^2} -\frac1{\sqrt2} \tanh^{-1}\frac{\sqrt2 t}{1+t^2}\\ \end{align} where the identity $\tan^{-1}a\pm\tan^{-1}b=\tan^{-1}\frac{a\pm b}{1\mp ab}$ is used.