16.17 Problem number 405

\[ \int \frac {x^2 \left (c+d x+e x^2+f x^3+g x^4+h x^5\right )}{a+b x^3} \, dx \]

Optimal antiderivative \[ \frac {\left (-a g +b d \right ) x}{b^{2}}+\frac {\left (-a h +b e \right ) x^{2}}{2 b^{2}}+\frac {f \,x^{3}}{3 b}+\frac {g \,x^{4}}{4 b}+\frac {h \,x^{5}}{5 b}-\frac {a^{\frac {1}{3}} \left (b^{\frac {1}{3}} \left (-a g +b d \right )-a^{\frac {1}{3}} \left (-a h +b e \right )\right ) \ln \! \left (a^{\frac {1}{3}}+b^{\frac {1}{3}} x \right )}{3 b^{\frac {8}{3}}}+\frac {a^{\frac {1}{3}} \left (b^{\frac {1}{3}} \left (-a g +b d \right )-a^{\frac {1}{3}} \left (-a h +b e \right )\right ) \ln \! \left (a^{\frac {2}{3}}-a^{\frac {1}{3}} b^{\frac {1}{3}} x +b^{\frac {2}{3}} x^{2}\right )}{6 b^{\frac {8}{3}}}+\frac {\left (-a f +b c \right ) \ln \! \left (b \,x^{3}+a \right )}{3 b^{2}}+\frac {a^{\frac {1}{3}} \left (b^{\frac {4}{3}} d +a^{\frac {1}{3}} b e -a \,b^{\frac {1}{3}} g -a^{\frac {4}{3}} h \right ) \arctan \! \left (\frac {\left (a^{\frac {1}{3}}-2 b^{\frac {1}{3}} x \right ) \sqrt {3}}{3 a^{\frac {1}{3}}}\right ) \sqrt {3}}{3 b^{\frac {8}{3}}} \]

command

integrate(x**2*(h*x**5+g*x**4+f*x**3+e*x**2+d*x+c)/(b*x**3+a),x)

Sympy 1.10.1 under Python 3.10.4 output

\[ \text {Timed out} \]

Sympy 1.8 under Python 3.8.8 output

\[ x^{2} \left (- \frac {a h}{2 b^{2}} + \frac {e}{2 b}\right ) + x \left (- \frac {a g}{b^{2}} + \frac {d}{b}\right ) + \operatorname {RootSum} {\left (27 t^{3} b^{8} + t^{2} \left (27 a b^{6} f - 27 b^{7} c\right ) + t \left (9 a^{3} b^{3} g h - 9 a^{2} b^{4} d h - 9 a^{2} b^{4} e g + 9 a^{2} b^{4} f^{2} - 18 a b^{5} c f + 9 a b^{5} d e + 9 b^{6} c^{2}\right ) + a^{5} h^{3} - 3 a^{4} b e h^{2} + 3 a^{4} b f g h - a^{4} b g^{3} - 3 a^{3} b^{2} c g h - 3 a^{3} b^{2} d f h + 3 a^{3} b^{2} d g^{2} + 3 a^{3} b^{2} e^{2} h - 3 a^{3} b^{2} e f g + a^{3} b^{2} f^{3} + 3 a^{2} b^{3} c d h + 3 a^{2} b^{3} c e g - 3 a^{2} b^{3} c f^{2} - 3 a^{2} b^{3} d^{2} g + 3 a^{2} b^{3} d e f - a^{2} b^{3} e^{3} + 3 a b^{4} c^{2} f - 3 a b^{4} c d e + a b^{4} d^{3} - b^{5} c^{3}, \left ( t \mapsto t \log {\left (x + \frac {9 t^{2} a b^{5} h - 9 t^{2} b^{6} e + 6 t a^{2} b^{3} f h + 3 t a^{2} b^{3} g^{2} - 6 t a b^{4} c h - 6 t a b^{4} d g - 6 t a b^{4} e f + 6 t b^{5} c e + 3 t b^{5} d^{2} + 2 a^{4} g h^{2} - 2 a^{3} b d h^{2} - 4 a^{3} b e g h + a^{3} b f^{2} h + a^{3} b f g^{2} - 2 a^{2} b^{2} c f h - a^{2} b^{2} c g^{2} + 4 a^{2} b^{2} d e h - 2 a^{2} b^{2} d f g + 2 a^{2} b^{2} e^{2} g - a^{2} b^{2} e f^{2} + a b^{3} c^{2} h + 2 a b^{3} c d g + 2 a b^{3} c e f + a b^{3} d^{2} f - 2 a b^{3} d e^{2} - b^{4} c^{2} e - b^{4} c d^{2}}{a^{4} h^{3} - 3 a^{3} b e h^{2} + a^{3} b g^{3} - 3 a^{2} b^{2} d g^{2} + 3 a^{2} b^{2} e^{2} h + 3 a b^{3} d^{2} g - a b^{3} e^{3} - b^{4} d^{3}} \right )} \right )\right )} + \frac {f x^{3}}{3 b} + \frac {g x^{4}}{4 b} + \frac {h x^{5}}{5 b} \]