<s>[INST] How to find $\int{\frac{\sqrt{x^2+1}}{x+2}dx}$ I have got such integral $$\int{\frac{\sqrt{x^2+1}}{x+2}dx}$$ and with Maple I got something like this:
$$\int\frac{1}{2} + \frac{1+3u^2+4u^3}{-2u^2+2u^4-8u^3}du$$ And I want to know how to achive this changes.
I tried to use WolframAlpha, but there is scarier solution. This integral was for Gaussian quadrature method, so it's analytic solution is horrible.
 [/INST] \begin{align}
&\int{\frac{\sqrt{x^2+1}}{x+2}dx}\\
= &\int \frac{{(x^2-4)+5}}{(x+2)\sqrt{x^2+1}}dx
= \int \frac{x-2}{\sqrt{x^2+1}} +\frac{5}{(x+2)\sqrt{x^2+1}}\ dx\\
=&\ \sqrt{x^2+1}-2\sinh^{-1}x+\sqrt5\tanh^{-1}\frac{2x-1}{\sqrt{5(x^2+1)}}+C
\end{align}
</s>