\[ \int \frac {b^2+a x}{\left (-b^2+a x\right ) \sqrt {b+\sqrt {b^2+a x^2}}} \, dx \]
Optimal antiderivative \[ \frac {\sqrt {2}\, \left (-b +x \sqrt {a}\right ) \sqrt {-x \sqrt {a}+\sqrt {a \,x^{2}+b^{2}}}}{\sqrt {a}\, b}+\frac {\sqrt {2}\, \sqrt {a \,x^{2}+b^{2}}\, \sqrt {-x \sqrt {a}+\sqrt {a \,x^{2}+b^{2}}}}{\sqrt {a}\, b}-\frac {2 \sqrt {2}\, \sqrt {b}\, \arctan \left (\frac {\sqrt {-x \sqrt {a}+\sqrt {a \,x^{2}+b^{2}}}}{\sqrt {b}}\right )}{\sqrt {a}}+\frac {2 \left (\sqrt {2}\, \sqrt {a}\, \sqrt {b}\, \sqrt {b +\sqrt {b^{2}+a}}-\sqrt {2}\, b^{\frac {3}{2}} \sqrt {b +\sqrt {b^{2}+a}}+\sqrt {2}\, \sqrt {b}\, \sqrt {b^{2}+a}\, \sqrt {b +\sqrt {b^{2}+a}}\right ) \arctan \left (\frac {a^{\frac {1}{4}} \sqrt {-x \sqrt {a}+\sqrt {a \,x^{2}+b^{2}}}}{\sqrt {b}\, \sqrt {b +\sqrt {b^{2}+a}}}\right )}{a^{\frac {5}{4}}}-\frac {2 \left (-\sqrt {2}\, \sqrt {a}\, \sqrt {b}\, \sqrt {-b +\sqrt {b^{2}+a}}+\sqrt {2}\, b^{\frac {3}{2}} \sqrt {-b +\sqrt {b^{2}+a}}+\sqrt {2}\, \sqrt {b}\, \sqrt {b^{2}+a}\, \sqrt {-b +\sqrt {b^{2}+a}}\right ) \arctanh \left (\frac {a^{\frac {1}{4}} \sqrt {-x \sqrt {a}+\sqrt {a \,x^{2}+b^{2}}}}{\sqrt {b}\, \sqrt {-b +\sqrt {b^{2}+a}}}\right )}{a^{\frac {5}{4}}} \]
command
Integrate[(b^2 + a*x)/((-b^2 + a*x)*Sqrt[b + Sqrt[b^2 + a*x^2]]),x]
Mathematica 13.1 output
\[ \frac {2 x}{\sqrt {b+\sqrt {b^2+a x^2}}}-\frac {2 \sqrt {2} \sqrt {b} \text {ArcTan}\left (\frac {b-\sqrt {a} x+\sqrt {b^2+a x^2}}{\sqrt {2} \sqrt {b} \sqrt {b+\sqrt {b^2+a x^2}}}\right )}{\sqrt {a}}-2 i \sqrt {a} b^3 \text {RootSum}\left [16 a^4 b^4-8 a^2 b^2 \text {$\#$1}^4-16 a b^4 \text {$\#$1}^4+\text {$\#$1}^8\&,\frac {\log \left (\frac {i a x}{\sqrt {b+\sqrt {b^2+a x^2}}}-i \sqrt {a} \sqrt {b+\sqrt {b^2+a x^2}}-\text {$\#$1}\right ) \text {$\#$1}}{-4 a^2 b^2-8 a b^4+\text {$\#$1}^4}\&\right ]-\frac {i b^2 \text {RootSum}\left [16 a^4 b^4-8 a^2 b^2 \text {$\#$1}^4-16 a b^4 \text {$\#$1}^4+\text {$\#$1}^8\&,\frac {\log \left (\frac {i a x}{\sqrt {b+\sqrt {b^2+a x^2}}}-i \sqrt {a} \sqrt {b+\sqrt {b^2+a x^2}}-\text {$\#$1}\right ) \text {$\#$1}^3}{-4 a^2 b^2-8 a b^4+\text {$\#$1}^4}\&\right ]}{\sqrt {a}}+4 i a^{3/2} b^4 \text {RootSum}\left [16 a^4 b^4-8 a^2 b^2 \text {$\#$1}^4-16 a b^4 \text {$\#$1}^4+\text {$\#$1}^8\&,\frac {\log \left (\frac {i a x}{\sqrt {b+\sqrt {b^2+a x^2}}}-i \sqrt {a} \sqrt {b+\sqrt {b^2+a x^2}}-\text {$\#$1}\right )}{4 a^2 b^2 \text {$\#$1}+8 a b^4 \text {$\#$1}-\text {$\#$1}^5}\&\right ]+8 i a^{5/2} b^5 \text {RootSum}\left [16 a^4 b^4-8 a^2 b^2 \text {$\#$1}^4-16 a b^4 \text {$\#$1}^4+\text {$\#$1}^8\&,\frac {\log \left (\frac {i a x}{\sqrt {b+\sqrt {b^2+a x^2}}}-i \sqrt {a} \sqrt {b+\sqrt {b^2+a x^2}}-\text {$\#$1}\right )}{4 a^2 b^2 \text {$\#$1}^3+8 a b^4 \text {$\#$1}^3-\text {$\#$1}^7}\&\right ]-i b \text {RootSum}\left [16 a^4 b^4-8 a^2 b^2 \text {$\#$1}^4-16 a b^4 \text {$\#$1}^4+\text {$\#$1}^8\&,\frac {-8 a^3 b^3 \log \left (\frac {i a x}{\sqrt {b+\sqrt {b^2+a x^2}}}-i \sqrt {a} \sqrt {b+\sqrt {b^2+a x^2}}-\text {$\#$1}\right )-4 a^2 b^2 \log \left (\frac {i a x}{\sqrt {b+\sqrt {b^2+a x^2}}}-i \sqrt {a} \sqrt {b+\sqrt {b^2+a x^2}}-\text {$\#$1}\right ) \text {$\#$1}^2-8 a b^4 \log \left (\frac {i a x}{\sqrt {b+\sqrt {b^2+a x^2}}}-i \sqrt {a} \sqrt {b+\sqrt {b^2+a x^2}}-\text {$\#$1}\right ) \text {$\#$1}^2+2 a b \log \left (\frac {i a x}{\sqrt {b+\sqrt {b^2+a x^2}}}-i \sqrt {a} \sqrt {b+\sqrt {b^2+a x^2}}-\text {$\#$1}\right ) \text {$\#$1}^4+4 b^3 \log \left (\frac {i a x}{\sqrt {b+\sqrt {b^2+a x^2}}}-i \sqrt {a} \sqrt {b+\sqrt {b^2+a x^2}}-\text {$\#$1}\right ) \text {$\#$1}^4+\log \left (\frac {i a x}{\sqrt {b+\sqrt {b^2+a x^2}}}-i \sqrt {a} \sqrt {b+\sqrt {b^2+a x^2}}-\text {$\#$1}\right ) \text {$\#$1}^6}{-4 a^2 b^2 \text {$\#$1}^3-8 a b^4 \text {$\#$1}^3+\text {$\#$1}^7}\&\right ] \]
Mathematica 12.3 output
\[ \int \frac {b^2+a x}{\left (-b^2+a x\right ) \sqrt {b+\sqrt {b^2+a x^2}}} \, dx \]________________________________________________________________________________________