Contour integral for a sine-squared trigonometric quotient (source code)

= Contour integral for a sine-squared trigonometric quotient
{title2=$J(a,b)=2\pi(a-\sqrt{a^2-b^2})/b^2$}

For $a>b>0$, substitution $z=e^{i\theta}$ gives poles at zero and the two roots of $bz^2+2az+b$. The inside-pole <residues> sum to $(a-\sqrt{a^2-b^2})/(ib^2)$, so
$$
\int_0^{2\pi}\frac{\sin^2\theta}{a+b\cos\theta}\,d\theta=\frac{2\pi}{b^2}(a-\sqrt{a^2-b^2}).
$$
The double pole at zero is essential; omitting it gives the wrong sign and value.