TITLE: Evaluating the indefinite integral $ \int \sqrt{\tan x} ~ \mathrm{d}{x}. $
QUESTION [62 upvotes]: I have been having extreme difficulties with this integral. I would appreciate any and all help.
$$
\int \sqrt{\tan x} ~ \mathrm{d}{x}.
$$

REPLY [2 votes]: Just another way to do it.
$$I=\int\sqrt{\tan x}\,dx = \int\frac{2u^2}{u^4+1}\,du=\int \left(\frac{1}{u^2+a}+\frac{1}{u^2-a} \right)\,du$$ where $a=i$
$$I=\frac 1{\sqrt a}\left(\tan ^{-1}\left(\frac{u}{\sqrt{a}}\right)-\tanh ^{-1}\left(\frac{u}{\sqrt{a}}\right)\right)=-\frac{1-i}{\sqrt{2}}\left(\tan ^{-1}\left((-1)^{3/4} u\right)-\tanh ^{-1}\left((-1)^{3/4} u\right)\right)$$