7.2 Problem number 246

\[ \int \frac {\left (c+\frac {d}{x}\right )^2}{\sqrt {a+\frac {b}{x}}} \, dx \]

Optimal antiderivative \[ -\frac {c \left (-4 a d +b c \right ) \arctanh \! \left (\frac {\sqrt {a +\frac {b}{x}}}{\sqrt {a}}\right )}{a^{\frac {3}{2}}}-\frac {2 d^{2} \sqrt {a +\frac {b}{x}}}{b}+\frac {c^{2} x \sqrt {a +\frac {b}{x}}}{a} \]

command

integrate((c+d/x)^2/(a+b/x)^(1/2),x, algorithm="giac")

Giac 1.9.0-11 via sagemath 9.6 output

\[ \text {Exception raised: TypeError} \]

Giac 1.7.0 via sagemath 9.3 output

\[ -\frac {\frac {b^{2} c^{2} \sqrt {\frac {a x + b}{x}}}{{\left (a - \frac {a x + b}{x}\right )} a} + 2 \, d^{2} \sqrt {\frac {a x + b}{x}} - \frac {{\left (b^{2} c^{2} - 4 \, a b c d\right )} \arctan \left (\frac {\sqrt {\frac {a x + b}{x}}}{\sqrt {-a}}\right )}{\sqrt {-a} a}}{b} \]