\[ \int F^{f \left (a+b \log ^2\left (c (d+e x)^n\right )\right )} (g+h x)^2 \, dx \]
Optimal antiderivative \[ \frac {F^{a f} h \left (-d h +e g \right ) \left (e x +d \right )^{2} \erfi \left (\frac {1+b f n \ln \left (F \right ) \ln \left (c \left (e x +d \right )^{n}\right )}{n \sqrt {b}\, \sqrt {f}\, \sqrt {\ln \left (F \right )}}\right ) \sqrt {\pi }\, {\mathrm e}^{-\frac {1}{b f \,n^{2} \ln \left (F \right )}} \left (c \left (e x +d \right )^{n}\right )^{-\frac {2}{n}}}{e^{3} n \sqrt {b}\, \sqrt {f}\, \sqrt {\ln \left (F \right )}}+\frac {F^{a f} \left (-d h +e g \right )^{2} \left (e x +d \right ) \erfi \left (\frac {1+2 b f n \ln \left (F \right ) \ln \left (c \left (e x +d \right )^{n}\right )}{2 n \sqrt {b}\, \sqrt {f}\, \sqrt {\ln \left (F \right )}}\right ) \sqrt {\pi }\, {\mathrm e}^{-\frac {1}{4 b f \,n^{2} \ln \left (F \right )}} \left (c \left (e x +d \right )^{n}\right )^{-\frac {1}{n}}}{2 e^{3} n \sqrt {b}\, \sqrt {f}\, \sqrt {\ln \left (F \right )}}+\frac {F^{a f} h^{2} \left (e x +d \right )^{3} \erfi \left (\frac {3+2 b f n \ln \left (F \right ) \ln \left (c \left (e x +d \right )^{n}\right )}{2 n \sqrt {b}\, \sqrt {f}\, \sqrt {\ln \left (F \right )}}\right ) \sqrt {\pi }\, {\mathrm e}^{-\frac {9}{4 b f \,n^{2} \ln \left (F \right )}} \left (c \left (e x +d \right )^{n}\right )^{-\frac {3}{n}}}{2 e^{3} n \sqrt {b}\, \sqrt {f}\, \sqrt {\ln \left (F \right )}} \]
command
integrate(F**(f*(a+b*ln(c*(e*x+d)**n)**2))*(h*x+g)**2,x)
Sympy 1.10.1 under Python 3.10.4 output
\[ \text {output too large to display} \]
Sympy 1.8 under Python 3.8.8 output \[ \text {Timed out} \]_____________________________________________________