# How to integrate $\tan^{-1}\left(\frac{1}{2 \sin(x)}\right)$?

I want to calculate the following integral :

$$\displaystyle{\int^{\frac{\pi}{2}}_{0} \tan^{-1}\left(\frac{1}{2 \sin(x)}\right)} \text{ d}x$$

But I don't how; I tried by subsituting $$u = \frac{1}{2 \sin(x)}$$ and $$u = \tan^{-1}\left(\frac{1}{2 \sin(x)}\right)$$ but it doesn't lead me anywhere.

Thanks for your help.

Well, the integral over $$(0,2\pi)$$ is clearly zero by symmetry, hence the given problem is equivalent to finding
$$-\int_{0}^{\pi/2}\arctan\left(\frac{1}{2\sin x}\right)\,dx=-\int_{0}^{1}\frac{\arctan\frac{1}{2x}}{\sqrt{1-x^2}}\,dx=-\frac{\pi^2}{4}+\int_{0}^{1}\frac{\arctan(2x)}{\sqrt{1-x^2}}\,dx$$ or $$-\frac{\pi^2}{4}+\int_{0}^{2}\int_{0}^{1}\frac{x}{(1+a^2 x^2)\sqrt{1-x^2}}\,dx\,da=-\frac{\pi^2}{4}+\int_{0}^{2}\frac{\text{arcsinh}(a)}{a\sqrt{1+a^2}}\,da$$ or $$-\frac{\pi^2}{4}+\int_{0}^{\log(2+\sqrt{5})}\frac{u}{\sinh u}\,du =-\frac{\pi^2}{4}+\int_{1}^{2+\sqrt{5}}\frac{2\log v}{v^2-1}\,dv$$ where the last integral depends on the dilogarithm $$\text{Li}_2$$ evaluated at $$\pm(\sqrt{5}-2)$$:
$$\int_{0}^{\pi/2}\arctan\left(\frac{1}{2\sin x}\right)\,dx= \text{arcsinh}\left(\tfrac{1}{2}\right)\text{arcsinh}(2)-\text{Li}_2(\sqrt{5}-2)+\text{Li}_2(2-\sqrt{5})$$
Partial answer: Consider $$f(y) = \int_{\pi/2}^{2\pi} \arctan\frac1{y\sin x}\,dx$$. You are interested ultimately in $$f(2)$$. It appears that $$f'(y)$$ can be integrated/evaluated (pass the derivative through the integral, simplify, and do $$u=\cos x$$) easily enough. Can you then integrate this result to get back $$f(y)$$?