<s>[INST] $\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.
 [/INST] Writing the polynomial $x^4+3x^3+3x^2-3x+1$ as a product of two polynomials of degree two, i.e,. $$x^4+3x^3+3x^2-3x+1= (x^2+Ax+B)(x^2+Cx+D)$$, then we will get 4 equations $A+C=3,B+D+AC=3,AD+BC=-3,BD=1$, using wolframalpha.com to solve this eqs. we get 
Thus, $$\int{\frac{1+x^2}{x^4+3x^3+3x^2-3x+1}dx}=\int{\frac{1+x^2}{(x^2+Ax+B)(x^2+Cx+D)}dx}$$
Using partial fraction, we get $$\frac{1+x^2}{(x^2+Ax+B)(x^2+Cx+D)}=\frac{Px+Q}{x^2+Ax+B}+\frac{Tx+S}{x^2+Cx+D}$$
Solving for $P,Q,T$ and $S$ ...etc
Therefore, 
$$\int{\frac{1+x^2}{(x^2+Ax+B)(x^2+Cx+D)}dx}=\int{\frac{Px+Q}{x^2+Ax+B}dx}+\int{\frac{Tx+S}{x^2+Cx+D}dx}=\text{constant}_1 \ln|x^2+Ax+B|+\text{constant}_2 \ln|x^2+Cx+D|+ CONSTANT$$
</s>