<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] *

*We can use the Euler substitution $t=\sqrt{x^{2}+1}-x$ to obtain a rational fraction in terms of $t$ 
$$\begin{eqnarray*}
I =\int \frac{\sqrt{x^{2}+1}}{x+2}\mathrm{d}x=\frac{1}{2}\int \frac{1+2t^{2}+t^{4}}{t^{2}\left( -1+t^{2}-4t\right) }\mathrm{d}t.
\end{eqnarray*}$$

*Since  the integrand is a rational fraction, we can expand it into partial fractions and integrate each fraction.
$$\begin{equation*}
\frac{1+2t^{2}+t^{4}}{t^{2}\left( -1+t^{2}-4t\right) }=1-\frac{1}{t^{2}}+
\frac{4}{t}+\frac{20}{t^{2}-4t-1}.
\end{equation*}$$


Added. Detailed evaluation. From $t=\sqrt{x^{2}+1}-x$, we get $x=\dfrac{1-t^{2}}{2t}$ and $\dfrac{dx}{dt}=-\dfrac{t^{2}+1}{2t^{2}}$. So we have
$$\begin{eqnarray*}
I &=&\int \frac{\sqrt{x^{2}+1}}{x+2}\mathrm{d}x=\int \frac{t+\frac{1-t^{2}}{2t}}{\frac{1-t^{2}}{2t}+2}\left( -\frac{t^{2}+1}{2t^{2}}\right) \mathrm{d}t
\\
&=&\frac{1}{2}\int \frac{1+2t^{2}+t^{4}}{t^{2}\left( -1+t^{2}-4t\right) }
\mathrm{d}t.
\end{eqnarray*}$$
Expanding into partial fractions as above, we obtain
$$
\begin{eqnarray*}
2I &=&\int 1-\frac{1}{t^{2}}+\frac{4}{t}+\frac{20}{t^{2}-4t-1}\mathrm{d}t \\
&=&\int 1\mathrm{d}t-\int \frac{1}{t^{2}}\mathrm{d}t+4\int \frac{1}{t}
\mathrm{d}t+20\int \frac{1}{t^{2}-4t-1}\mathrm{d}t \\
&=&t+\frac{1}{t}+4\ln \left\vert t\right\vert -2\sqrt{5}\ln \frac{\sqrt{5}t-2
\sqrt{5}+5}{5-\sqrt{5}t+2\sqrt{5}}+C \\
&=&\sqrt{x^{2}+1}-x+\frac{1}{\sqrt{x^{2}+1}-x}+4\ln \left( \sqrt{x^{2}+1}
-x\right)  \\
&&-2\sqrt{5}\ln \frac{\sqrt{5}\left( \sqrt{x^{2}+1}-x\right) -2\sqrt{5}+5}{5-\sqrt{5}\left( \sqrt{x^{2}+1}-x\right) +2\sqrt{5}}+C.
\end{eqnarray*}$$
Therefore the given integral is
$$\begin{eqnarray*}
I &=&\frac{1}{2}\left( \sqrt{x^{2}+1}-x\right) +\frac{1}{2}\frac{1}{\sqrt{
x^{2}+1}-x}+2\ln \left( \sqrt{x^{2}+1}-x\right)  \\
&&-\sqrt{5}\ln \frac{\sqrt{5}\left( \sqrt{x^{2}+1}-x\right) -2\sqrt{5}+5}{5-\sqrt{5}\left( \sqrt{x^{2}+1}-x\right) +2\sqrt{5}}+C.
\end{eqnarray*}$$
</s>