<s>[INST] A difficult integral $I=\int_0^1\sqrt{1+\sqrt{1-x^2}}\frac{dx}{1+x^2}$ How to prove
$$I=\int_0^1\sqrt{1+\sqrt{1-x^2}}\frac{dx}{1+x^2}=\sqrt{\sqrt{2}+1}\arctan\sqrt{\sqrt{2}+1}-\frac{1}{2}\sqrt{\sqrt{2}-1}\ln(1+\sqrt{2}+\sqrt{2+2\sqrt{2}})$$
$$ I=\int_0^{\pi/4}\sqrt{1+\sqrt{1-\tan^2y}}dy=\int_0^{\pi/4}\sqrt{{cosy}+\sqrt{\cos2y}}\frac{dy}{\sqrt{cosy}} $$
put  $$x=tany$$
 But how to calculate this integral?
 [/INST] By enforcing the substitution $x=\sin\theta$ we are left with
$$ I = \int_{0}^{\pi/2}\sqrt{1+\cos\theta}\frac{\cos\theta}{1+\sin^2\theta}\,d\theta = \sqrt{2}\int_{0}^{\pi/2}\frac{\cos\theta\cos\frac{\theta}{2}}{1+\sin^2\theta}\,d\theta$$
and by enforcing the substitution $\theta=2\varphi$ we get:
$$ I = 2 \sqrt{2}\int_{0}^{\pi/4}\frac{\cos(\varphi)(2\cos^2(\varphi)-1)}{1+4\sin^2(\varphi)\cos^2(\varphi)}\,d\varphi. $$
By setting $\varphi=2\arctan t$, the original integral is converted into the integral of a rational function over the interval $J=\left(0,\tan\frac{\pi}{8}\right)=\left(0,\sqrt{2}-1\right)$, namely
$$ I = 4\sqrt{2}\int_J \frac{1-7 t^2+7 t^4-t^6}{1+20 t^2-26 t^4+20 t^6+t^8}\,dt. $$
Now the closed form of $I$ just depends on the partial fraction decomposition of the last integrand function, i.e. on the roots of $p(t)=1+20 t^2-26 t^4+20 t^6+t^8$. $p(t)$ is an even and palindromic polynomial, so its roots are given by triple-nested square roots, but finding them is pretty easy, since the whole problem boils down to solving a quadratic equation. I will let you fill the missing details.
</s>