<s>[INST] Find $\int \sqrt{2+\tan x} dx$ I am trying to get the answer $\int \sqrt{2+\tan x} dx$
What I did was to write $2+\tan x$ as $\frac{2\cos x+\sin x}{\cos x}$ but then find no way. Is there any simple form or should I proceed some other way ?
 [/INST] If you enjoy complex numbers, let us do as in the linked post
$$\sqrt{2+\tan (x)}=u^2 \implies x=-\tan ^{-1}\left(2-u^2\right)\implies dx=\frac{2 u}{1+\left(2-u^2\right)^2}\,du$$
$$\int \sqrt{2+\tan (x)}\, dx=\int \frac{2 u^2}{1+\left(2-u^2\right)^2}\,du$$
$$1+\left(2-u^2\right)^2=u^4-4 u^2+5=(u^2-(2-i))(u^2-(2+i))$$ Now, partial fraction decomposition
$$\frac{2 u^2}{1+\left(2-u^2\right)^2}=\frac{1+2 i}{u^2-(2-i)}+\frac{1-2 i}{u^2-(2+i)}$$ where you find almost classical integrals.
$$\int \frac{2 u^2}{1+\left(2-u^2\right)^2}\,du=i \left(\sqrt{-2-i} \tan ^{-1}\left(\frac{u}{\sqrt{-2-i}}\right)-\sqrt{-2+i} \tan
   ^{-1}\left(\frac{u}{\sqrt{-2+i}}\right)\right)$$
</s>