<s>[INST] Indefinite integral of $\frac{2x^3 + 5x^2 +2x +2}{(x^2 +2x + 2)(x^2 + 2x - 2)}$ How do I find $$\int\frac{2x^3 + 5x^2 +2x +2}{(x^2 +2x + 2)(x^2 + 2x - 2)}\mathrm dx$$
I used partial fractions by breaking up $x^2 + 2x - 2$ into $(x+1)^2 - 3$ and split it into $(a+b)(a-b)$ but as u can see it's extreme tedious. I was wondering if there is a faster technique to resolve this.
 [/INST] $$\int\frac{2x^3 + 5x^2 +2x +2}{(x^2 +2x + 2)(x^2 + 2x - 2)}\mathrm dx\\
=\int\left(+\frac{2x+2}{2(x^2+2x+2)}+\frac{2x+2}{2(x^2+2x-2)}-\frac1{\frac{(2x+2)^2}4+1}\right)\mathrm dx\\
=\frac12\ln(x^2+2x+2)+\frac12\ln(x^2+2x-2)-\arctan\left(\frac{2x+2}2\right)+\mathbb C$$
</s>