How calculate the indefinite integral $\int\frac{1}{x^3+x+1}dx$
Solution 1:
Starting with the root from my previous comment, $$a=-\frac2{\sqrt3}\sinh\left(\frac13\sinh^{-1}\frac{3\sqrt3}2\right)$$ We can factor the denominator as $x^3+x+1=(x-a)(x^2+ax+a^2+1)$. Then the partial fractions expansion reads $$\frac1{x^3+x+1}=\frac{A}{x-a}+\frac{Bx+C}{x^2+ax+a^2+1}$$ We can find $A$ by multiplying both sides by $(x-a)$ and taking the limit: $$A=\lim_{x\rightarrow a}\frac{x-a}{x^3+x+1}=\frac1{3a^2+1}$$ by L'Hopital's rule. If we observe that $$\begin{align}\left(3a^2+1\right)\left(6a^2-9a+4\right) & =\left(18a-27\right)\left(a^3+a+1\right)+31 \\ & =31\end{align}$$ It follows that $$A=\frac{6a^2-9a+4}{31}$$ Then if we multiply through by $(x^3+x+1)$ and compare coefficients of like powers of $x$ we find that $$\begin{align}B & =\frac{-6a^2+9a-4}{31} \\ C & =\frac{18a^2+4a+12}{31}\end{align}$$ So $$\begin{align}\frac1{x^3+x+1} & =\frac1{31}\left\{\frac{6a^2-9a+4}{x-a}+\frac{-\left(6a^2-9a+4\right)x+18a^2+4a+12}{x^2+ax+a^2+1}\right\} \\ & =\frac1{31}\left\{\frac{6a^2-9a+4}{x-a}+\frac{\left(-3a^2+\frac92a-2\right)(2x+a)+\frac{27}2a^2+3a+9}{x^2+ax+a^2+1}\right\}\end{align}$$ Now all our integrals are elementary and we find $$\int\frac1{x^3+x+1}dx=\frac1{31}\left\{\left(6a^2-9a+4\right)\ln|x-a|-\left(3a^2-\frac92a+2\right)\ln\left(x^2+ax+a^2+1\right)+\frac{\left(27a^2+6a+18\right)}{\sqrt{3a^2+4}}\tan^{-1}\left(\frac{2x+a}{\sqrt{3a^2+4}}\right)\right\}+C$$ Numerical integration confirms this result.