\[ \int \frac {\left (-q+2 p x^3\right ) \sqrt {q^2-2 p q x^2+2 p q x^3+p^2 x^6} \left (b x^2+a \left (q+p x^3\right )^2\right )}{x^5} \, dx \]
Optimal antiderivative \[ \frac {\sqrt {p^{2} x^{6}+2 p q \,x^{3}-2 p q \,x^{2}+q^{2}}\, \left (a \,p^{3} x^{9}+3 a \,p^{2} q \,x^{6}-a \,p^{2} q \,x^{5}+3 a p \,q^{2} x^{3}+2 b p \,x^{5}-a p \,q^{2} x^{2}+a \,q^{3}+2 b q \,x^{2}\right )}{4 x^{4}}+\frac {\left (a \,p^{2} q^{2}+2 b p q \right ) \ln \left (x \right )}{2}+\frac {\left (-a \,p^{2} q^{2}-2 b p q \right ) \ln \left (q +p \,x^{3}+\sqrt {p^{2} x^{6}+2 p q \,x^{3}-2 p q \,x^{2}+q^{2}}\right )}{2} \]
command
Integrate[((-q + 2*p*x^3)*Sqrt[q^2 - 2*p*q*x^2 + 2*p*q*x^3 + p^2*x^6]*(b*x^2 + a*(q + p*x^3)^2))/x^5,x]
Mathematica 13.1 output
\[ \frac {1}{4} \left (\frac {\left (q+p x^3\right ) \sqrt {q^2+2 p q (-1+x) x^2+p^2 x^6} \left (2 b x^2+a \left (q^2+p^2 x^6+p q x^2 (-1+2 x)\right )\right )}{x^4}-2 p q (2 b+a p q) \tanh ^{-1}\left (\frac {\sqrt {q^2+2 p q (-1+x) x^2+p^2 x^6}}{q+p x^3}\right )\right ) \]
Mathematica 12.3 output
\[ \int \frac {\left (-q+2 p x^3\right ) \sqrt {q^2-2 p q x^2+2 p q x^3+p^2 x^6} \left (b x^2+a \left (q+p x^3\right )^2\right )}{x^5} \, dx \]________________________________________________________________________________________