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