<s>[INST] How to do integral $\int\frac1{x^3+x+1}dx$? I've been stuck by this integral. I only knew that roots of the cubic equation are complex.
Please help me with this. $$\int\frac{dx}{x^3+x+1}$$
 [/INST] Since $x^3+x+1=(x-a)((x-b)^2+c^2)$ with$$\begin{align}a&:=\sqrt[3]{\frac{\sqrt{93}-9}{18}}-\sqrt[3]{\frac{2/3}{\sqrt{93}-9}},\\b&:=\frac{1}{\sqrt[3]{12(\sqrt{93}-9)}}-\sqrt[3]{\frac{\sqrt{93}-9}{144}},\\c&:=\sqrt{3}\left(\frac{1}{\sqrt[3]{12(\sqrt{93}-9)}}+\sqrt[3]{\frac{\sqrt{93}-9}{144}}\right),\end{align}$$the integrand is as follows (double-check my partial fractions):$$\frac{1}{(x-a)((x-b)^2+c^2)}=\frac{1}{(b-a)^2+C^2}\left(\frac{1}{x-a}+\frac{(b-a)-(x-b)}{(x-b)^2+c^2}\right).$$So the most general antiderivative is$$\frac{1}{(b-a)^2+C^2}\left(\ln\frac{|x-a|}{\sqrt{(x-b)^2+c^2}}+\frac{b-a}{c}\arctan\frac{x-b}{c}\right)+C,$$where the locally constant function $C$ can have different values either side of $x=a$.
</s>