\[ \int \frac {\left (6 x+12 x^2+4 x^3\right ) \log ^2(3 x)+e^{\frac {2 \left (-x^2+x^3\right )}{\log (3 x)}} \left (6 x^2+2 x^3-6 x^4-2 x^5+\left (-12 x^2+2 x^3+20 x^4+6 x^5\right ) \log (3 x)+\left (3+8 x+3 x^2\right ) \log ^2(3 x)\right )}{\log ^2(3 x)} \, dx \]
Optimal antiderivative \[ \left (x^{2}+x \,{\mathrm e}^{\frac {2 x \left (x^{2}-x \right )}{\ln \left (3 x \right )}}\right ) \left (\left (2+x \right )^{2}-1\right ) \]
command
integrate((((3*x**2+8*x+3)*ln(3*x)**2+(6*x**5+20*x**4+2*x**3-12*x**2)*ln(3*x)-2*x**5-6*x**4+2*x**3+6*x**2)*exp((x**3-x**2)/ln(3*x))**2+(4*x**3+12*x**2+6*x)*ln(3*x)**2)/ln(3*x)**2,x)
Sympy 1.10.1 under Python 3.10.4 output
\[ \text {Exception raised: TypeError} \]
Sympy 1.8 under Python 3.8.8 output
\[ x^{4} + 4 x^{3} + 3 x^{2} + \left (x^{3} + 4 x^{2} + 3 x\right ) e^{\frac {2 \left (x^{3} - x^{2}\right )}{\log {\left (3 x \right )}}} \]