<s>[INST] Compute difficult integral $\int \frac{dx}{2 + x + \sqrt{1 - x^2}}$ To solve the integral
$$I = \int \frac{dx}{2 + x + \sqrt{1 - x^2}}$$
I have tried several things, such as $t = \arcsin x$, because $\cos(\arcsin x) = \sqrt{1 - x^2}$. If I am not wrong, we can conclude with this variable change
$$
I = \int \frac{\cos t\,dt}{2 + \sin t + \cos t}
$$
but if it were correct, how could I go on?
 [/INST] Continue with $x=\sin t$
\begin{align}
&\int \frac{1}{2 + x + \sqrt{1 - x^2}} dx=\int \frac{\cos t}{2 + \sin t + \cos t}dt\\
= &\ \frac12\int \left(1+ \frac{\cos t-\sin t}{2 + \sin t + \cos t}-
\frac{2}{2 + \sin t + \cos t} \right)dt\\
=& \ \frac12t +\frac12 \ln(2 + \sin t + \cos t) -\sqrt2\tan^{-1} \frac{\tan\frac t2+1}{\sqrt2}\\
=&\ \frac12\sin^{-1}x+\frac12 \ln\left(2 + x+ \sqrt{1-x^2}\right) -\sqrt2\tan^{-1} \frac{1+x-\sqrt{1-x^2}}{x \sqrt2}
\end{align}
</s>