\[ \int \frac {-1+2 x^2}{\sqrt {-1+x} \sqrt {1+x}} \, dx \]
Optimal antiderivative \[ x \sqrt {-1+x}\, \sqrt {1+x} \]
command
integrate((2*x**2-1)/(-1+x)**(1/2)/(1+x)**(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
\[ - \begin {cases} 2 \operatorname {acosh}{\left (\frac {\sqrt {2} \sqrt {x + 1}}{2} \right )} & \text {for}\: \frac {\left |{x + 1}\right |}{2} > 1 \\- 2 i \operatorname {asin}{\left (\frac {\sqrt {2} \sqrt {x + 1}}{2} \right )} & \text {otherwise} \end {cases} + \frac {{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 {1}{x^{2}}} \right )}}{2 \pi ^{\frac {3}{2}}} - \frac {i {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 {e^{2 i \pi }}{x^{2}}} \right )}}{2 \pi ^{\frac {3}{2}}} \]