<s>[INST] Evaluate $\int_{0}^{\pi}\sqrt\frac{1+\cos2x}{x^2+1}dx$. 
Evaluate$$\int_{0}^{\pi}\sqrt\frac{1+\cos2x}{x^2+1}\,\mathrm dx$$

We have $\sqrt{1+\cos2x}=\sqrt{2\cos^2x}=\sqrt{2} |\cos x|$. Then we need to solve $\int_{0}^{\pi}\frac{\sqrt{2} |\cos x|}{\sqrt{x^2+1}}dx$. Using symmetry of $\cos x$ from $0$ to $\pi$ the integral becomes $I=2\sqrt2\int_{0}^{\pi/2}\frac{ \cos x}{\sqrt{x^2+1}}dx$.

*

*I tried using "By Parts", it didn't helped much.


*Take the substitution $x=\tan \theta$ then we have $I=\int_{0}^{\tan^{-1}\pi/2}\cos (\tan \theta)\sec \theta d\theta$.
I am having difficulty in solving with the existing methods that I know.
Edit: After knowing that I can not assume the symmetry of the given integral the question will be to solve
$$\sqrt2\left(\int_{0}^{\pi/2} \frac{\cos x}{\sqrt {x^2+1}}\,\mathrm dx-\int_{\pi/2}^{\pi} \frac{\cos x}{\sqrt {x^2+1}}\,\mathrm dx\right) $$
Again I will face same problem to proceed ahead.
 [/INST] Just for the fun !
Being skeptical about a possible closed form, starting from
$$I=\sqrt2\left(\int_{0}^{\frac \pi 2} \frac{\cos (x)}{\sqrt {x^2+1}}\, dx-\int_{\frac \pi 2}^{\pi} \frac{\cos (x)}{\sqrt {x^2+1}}\, dx\right)$$ I rewrote it as
$$I=\sqrt2\left(\int_{0}^{\frac \pi 2} \frac{\cos (x)}{\sqrt {x^2+1}}\, dx+\int_0^{\frac \pi 2} \frac{\sin (x)}{\sqrt{\left(x+\frac{\pi }{2}\right)^2+1}}\, dx\right)$$ and used my favored $\large 1,400$ years old approximations
$$\sin(x) \simeq \frac{16 (\pi -x) x}{5 \pi ^2-4 (\pi -x) x}\qquad (0\leq x\leq\pi)$$
$$\cos(x) \simeq\frac{\pi ^2-4x^2}{\pi ^2+x^2}\qquad (-\frac \pi 2 \leq x\leq\frac \pi 2)$$
Even if messy, the antiderivatives exist. In particular, we have
$$\int_{0}^{\frac \pi 2} \frac{\cos (x)}{\sqrt {x^2+1}}\, dx=-4 \sinh ^{-1}\left(\frac{\pi }{2}\right)+\frac{5 \pi }{4 \sqrt{\pi ^2-1}}\log \left(\frac{3+2 \pi ^2+2 \sqrt{-4+3 \pi ^2+\pi ^4}}{3+2 \pi ^2-2 \sqrt{-4+3
   \pi ^2+\pi ^4}}\right)$$ which, numerically, is $\color{blue}{0.856256}$ while numerical integration gives $\color{red}{0.856581}$.
The formula for the second integral is too long but fully explicit. Numerically, its value is $\color{blue}{0.368287}$ while numerical integration gives $\color{red}{0.368308}$.
So, as a total, these approximations lead to $\color{blue}{I=1.731765}$ while numerical integration gives $\color{red}{I=1.732254}$ corresponding to a relative error of $\color{red}{0.028\text{%}}$.
Edit
Cocerning the second integral, using $x+\frac \pi 2=t$,
$$J=\int_0^{\frac \pi 2}\frac{16 (\pi -x) x}{\left(5 \pi ^2-4 (\pi -x) x\right) \sqrt{\left(x+\frac{\pi }{2}\right)^2+1}}\,dx=-\int_{\frac \pi 2}^\pi\frac{(\pi -2 t) (3 \pi -2 t)}{ \left(t^2-2 \pi  t+2 \pi ^2\right)\sqrt{t^2+1}}\,dt$$ Factoring and using partial fraction
$$J=-\int_{\frac \pi 2}^\pi\frac{4}{\sqrt{t^2+1}}\,dt-\int_{\frac \pi 2}^\pi\frac{5 i \pi }{2 (t-(1+i) \pi ) \sqrt{t^2+1}}\,dt+\int_{\frac \pi 2}^\pi\frac{5 i \pi }{2 (t-(1-i) \pi )   \sqrt{t^2+1}}\,dt$$ For the first integral
$$-\int_{\frac \pi 2}^\pi\frac{4}{\sqrt{t^2+1}}\,dt=4 \left(\sinh ^{-1}\left(\frac{\pi }{2}\right)-\sinh ^{-1}(\pi )\right)$$ For the other integrals
$$\int_{\frac \pi 2}^\pi \frac{dt}{ (t-a)\sqrt{t^2+1}}= \frac{1}{\sqrt{a^2+1}}\log \left(\frac{(a-\pi ) \left(\sqrt{4+\pi ^2} \sqrt{a^2+1}+\pi  a+2\right)}{(2
   a-\pi ) \left(\sqrt{1+\pi ^2} \sqrt{a^2+1}+\pi  a+1\right)}\right)$$
</s>