Integrate $\int\frac{3x}{x^5+x^4+1}dx$ I have an integral which I solved. But, I am not sure whether my answer is right or not. The integral is $$\int\frac{3x}{x^5+x^4+1}dx$$ My answer $$3\left(-\dfrac{\displaystyle\sum_{\left\{Z:\>Z^3-Z+1=0\right\}}\frac{\left(2Z^2-3Z-1\right)\ln\left(\left|x-Z\right|\right)}{3Z^2-1}}{7}\\+\dfrac{\ln\left(x^2+x+1\right)}{7}-\dfrac{4\arctan\left(\frac{2x+1}{\sqrt{3}}\right)}{7\sqrt{3}}\right)$$
 A: $x^3-x+1= (x-a)(x^2+ax-a^{-1}) $ has a single real root $a=-1.3247$, or
$$a =-\sqrt[3]{\frac{1}2+\frac16\sqrt{\frac{23}3}}-\sqrt[3]{\frac{1}2-\frac16\sqrt{\frac{23}3}}
$$
Then
\begin{align}
&\int\frac{3x}{x^5+x^4+1}dx\\
=& \ \frac17\int
 \frac{3(2x-1)}{x^2+x+1}-\frac{2(3x^2-1)}{x^3-x+1} + \frac{9x+1}{(x-a)(x^2+ax-a^{-1})}\ dx\\
=& \ \frac17\bigg(\ln\frac{(x^2+x+1)^3}{(x^3-x+1)^2}
-\frac {9a^2+a}{2a-3}\ln\frac{x-a}{\sqrt{x^2+ax-a^{-1}}}\\
& \ \>\>\>\>\>-{4\sqrt3}\tan^{-1}\frac{2x+1}{\sqrt{3}}
 +\frac{3(a^2-3a+9)}{(2a-3)\sqrt{3a^2-4}}\tan^{-1}\frac{2x+a}{\sqrt{3a^2-4}}\bigg)+ C
\end{align}
A: Maple agrees with your answer, except that  $\ln(|x-Z|)$ is replaced by $\ln(x-Z)$.  Maple does this because Maple considers $x$ to be a complex variable.  Two out of three of your zeros $Z$ are complex numbers anyway, so $\ln(|x-Z|)$ would be wrong even if $x$ is a real variable.

A simpler example.  Factor $(x^2+1) = (x+i)(x-i)$, then
apply partial fractions:
$$
\int \frac{dx}{x^2+1} = 
\int\left(\frac{i}{2}\;\frac{1}{x+i}-
\frac{i}{2}\;\frac{1}{x-i}\right) dx ,
$$
which is questionably equal to
$$
A(x):=\frac{i}{2}\ln|x+i|-\frac{i}{2}\ln|x-i|+C .
$$
I claim this is wrong.  Assuming $x$ is a real variable, compute the derivative
like this:
$$
\frac{d}{dx}\left(\frac{i}{2}\ln|x+i|\right)
=\frac{i}{4}\frac{d}{dx}\ln\big(|x+i|^2\big)
=\frac{i}{4}\frac{d}{dx}\ln\big(x^2+1\big)
=\frac{ix}{2(x^2+1)}
$$
and similarly
$$
\frac{d}{dx}\left(\frac{i}{2}\ln|x-i|\right)
=\frac{ix}{2(x^2+1)}
$$
so that
$$
\frac{d}{dx}\big(A(x)\big) = 0 .
$$
Thus $A(x)$ is not the antiderivative of $1/(x^2+1)$ .
The answer should be
$$
A_1(x) = \frac{i}{2}\ln(x+i)-\frac{i}{2}\ln(x-i)+C
$$
without the absolute values.  Regardless of which branches of the logarithms you choose,
$$
\frac{d}{dx}\big(A_1(x)\big) = \frac{1}{x^2+1} .
$$
In fact, for the principal values of the logs, $A_1(x)$ is real.
