Analytic expressions for two definite integrals containing trigonometric functions and a real parameter I encountered these two integrals in my research about the physics of Josephson junctions:
$$\int^{\pi}_{-\pi}\frac{dx}{\sqrt{1+\sqrt{1-D\sin^2\frac{x}{2}}}} $$
$$\int^{\pi}_{-\pi}\sqrt{1+\sqrt{1-D\sin^2\frac{x}{2}}} dx $$
where D is a real number between 0 and 1.
I wonder if there's an analytic expression for either of these two integrals. Mathematica doesn't seem to help.
 A: 
Define the two functions $\mathcal{I}:(0,1)\rightarrow\mathbb{R}$ and $\mathcal{J}:(0,1)\rightarrow\mathbb{R}$ via the respective integrals,
$$\mathcal{I}{\left(D\right)}:=\int_{-\pi}^{\pi}\mathrm{d}\omega\,\frac{1}{\sqrt{1+\sqrt{1-D\sin^{2}{\left(\frac{\omega}{2}\right)}}}}$$
and
$$\mathcal{J}{\left(D\right)}:=\int_{-\pi}^{\pi}\mathrm{d}\omega\,\sqrt{1+\sqrt{1-D\sin^{2}{\left(\frac{\omega}{2}\right)}}}.$$

Suppose $a\in(0,1)$, and note that $0<\sqrt{1-a^{2}}<1$. Setting $b:=\sqrt{1-a^{2}}$, we have
$$\begin{align}
\mathcal{I}{\left(a^{2}\right)}
&=\int_{-\pi}^{\pi}\mathrm{d}\omega\,\frac{1}{\sqrt{1+\sqrt{1-a^{2}\sin^{2}{\left(\frac{\omega}{2}\right)}}}}\\
&=2\int_{0}^{\pi}\mathrm{d}\omega\,\frac{1}{\sqrt{1+\sqrt{1-a^{2}\sin^{2}{\left(\frac{\omega}{2}\right)}}}};~~~\small{even\,symmetry}\\
&=2\int_{0}^{\frac{\pi}{2}}\mathrm{d}\theta\,\frac{2}{\sqrt{1+\sqrt{1-a^{2}\sin^{2}{\left(\theta\right)}}}};~~~\small{\left[\omega=2\theta\right]}\\
&=4\int_{0}^{1}\mathrm{d}x\,\frac{1}{\sqrt{1-x^{2}}\sqrt{1+\sqrt{1-a^{2}x^{2}}}};~~~\small{\left[\theta=\arcsin{\left(x\right)}\right]}\\
&=4\int_{0}^{a}\mathrm{d}y\,\frac{1}{\sqrt{a^{2}-y^{2}}\sqrt{1+\sqrt{1-y^{2}}}};~~~\small{\left[ax=y\right]}\\
&=4\int_{1}^{\sqrt{1-a^{2}}}\mathrm{d}t\,\frac{(-1)t}{\sqrt{1-t^{2}}}\cdot\frac{1}{\sqrt{a^{2}-1+t^{2}}\sqrt{1+t}};~~~\small{\left[y=\sqrt{1-t^{2}}\right]}\\
&=4\int_{\sqrt{1-a^{2}}}^{1}\mathrm{d}t\,\frac{t}{\sqrt{1+t}\sqrt{1-t^{2}}\sqrt{t^{2}-\left(1-a^{2}\right)}}\\
&=4\int_{b}^{1}\mathrm{d}t\,\frac{t}{\left(1+t\right)\sqrt{\left(1-t\right)\left(t^{2}-b^{2}\right)}},\\
\end{align}$$
and
$$\begin{align}
\mathcal{J}{\left(a^{2}\right)}
&=\int_{-\pi}^{\pi}\mathrm{d}\omega\,\sqrt{1+\sqrt{1-a^{2}\sin^{2}{\left(\frac{\omega}{2}\right)}}}\\
&=2\int_{0}^{\pi}\mathrm{d}\omega\,\sqrt{1+\sqrt{1-a^{2}\sin^{2}{\left(\frac{\omega}{2}\right)}}};~~~\small{even\,symmetry}\\
&=4\int_{0}^{\frac{\pi}{2}}\mathrm{d}\theta\,\sqrt{1+\sqrt{1-a^{2}\sin^{2}{\left(\theta\right)}}};~~~\small{\left[\omega=2\theta\right]}\\
&=4\int_{0}^{1}\mathrm{d}x\,\frac{\sqrt{1+\sqrt{1-a^{2}x^{2}}}}{\sqrt{1-x^{2}}};~~~\small{\left[\theta=\arcsin{\left(x\right)}\right]}\\
&=\int_{0}^{a}\mathrm{d}y\,\frac{4\sqrt{1+\sqrt{1-y^{2}}}}{\sqrt{a^{2}-y^{2}}};~~~\small{\left[ax=y\right]}\\
&=\int_{1}^{\sqrt{1-a^{2}}}\mathrm{d}t\,\frac{(-1)t}{\sqrt{1-t^{2}}}\cdot\frac{4\sqrt{1+t}}{\sqrt{a^{2}-1+t^{2}}};~~~\small{\left[y=\sqrt{1-t^{2}}\right]}\\
&=\int_{\sqrt{1-a^{2}}}^{1}\mathrm{d}t\,\frac{t}{\sqrt{1-t^{2}}}\cdot\frac{4\sqrt{1+t}}{\sqrt{t^{2}-\left(1-a^{2}\right)}}\\
&=4\int_{b}^{1}\mathrm{d}t\,\frac{t}{\sqrt{\left(1-t\right)\left(t^{2}-b^{2}\right)}}.\\
\end{align}$$
Hence, both $\mathcal{I}$ and $\mathcal{J}$ are ultimately elliptic integrals and can be reduced to standard form by the usual algorithms.

