TITLE: Does $\int_0^{2 \pi} \sqrt{1-(a+b \sin\phi)^2} d\phi $ have a closed form in terms of elliptic integrals?
QUESTION [5 upvotes]: Consider the following integral for real $a, b$ such that the square root is real:
\begin{equation}
I=\int_0^{2 \pi} \sqrt{1-(a+b \sin\phi)^2} d\phi
\end{equation}
For $a = 0$, the integral is easily expressed in terms of the complete elliptic function of the second kind. Does the integral have a closed form (in terms of special functions) for arbitrary $a$? Mathematica did not yield a useful result, even for specific exact values of $a,b$.

REPLY [7 votes]: Result:
$$\boxed{\displaystyle \mathcal{I}=4\sqrt{\frac{b}{k}}\,\biggl[\mathbf{E}\left(k^2\right)-\left(1-k^2\right)\mathbf{K}\left(k^2\right)+\left(1-k^2\right)\Pi\left(c^{-2}|k^2\right)\biggr]} \tag{$\heartsuit$}$$
where I follow Mathematica conventions for arguments of $\mathsf{EllipticE}$, $\mathsf{EllipticK}$ and $\mathsf{EllipticPi}$, and the parameters $k$ and $c$ are defined below by (0) and (2), respectively.

Derivation:
$\square$ The underlying elliptic curve $\mathcal{C}$ is described by the equation
$$y^2=\left(1-z^2\right)\left(1-(a+bz)^2\right).$$
Topologically this is a torus realized as a two-sheeted covering of $\mathbb{P}^1$ branched at $4$ points $z_{1\ldots4}=\pm1,\frac{\pm1-a}{b}$. These can be put to $\pm1,\pm k^{-1}$ by a fractional linear transformation. Such transformations preserve the anharmonic ratio, which allows to identify
$$\frac{z_{21}z_{43}}{z_{31}z_{42}}=\frac{4b}{a^2-(1-b)^2}=-\frac{4k}{(1-k)^2}.$$
Choose a solution
$$k=\frac{1+b^2-a^2-\sqrt{(1+b^2-a^2)^2-4b^2}}{2b}.\tag{0}$$
The relevant fractional linear transformation bringing $\mathcal{C}$ to the standard Legendre form is thus 
$$z=\frac{a w+(k-b)}{(k-b) w+a}.$$

After these preliminary remarks, we can implement the corresponding change of variables in the integral we are interested in:
\begin{align}
\mathcal{I}=&\int_0^{2\pi}\sqrt{1-(a+b\sin\phi)^2}\,d\phi=\\=& 2\int_{-\frac{\pi}{2}}^{\frac{\pi}{2}}\sqrt{1-(a+b\sin\phi)^2}\,d\phi=\\
=&2\int_{-1}^1 \sqrt{\frac{1-(a+bz)^2}{1-z^2}}dz=\\=&2\left[\frac{a^2}{(b-k)^2}-1\right]\sqrt{\frac{b}{k}}\int_{-1}^1\sqrt{\frac{1-k^2w^2}{1-w^2}}\frac{dw}{\left(w-\frac{a}{b-k}\right)^2}=\\
=&2\left(c^2-1\right)\sqrt{\frac{b}{k}}\int_{-1}^1\frac{1-k^2w^2}{\left(w-c\right)^2}\frac{dw}{\lambda},\tag{1}
\end{align}
with $\lambda=\sqrt{(1-w^2)(1-k^2w^2)}$ and 
$$c=\frac{a}{b-k}.\tag{2}$$
It is possible to reduce the last integral to a combination of integrals of three types:
$$\int\frac{dw}{\lambda},\qquad \int\frac{w^2dw}{\lambda},\qquad \int\frac{dw}{(w-c)\lambda},\tag{3}$$
producing elliptic integrals of the 1st, 2nd and 3rd type, respectively.
The idea is to write
\begin{align}
\frac{1-k^2w^2}{\left(w-c\right)^2}\frac{1}{\lambda}=\left[\alpha+\frac{\beta}{w-c}+\frac{\gamma}{(w-c)^2}\right]\frac{1}{\lambda}
\end{align}
The $\alpha$- and $\beta$-term give elliptic integrals of the 1st and 3rd type. To reduce the $\gamma$-term to integrals of type (3), compare it with the derivative 
\begin{align}\frac{d}{dw}\frac{\lambda}{w-c}=-\frac{(c^2-1)(c^2k^2-1)}{(w-c)^2\lambda}
-\frac{c(c^2k^2-1)+ck^2(c^2-1)}{(w-c)\lambda}+\frac{k^2(w^2-c^2)}{\lambda}.
\end{align}

Altogether this allows us to write
$$\frac{1-k^2w^2}{\left(w-c\right)^2}\frac{1}{\lambda}=\frac{1}{c^2-1}\left[\frac{d}{dw}\frac{\lambda}{w-c}-\frac{c(1-k^2)}{(w-c)\lambda}+\frac{k^2(1-w^2)}{\lambda}\right],$$
which in turn implies
$$\mathcal{I}=2\sqrt{\frac{b}{k}}\int_{-1}^1\left[-\frac{c(1-k^2)}{(w-c)\lambda}+\frac{k^2(1-w^2)}{\lambda}\right]dw.$$
After some straightforward algebra, this finally gives the above result ($\heartsuit$). $\blacksquare$