I saw the following problem $$ \int \frac{3x^5 -x^4 +2x^3 -12x^2-2x+1}{(x^3-1)^2} dx$$
I tried to solve it by partial fractions and after 7 pages of a lot of calculations I was able to prove that $ \frac{3x^5 -x^4 +2x^3 -12x^2-2x+1}{(x^3-1)^2} =\frac{2x+1}{x^2+x+1}+ 2\frac{2x+1}{(x^2+x+1)^2} +\frac{1}{x-1}- \frac{1}{(x-1)^2}$ which is easy to integrate, even wolfram alpha don't show how to turn $ \frac{3x^5 -x^4 +2x^3 -12x^2-2x+1}{(x^3-1)^2} $ into partial fractions and give a message "possible intermediate steps "
I want to know if there is an easy solution to this integral? I believe there must be an easy way to solve this without partial fractions.
EDIT: here is my work
$$ \color{red}{\text{WARNING: THIS IS AN UGLY SOLUTION}}$$
$$\frac{3x^5 -x^4 +2x^3 -12x^2-2x+1}{(x^3-1)^2}=\frac{a}{x-1}+ \frac{b}{(x-1)^2}+ \frac{cx+d}{x^2+x+1}+ \frac{ex+f}{(x^2+x+1)^2} $$
$b$ is easy to find (multiply both side by $(x-1)^2$ then substitute $x=1$ you will find $b=-1$ ) now I will try to find $a$
$$\frac{3x^5 -x^4 +2x^3 -12x^2-2x+1}{(x^3-1)^2}=\frac{a}{x-1}- \frac{1}{(x-1)^2}+ \frac{cx+d}{x^2+x+1}+ \frac{ex+f}{(x^2+x+1)^2} $$ here I multiplied both sides by $(x-1)$ and then I added $\frac{3x^5 -x^4 +2x^3 -12x^2-2x+1}{(x^2+x+1)^2 (x-1) } + \frac{1}{(x-1)}$ and then $$\frac{3x^5 +4x^3-9x^2+2}{(x^2+x+1)^2 (x-1) } =a + (x-1) \left(\frac{cx+d}{x^2+x+1}+ \frac{ex+f}{(x^2+x+1)^2}\right)$$ then I used division to show $\frac{3x^5 +4x^3-9x^2+2}{(x^2+x+1)^2 (x-1) } = \frac{3x^4+3x^3+7x^2 -2x -2}{(x^2+x+1)^2}$ and I substituted $x=1$ and got $a=1$ so
$$\frac{3x^5 -x^4 +2x^3 -12x^2-2x+1}{(x^3-1)^2}=\frac{1}{x-1}- \frac{1}{(x-1)^2}+ \frac{cx+d}{x^2+x+1}+ \frac{ex+f}{(x^2+x+1)^2} $$
here I used complex numbers let $w :=-\frac{1}{2} +\frac{\sqrt{3}}{2}i $ and $w^2 :=-\frac{1}{2} -\frac{\sqrt{3}}{2}i $ note that $w,w^2$ are roots for $x^2+x+1$ now $e,f$ are easy to find just like $b$ ie I multiplied both sides by $(x^2+x+1)^2$ and substituted $x=w$ after some calculation I found $4w^2+2w =ew^2+fw$ then $e=4 \ , \ f=2 $
$$\frac{3x^5 -x^4 +2x^3 -12x^2-2x+1}{(x^3-1)^2}=\frac{1}{x-1}- \frac{1}{(x-1)^2}+ \frac{cx+d}{x^2+x+1}+ \frac{4x+2}{(x^2+x+1)^2} $$
for $c,d$ I would find then just like how I found $a$ i.e I multiplied multiply both sides by $x^2+x+1$ and add $\frac{3x^5 -x^4 +2x^3 -12x^2-2x+1}{(x-1)^2 (x^2+x+1)} - \frac{4x+2}{(x^2+x+1)} $ and I used division to find that $\frac{3x^5 -x^4 -2x^3 -6x^2-2x+1}{(x-1)^2 (x^2+x+1)}= \frac{3x^3-4x^2-x-1}{(x-1)^2}$ then I substituted $x=w$ then $c=2 \ , \ d=1$
so $$\frac{3x^5 -x^4 +2x^3 -12x^2-2x+1}{(x^3-1)^2}=\frac{1}{x-1}- \frac{1}{(x-1)^2}+ \frac{2x+1}{x^2+x+1}+ \frac{4x+2}{(x^2+x+1)^2} $$
then $$ \int\frac{3x^5 -x^4 +2x^3 -12x^2-2x+1}{(x^3-1)^2}dx=\ln({x-1})+ \frac{1}{(x-1)}+ \ln({x^2+x+1}) -2\frac{1}{(x^2+x+1)} +C $$
EDIT
in the steps that I used division it would be better if I used l'hospital rule as $x \to k$ ($k=1$ when I wanted to find $a$ and $k=w$ when I wanted to find $c,d$) and rely on the fact that the function is continuous
I tried to remove one term such that $$\frac{3x^5 -x^4 +2x^3 -12x^2-2x+1}{(x^3-1)^2}=\frac{Q(x)}{(x^3-1)^2}+\frac{P(x)}{(x^3-1)}$$ such that $P(x)$ be a quadratic in $x$ $$P(x)=a+b x+c x^2$$
Removing the denominator and grouping $$(-a-b c+1)-2 x-(c+12) x^2+x^3 (a+b c+2)-x^4+(c+3) x^5=0$$ So, $c=-3$ seems to be an idea.
Replacing $$(-a+3 b+1)-2 x-9 x^2+x^3 (a-3 b+2)-x^4=0$$ and we cannot do more. So
$$\frac{3x^5 -x^4 +2x^3 -12x^2-2x+1}{(x^3-1)^2}=-\frac{x^4-2 x^3+9 x^2+2 x-1}{\left(x^3-1\right)^2}-\color{red}{\frac{3x^2}{x^3-1}}$$
Now, partial fraction decomposition $$\frac{x^4-2 x^3+9 x^2+2 x-1}{\left(x^3-1\right)^2}=\frac{1}{(x-1)^2}-2\color{red}{\frac{2 x+1}{\left(x^2+x+1\right)^2}}$$ which is now very simple since $\cdots ???$ (fill the blanks).
Thsi was not a difficult integral.