<s>[INST] How to calculate $ \int \frac{x^3+x^2}{x^3-1} \mathrm{d}x$ I was trying to solve this integral:
$$ \int \frac{x^3+x^2}{x^3-1} \mathrm{d}x$$
I made the following steps:


*

*Polynomial division: $$ \frac{x^3+x^2}{x^3-1} = \left(1+\frac{x^2+1}{x^3-1}\right)$$

*Hermite polynomials: $$ \frac{x^2+1}{x^3-1} = \frac{2}{3}\frac{1}{x-1}+\frac{\frac{x}{3}-\frac{1}{3}}{x^2+x+1}$$


So, now the integral becomes: $$x+\frac{2}{3}\log{|x-1|}+\int \dfrac{\frac{x}{3}-\frac{1}{3}}{x^2+x+1} \mathrm{d}x$$
But i think there's something wrong, i can not continue. Any ideas?
 [/INST] Your work is well-done up to the point you ended.
Now we just need to work with the final integral:
$$\int\frac{x^3+x^2}{x^3-1}dx=
x+\frac{2}{3}\log\left|x-1\right|+\frac{1}{3}\int\frac{x-1}{x^2+x+1}dx$$
$$\dfrac 13\int \frac{x - 1}{x^2 + x + 1}dx = \frac 16\int\frac{2x +1}{x^2 + x + 1}dx - \frac 12\int \frac {dx}{x^2 + x + 1} $$ $$= \frac 16\int\frac{2x +1}{x^2 + x + 1}dx - \frac 12\int \frac {dx}{(x+\frac 12)^2 + \frac 34}$$
In the left-most integral in the last line, we have an integral of the form $$ \int \dfrac{f'(x)}{f(x)} \,dx = \ln (f(x)) + C$$
In the right-most integral in the last line, we have "completed the square" and can now use the substitution $\tan\theta = \frac{\sqrt 3}2(x + \frac 12)$.
</s>