\[ \int \frac {A+B x+C x^2}{\sqrt {a+b x} \sqrt {a c-b c x}} \, dx \]
Optimal antiderivative \[ -\frac {B \left (-b^{2} x^{2}+a^{2}\right )}{b^{2} \sqrt {b x +a}\, \sqrt {-b c x +a c}}-\frac {C x \left (-b^{2} x^{2}+a^{2}\right )}{2 b^{2} \sqrt {b x +a}\, \sqrt {-b c x +a c}}+\frac {\left (2 A \,b^{2}+a^{2} C \right ) \arctan \! \left (\frac {b x \sqrt {c}}{\sqrt {-b^{2} c \,x^{2}+a^{2} c}}\right ) \sqrt {-b^{2} c \,x^{2}+a^{2} c}}{2 b^{3} \sqrt {c}\, \sqrt {b x +a}\, \sqrt {-b c x +a c}} \]
command
integrate((C*x**2+B*x+A)/(b*x+a)**(1/2)/(-b*c*x+a*c)**(1/2),x)
Sympy 1.10.1 under Python 3.10.4 output
\[ \text {Timed out} \]
Sympy 1.8 under Python 3.8.8 output
\[ - \frac {i A {G_{6, 6}^{6, 2}\left (\begin {matrix} \frac {1}{4}, \frac {3}{4} & \frac {1}{2}, \frac {1}{2}, 1, 1 \\0, \frac {1}{4}, \frac {1}{2}, \frac {3}{4}, 1, 0 & \end {matrix} \middle | {\frac {a^{2}}{b^{2} x^{2}}} \right )}}{4 \pi ^{\frac {3}{2}} b \sqrt {c}} + \frac {A {G_{6, 6}^{2, 6}\left (\begin {matrix} - \frac {1}{2}, - \frac {1}{4}, 0, \frac {1}{4}, \frac {1}{2}, 1 & \\- \frac {1}{4}, \frac {1}{4} & - \frac {1}{2}, 0, 0, 0 \end {matrix} \middle | {\frac {a^{2} e^{- 2 i \pi }}{b^{2} x^{2}}} \right )}}{4 \pi ^{\frac {3}{2}} b \sqrt {c}} - \frac {i B a {G_{6, 6}^{6, 2}\left (\begin {matrix} - \frac {1}{4}, \frac {1}{4} & 0, 0, \frac {1}{2}, 1 \\- \frac {1}{2}, - \frac {1}{4}, 0, \frac {1}{4}, \frac {1}{2}, 0 & \end {matrix} \middle | {\frac {a^{2}}{b^{2} x^{2}}} \right )}}{4 \pi ^{\frac {3}{2}} b^{2} \sqrt {c}} - \frac {B a {G_{6, 6}^{2, 6}\left (\begin {matrix} -1, - \frac {3}{4}, - \frac {1}{2}, - \frac {1}{4}, 0, 1 & \\- \frac {3}{4}, - \frac {1}{4} & -1, - \frac {1}{2}, - \frac {1}{2}, 0 \end {matrix} \middle | {\frac {a^{2} e^{- 2 i \pi }}{b^{2} x^{2}}} \right )}}{4 \pi ^{\frac {3}{2}} b^{2} \sqrt {c}} - \frac {i C a^{2} {G_{6, 6}^{6, 2}\left (\begin {matrix} - \frac {3}{4}, - \frac {1}{4} & - \frac {1}{2}, - \frac {1}{2}, 0, 1 \\-1, - \frac {3}{4}, - \frac {1}{2}, - \frac {1}{4}, 0, 0 & \end {matrix} \middle | {\frac {a^{2}}{b^{2} x^{2}}} \right )}}{4 \pi ^{\frac {3}{2}} b^{3} \sqrt {c}} + \frac {C a^{2} {G_{6, 6}^{2, 6}\left (\begin {matrix} - \frac {3}{2}, - \frac {5}{4}, -1, - \frac {3}{4}, - \frac {1}{2}, 1 & \\- \frac {5}{4}, - \frac {3}{4} & - \frac {3}{2}, -1, -1, 0 \end {matrix} \middle | {\frac {a^{2} e^{- 2 i \pi }}{b^{2} x^{2}}} \right )}}{4 \pi ^{\frac {3}{2}} b^{3} \sqrt {c}} \]