$\int\frac{1+x^2}{x^4+3x^3+3x^2-3x+1}dx$ $$\int\frac{1+x^2}{x^4+3x^3+3x^2-3x+1}dx$$
I tried to solve it.
$$\int\frac{1+x^2}{x^4+3x^3+3x^2-3x+1}dx=\int\frac{1+x^2}{(x^2+1)^2+3x^3+x^2-3x+1}dx=\int\frac{1+x^2}{(x^2+1)^2+3x(x^2-1)+x^2+1}dx$$
But this does not seem to be solving.Please help.

First rewrite the integral as
$$\mathcal{I}\stackrel{def}{=}\int \frac{x^2+1}{x^4 + 3x^3 + 3x^2 - 3x + 1} dx
= \int \frac{x+x^{-1}}{(x^2 + x^{-2}) + 3(x - x^{-1}) + 3}\frac{dx}{x}
$$
Using the identity: $\displaystyle\;\frac{dx}{x} = \frac{d(x-x^{-1})}{x+x^{-1}}\;$,
we can change variable to $u = x-x^{-1}$ and get
$$
\mathcal{I} 
= \int\frac{du}{u^2 + 3u + 5} = \int\frac{du}{(u+\frac32)^2 + \frac{11}{4}}
= \sqrt{\frac{4}{11}}
\tan^{-1}\left(\sqrt{\frac{4}{11}}\left(u+\frac32\right)\right) + C\\
= \frac{2}{\sqrt{11}}
\tan^{-1}\left(\frac{2}{\sqrt{11}}\left(x - \frac1x +\frac32\right)\right) + C
$$
for some integration constant $C$.
Update
As pointed out by @Andrei, the expression above is discontinuous at $x = 0$. If one want to use it to compute definite integral, one need to use a different $C$
for the region $x > 0$ and $x < 0$. Let $C_{+}$ and $C_{-}$ be the integration constant for this two regions. Since the integrand is well behaved at $x = 0$,
as a function of $x$, the indefinite integral $\mathcal{I}$ is continuous at $x = 0$. This impose a constraint
$$C_{+} - C_{-} = \frac{2\pi}{\sqrt{11}}$$
and leads to
$$\mathcal{I} = \frac{2}{\sqrt{11}}
\left[ 
\tan^{-1}\left(\frac{2}{\sqrt{11}}\left(x - \frac1x +\frac32\right)\right) +
\Delta(x)
\right] + C'
$$
where
$\displaystyle\;C' = \frac{C_{+} + C_{-}}{2}\;$
 and $\displaystyle\;
\Delta(x) = \begin{cases}+\frac{\pi}{2}, & x > 0\\-\frac{\pi}{2},& x < 0\end{cases}$.
To further simplify this, we use following representation of $\Delta(x)$:
$$\Delta(x) = \tan^{-1}x + \tan^{-1}\frac1x,\quad\text{ for } x \ne 0$$
This leads to
$$\begin{align}
\mathcal{I} 
&= \frac{2}{\sqrt{11}}
\left[ 
\tan^{-1}\left(\frac{2}{\sqrt{11}}\left(x - \frac1x +\frac32\right)\right) +
\tan^{-1}\left(\frac{2}{\sqrt{11}x}\right)
+ \tan^{-1}\left(\frac{\sqrt{11}x}{2}\right)
\right] + C'\\
&= \frac{2}{\sqrt{11}}
\left[
\tan^{-1}\left(\frac{\sqrt{11}x^2(2x+3)}{7x^2-6x+4}\right)
+ \tan^{-1}\left(\frac{\sqrt{11}x}{2}\right)
\right] + C'
\end{align}
$$
An expression of $\mathcal{I}$ which is continuous for all $x$ and one can use to compute definite integral.
