\[ \int \frac {(A+B x) \left (a^2+2 a b x+b^2 x^2\right )^2}{(d+e x)^5} \, dx \]
Optimal antiderivative \[ \frac {b^{4} B x}{e^{5}}+\frac {\left (-a e +b d \right )^{4} \left (-A e +B d \right )}{4 e^{6} \left (e x +d \right )^{4}}-\frac {\left (-a e +b d \right )^{3} \left (-4 A b e -B a e +5 B b d \right )}{3 e^{6} \left (e x +d \right )^{3}}+\frac {b \left (-a e +b d \right )^{2} \left (-3 A b e -2 B a e +5 B b d \right )}{e^{6} \left (e x +d \right )^{2}}-\frac {2 b^{2} \left (-a e +b d \right ) \left (-2 A b e -3 B a e +5 B b d \right )}{e^{6} \left (e x +d \right )}-\frac {b^{3} \left (-A b e -4 B a e +5 B b d \right ) \ln \! \left (e x +d \right )}{e^{6}} \]
command
integrate((B*x+A)*(b**2*x**2+2*a*b*x+a**2)**2/(e*x+d)**5,x)
Sympy 1.10.1 under Python 3.10.4 output
\[ \text {Timed out} \]
Sympy 1.8 under Python 3.8.8 output
\[ \frac {B b^{4} x}{e^{5}} + \frac {b^{3} \left (A b e + 4 B a e - 5 B b d\right ) \log {\left (d + e x \right )}}{e^{6}} + \frac {- 3 A a^{4} e^{5} - 4 A a^{3} b d e^{4} - 6 A a^{2} b^{2} d^{2} e^{3} - 12 A a b^{3} d^{3} e^{2} + 25 A b^{4} d^{4} e - B a^{4} d e^{4} - 4 B a^{3} b d^{2} e^{3} - 18 B a^{2} b^{2} d^{3} e^{2} + 100 B a b^{3} d^{4} e - 77 B b^{4} d^{5} + x^{3} \left (- 48 A a b^{3} e^{5} + 48 A b^{4} d e^{4} - 72 B a^{2} b^{2} e^{5} + 192 B a b^{3} d e^{4} - 120 B b^{4} d^{2} e^{3}\right ) + x^{2} \left (- 36 A a^{2} b^{2} e^{5} - 72 A a b^{3} d e^{4} + 108 A b^{4} d^{2} e^{3} - 24 B a^{3} b e^{5} - 108 B a^{2} b^{2} d e^{4} + 432 B a b^{3} d^{2} e^{3} - 300 B b^{4} d^{3} e^{2}\right ) + x \left (- 16 A a^{3} b e^{5} - 24 A a^{2} b^{2} d e^{4} - 48 A a b^{3} d^{2} e^{3} + 88 A b^{4} d^{3} e^{2} - 4 B a^{4} e^{5} - 16 B a^{3} b d e^{4} - 72 B a^{2} b^{2} d^{2} e^{3} + 352 B a b^{3} d^{3} e^{2} - 260 B b^{4} d^{4} e\right )}{12 d^{4} e^{6} + 48 d^{3} e^{7} x + 72 d^{2} e^{8} x^{2} + 48 d e^{9} x^{3} + 12 e^{10} x^{4}} \]