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