<s>[INST] Two strange integrals I was asked to solve the two integrals
$$
\int\frac{1}{x^2e^{1/x}-x}dx
$$
$$
\int\frac{x^2+1}{x^3-x^2+x+1}dx
$$
I think the first one is not soluble with the known methods of calculus and the second one is involved with complex roots of cubic equation.
Any improvements appreciated.
Thanks.
 [/INST] *

*For the integral

$$
\int\frac{x^2+1}{x^3-x^2+x+1}dx
$$
note that the cubic polynomial in the denominator has one real root $r= -0.5437$ and a pair of complex roots, which allows the factorization
$$x^3-x^2+x+1= (x-r)(x^2+(r-1)x-1/r)
$$
Then, decompose the integrand as
\begin{align}
\frac{x^2+1}{x^3-x^2+x+1}=\frac{A}{x-r}+\frac{Bx+C}{x^2+(r-1)x-1/r}
\end{align}
and integrate accordingly.


*For the integral
$$
\int\frac{1}{x^2e^{1/x}-x}dx
\overset{x\to\frac1x}=-\int \frac1{e^x-x}dx
=-\sum_{k\ge0}  \int x^ke^{-(k+1)x}dx
$$
where each term can be integrated separately.
</s>