Evaluate $$\int \frac{x^7+2}{(x^2+x+1)^2} \ dx$$
This problem is from G N Berman, no. 2056 (integrate using ostrogradsky's method). I referred to this question as well as this article but I could neither understand the method nor come up with a solution for this integral. Resorting to standard long division is very tedious and messy, so i refrained from doing that.
Any hints/solutions on solving this are appreciated.
Standard long division is not really that bad. I got $$\int (x^3-2x^2+x+2-\frac{4x^3+6x^2+5x}{(x^2+x+1)^2})dx$$
Integrate each terms. You can integrate the first four terms to get $\frac{x^4}{4}-\frac{2x^3}{3}+\frac{x^2}{2}+2x$ use Ostrogradsky's method on the last term.
Ostrogradsky's method
Hint after Ostrogradsky's method:
My final solution after the substitution is: