\[ \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}}}-4 \arctan \left (\frac {x}{\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}}}-4 \text {ArcTan}\left (\frac {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 \]________________________________________________________________________________________