\[ \int \frac {\left (f+g x^2\right )^2 \log \left (c \left (d+e x^2\right )^p\right )}{x^4} \, dx \]
Optimal antiderivative \[ -\frac {2 e \,f^{2} p}{3 d x}-2 g^{2} p x -\frac {2 e^{\frac {3}{2}} f^{2} p \arctan \left (\frac {x \sqrt {e}}{\sqrt {d}}\right )}{3 d^{\frac {3}{2}}}-\frac {f^{2} \ln \left (c \left (e \,x^{2}+d \right )^{p}\right )}{3 x^{3}}-\frac {2 f g \ln \left (c \left (e \,x^{2}+d \right )^{p}\right )}{x}+g^{2} x \ln \left (c \left (e \,x^{2}+d \right )^{p}\right )+\frac {2 g^{2} p \arctan \left (\frac {x \sqrt {e}}{\sqrt {d}}\right ) \sqrt {d}}{\sqrt {e}}+\frac {4 f g p \arctan \left (\frac {x \sqrt {e}}{\sqrt {d}}\right ) \sqrt {e}}{\sqrt {d}} \]
command
integrate((g*x**2+f)**2*ln(c*(e*x**2+d)**p)/x**4,x)
Sympy 1.10.1 under Python 3.10.4 output
\[ \begin {cases} \left (- \frac {f^{2}}{3 x^{3}} - \frac {2 f g}{x} + g^{2} x\right ) \log {\left (0^{p} c \right )} & \text {for}\: d = 0 \wedge e = 0 \\- \frac {2 f^{2} p}{9 x^{3}} - \frac {f^{2} \log {\left (c \left (e x^{2}\right )^{p} \right )}}{3 x^{3}} - \frac {4 f g p}{x} - \frac {2 f g \log {\left (c \left (e x^{2}\right )^{p} \right )}}{x} - 2 g^{2} p x + g^{2} x \log {\left (c \left (e x^{2}\right )^{p} \right )} & \text {for}\: d = 0 \\\left (- \frac {f^{2}}{3 x^{3}} - \frac {2 f g}{x} + g^{2} x\right ) \log {\left (c d^{p} \right )} & \text {for}\: e = 0 \\\frac {2 d g^{2} p \log {\left (x - \sqrt {- \frac {d}{e}} \right )}}{e \sqrt {- \frac {d}{e}}} - \frac {d g^{2} \log {\left (c \left (d + e x^{2}\right )^{p} \right )}}{e \sqrt {- \frac {d}{e}}} - \frac {f^{2} \log {\left (c \left (d + e x^{2}\right )^{p} \right )}}{3 x^{3}} + \frac {4 f g p \log {\left (x - \sqrt {- \frac {d}{e}} \right )}}{\sqrt {- \frac {d}{e}}} - \frac {2 f g \log {\left (c \left (d + e x^{2}\right )^{p} \right )}}{\sqrt {- \frac {d}{e}}} - \frac {2 f g \log {\left (c \left (d + e x^{2}\right )^{p} \right )}}{x} - 2 g^{2} p x + g^{2} x \log {\left (c \left (d + e x^{2}\right )^{p} \right )} - \frac {2 e f^{2} p \log {\left (x - \sqrt {- \frac {d}{e}} \right )}}{3 d \sqrt {- \frac {d}{e}}} - \frac {2 e f^{2} p}{3 d x} + \frac {e f^{2} \log {\left (c \left (d + e x^{2}\right )^{p} \right )}}{3 d \sqrt {- \frac {d}{e}}} & \text {otherwise} \end {cases} \]
Sympy 1.8 under Python 3.8.8 output
\[ \text {Timed out} \]________________________________________________________________________________________