Evaluate $\int_0^{\pi/2} \frac{\arctan{\left(\frac{2\sin{x}}{2\cos{x}-1}\right)}\sin{\left(\frac{x}{2}\right)}}{\sqrt{\cos{x}}} \, \mathrm{d}x$ Evaluate: $$\int_0^{\frac{\pi}{2}} \frac{\arctan{\left(\frac{2\sin{x}}{2\cos{x}-1}\right)}\sin{\left(\frac{x}{2}\right)}}{\sqrt{\cos{x}}} \, \mathrm{d}x$$
I believe there is a "nice" closed form solution but Wolfram is too weak.  These arctan integrals are so tricky!  I sense a substitution like $\sin{\frac{x}{2}}$ because of arctan argument and $\sqrt{\cos{x}}$ but I just cant get it.  Any ideas or tips please.
Source: https://tieba.baidu.com/p/4794735082 (Exercise 3.1.22).
 A: $$\int_0^\frac{\pi}{2}\arctan\left(\frac{2\sin x}{2\cos x -1}\right)\frac{\sin\left(\frac{x}{2}\right)}{\sqrt{\cos x}}dx \overset{\tan\frac{x}{2}\to x}= 2\int_0^1 \frac{x\arctan\left(\frac{4x}{1-3x^2}\right)}{\sqrt{1-x^2}(1+x^2)}dx$$
$$=2\underbrace{\int_0^1 \frac{x(\arctan x + \arctan(3x))}{\sqrt{1-x^2}(1+x^2)}dx}_{\mathcal J} - 2\pi \underbrace{\int_\frac{1}{\sqrt 3}^1 \frac{x}{\sqrt{1-x^2}(1+x^2)}dx}_{\large\frac{1}{2\sqrt2}\ln(2+\sqrt 3)}
$$
The second integral appears since for $x>\frac{1}{\sqrt 3}$ we have $x \cdot 3x>1$.
Now in order to deal with $\mathcal J$ we can differentiate under the integral sign, considering:
$$\mathcal J(a)=\int_0^1\frac{x(\arctan(a x)+\arctan(3 x))}{\sqrt{1-x^2}(1+x)}dx $$
$$\Rightarrow  \mathcal J'(a) = \int_0^1 \frac{x^2}{\sqrt{1-x^2}(1+x^2)(1+a^2 x^2)}dx
\overset{\frac{1}{x}\to \sqrt{1+x^2}}=\int_0^\infty \frac{dx}{(2+x^2)(1+a^2+x^2)}$$
$$=\frac{2}{1-a^2}\int_0^\infty \left(\frac{1}{1+a^2+x^2}-\frac{1}{2+x^2}\right)dx=\frac{\pi}{2(1-a^2)}\left(\frac{1}{\sqrt{1+a^2}}-\frac{1}{\sqrt 2}\right)$$
We are looking to find $\mathcal J(1)=\mathcal J$, but $\mathcal J(-3)=0$ therefore our integral is:
$$\mathcal J=\frac{\pi}{2}\int_{-3}^1 \frac{1}{1-a^2}\left(\frac{1}{\sqrt{1+a^2}}-\frac{1}{\sqrt 2}\right)da\overset{a=\frac{1+x}{1-x}}=\frac{\pi}{4\sqrt 2}\int_0^2\frac{1}{x}\left(1-\frac{1-x}{\sqrt{1+x^2}}\right)dx$$
$$=\frac{\pi}{4\sqrt 2}\left(\ln\left(x+\sqrt{1+x^2}\right)+\ln\left(1+\sqrt{1+x^2}\right)\right)\bigg|_0^2=\frac{\pi}{\sqrt 2} \ln \varphi,\ \varphi =\frac{1+\sqrt 5}{2}$$
Therefore:
$$\boxed{\int_0^\frac{\pi}{2}\arctan\left(\frac{2\sin x}{2\cos x -1}\right)\frac{\sin\left(\frac{x}{2}\right)}{\sqrt{\cos x}}dx=\sqrt 2 \pi \ln\varphi-\frac{\pi}{\sqrt 2}\ln(2+\sqrt 3)}$$
