\[ \int \frac {e^{-4+2 e^x+2 x+4 x^2} (3-3 x)+2 x-x^2-2 e^x x^2-9 x^3+\left (-3 e^{-4+2 e^x+2 x+4 x^2}-x^2\right ) \log \left (e^{4-2 e^x-2 x-4 x^2} \left (3 e^{-4+2 e^x+2 x+4 x^2}+x^2\right )\right )}{3 e^{-4+2 e^x+3 x+4 x^2}+e^x x^2} \, dx \]
Optimal antiderivative \[ \left (\ln \! \left (x^{2} {\mathrm e}^{-2 x \left (2 x -\frac {2}{x}\right )-2 x -2 \,{\mathrm e}^{x}}+3\right )+x \right ) {\mathrm e}^{-x} \]
command
integrate(((-3*exp(exp(x)+2*x**2+x-2)**2-x**2)*ln((3*exp(exp(x)+2*x**2+x-2)**2+x**2)/exp(exp(x)+2*x**2+x-2)**2)+(-3*x+3)*exp(exp(x)+2*x**2+x-2)**2-2*exp(x)*x**2-9*x**3-x**2+2*x)/(3*exp(x)*exp(exp(x)+2*x**2+x-2)**2+exp(x)*x**2),x)
Sympy 1.10.1 under Python 3.10.4 output
\[ \text {Timed out} \]
Sympy 1.8 under Python 3.8.8 output
\[ x e^{- x} + e^{- x} \log {\left (\left (x^{2} + 3 e^{4 x^{2} + 2 x + 2 e^{x} - 4}\right ) e^{- 4 x^{2} - 2 x - 2 e^{x} + 4} \right )} \]