\[ \int \frac {\left (b^2+a x^2\right ) \sqrt {b+\sqrt {b^2+a x^2}}}{-b^2+a x^2} \, dx \]
Optimal antiderivative \[ \frac {4 b x}{3 \sqrt {b +\sqrt {a \,x^{2}+b^{2}}}}+\frac {2 x \sqrt {a \,x^{2}+b^{2}}}{3 \sqrt {b +\sqrt {a \,x^{2}+b^{2}}}}+\frac {2 i \left (\sqrt {\sqrt {2}-1}\, b^{\frac {3}{2}}+\sqrt {-2+2 \sqrt {2}}\, b^{\frac {3}{2}}\right ) \arctan \left (\frac {\frac {i a x}{\sqrt {b +\sqrt {a \,x^{2}+b^{2}}}}-i \sqrt {a}\, \sqrt {b +\sqrt {a \,x^{2}+b^{2}}}}{\sqrt {2+2 \sqrt {2}}\, \sqrt {a}\, \sqrt {b}}\right )}{\sqrt {a}}+\frac {2 \sqrt {\sqrt {2}-1}\, b^{\frac {3}{2}} \arctan \left (\frac {\sqrt {a}\, x}{\sqrt {2+2 \sqrt {2}}\, \sqrt {b}\, \sqrt {b +\sqrt {a \,x^{2}+b^{2}}}}-\frac {\sqrt {b +\sqrt {a \,x^{2}+b^{2}}}}{\sqrt {2+2 \sqrt {2}}\, \sqrt {b}}\right )}{\sqrt {a}}-\frac {2 i \left (-\sqrt {1+\sqrt {2}}\, b^{\frac {3}{2}}+\sqrt {2+2 \sqrt {2}}\, b^{\frac {3}{2}}\right ) \arctanh \left (\frac {\frac {i a x}{\sqrt {b +\sqrt {a \,x^{2}+b^{2}}}}-i \sqrt {a}\, \sqrt {b +\sqrt {a \,x^{2}+b^{2}}}}{\sqrt {-2+2 \sqrt {2}}\, \sqrt {a}\, \sqrt {b}}\right )}{\sqrt {a}}+\frac {2 \sqrt {1+\sqrt {2}}\, b^{\frac {3}{2}} \arctanh \left (\frac {\sqrt {a}\, x}{\sqrt {-2+2 \sqrt {2}}\, \sqrt {b}\, \sqrt {b +\sqrt {a \,x^{2}+b^{2}}}}-\frac {\sqrt {b +\sqrt {a \,x^{2}+b^{2}}}}{\sqrt {-2+2 \sqrt {2}}\, \sqrt {b}}\right )}{\sqrt {a}} \]
command
Integrate[((b^2 + a*x^2)*Sqrt[b + Sqrt[b^2 + a*x^2]])/(-b^2 + a*x^2),x]
Mathematica 13.1 output
\[ \frac {2 x \left (2 b+\sqrt {b^2+a x^2}\right )}{3 \sqrt {b+\sqrt {b^2+a x^2}}}+\frac {2 b^{3/2} \text {ArcTan}\left (\frac {\sqrt {-1+\sqrt {2}} \sqrt {a} x}{\sqrt {b} \sqrt {b+\sqrt {b^2+a x^2}}}\right )}{\sqrt {1+\sqrt {2}} \sqrt {a}}-\frac {2 \sqrt {1+\sqrt {2}} b^{3/2} \tanh ^{-1}\left (\frac {\sqrt {1+\sqrt {2}} \sqrt {a} x}{\sqrt {b} \sqrt {b+\sqrt {b^2+a x^2}}}\right )}{\sqrt {a}} \]
Mathematica 12.3 output
\[ \int \frac {\left (b^2+a x^2\right ) \sqrt {b+\sqrt {b^2+a x^2}}}{-b^2+a x^2} \, dx \]________________________________________________________________________________________