Definite trigonometric integral This question is motivated by Iterative Mean, Covariance Algorithm Convergence: 
Is there a closed form for the integral
$$
\int_0^{2 \pi} \frac{\sin^n(\theta)\cos^m(\theta)}{A\sin^2(\theta)+B\cos^2(\theta)+2C\sin(\theta)\cos(\theta)} d\theta\,?
$$
where $AB \geq C^2$ and $m,n \in \{0,1,2,3,4\}$
 A: Dividing the numerator and denominator by $\cos^2 \theta$ we get 
$$I = \int_0^{2\pi } {\frac{{{{\sin }^n}\theta {{\cos }^{m - 2}}\theta }}{{A{{\tan }^2}\theta  + 2C\tan \theta  + B}}d\theta }.$$
Now let us solve the equation $$A{{\tan }^2}\theta  + 2C\tan \theta  + B=0$$ for simplicity we let $u=\tan \theta$, so that the equation become $A{u^2} + 2Cu + B = 0$. Using the general law we get 
\begin{align}
{u_{1,2}} = \frac{{ - b \pm \sqrt {{b^2} - 4ac} }}{{2a}} &= \frac{{ - 2C \pm \sqrt {4{C^2} - 4AB} }}{{2A}}
\\
&= \frac{{ - C \pm \sqrt {{C^2} - AB} }}{A}
\\
&= \frac{{ - C \pm i\sqrt {AB - {C^2}} }}{A}\,\,\,\,\,\,\,\,\,\,\,\,\,\,\left( {\text{since} \,\,\,AB \ge {C^2}} \right)
\end{align} 
Thus
$${A{{\tan }^2}\theta  + 2C\tan \theta  + B}
=\left( {\tan \theta  - \frac{{-C + i\sqrt {AB - {C^2}} }}{A}} \right)\left( {\tan \theta  - \frac{{-C - i\sqrt {AB - {C^2}} }}{A}} \right)$$
Substituting
$$\cos \theta  = \frac{{z + {z^{ - 1}}}}{2},\sin \theta  = \frac{{z - {z^{ - 1}}}}{{2i}},\tan \theta  =  - i\frac{{z - {z^{ - 1}}}}{{z + {z^{ - 1}}}},d\theta  = \frac{{dz}}{{iz}}$$
in $I$ and simplify to get 
\begin{align}
I&=\int_C {\frac{{{{\left( {\frac{{z - {z^{ - 1}}}}{{2i}}} \right)}^n}{{\left( {\frac{{z + {z^{ - 1}}}}{2}} \right)}^{m - 2}}}}{{\left( { - i\frac{{z - {z^{ - 1}}}}{{z + {z^{ - 1}}}} - \frac{{ - C + i\sqrt {AB - {C^2}} }}{A}} \right)\left( { - i\frac{{z - {z^{ - 1}}}}{{z + {z^{ - 1}}}} - \frac{{ - C - i\sqrt {AB - {C^2}} }}{A}} \right)}}\frac{{dz}}{{iz}}} 
\\
&= \int_C {\frac{{{{\left( {{z^2} - 1} \right)}^n}}}{{{{\left( {2i} \right)}^n}{z^n}}}\frac{{{{\left( {{z^2} + 1} \right)}^{m - 2}}}}{{{2^{m - 2}}{z^{m - 2}}}}\frac{{{{\left( {{z^2} + 1} \right)}^2}}}{{\left( {i - {u_1} - \left( {i + {u_1}} \right){z^2}} \right)\left( {i - {u_2} - \left( {i + {u_2}} \right){z^2}} \right)}}\frac{{dz}}{{iz}}}
\\
&= \frac{1}{{{2^{m - 2}}i{{\left( {2i} \right)}^n}}}\int_C {\frac{{{{\left( {{z^2} - 1} \right)}^n}{{\left( {{z^2} + 1} \right)}^m}}}{{{z^{n + m - 1}}\left( {i - {u_1} - \left( {i + {u_1}} \right){z^2}} \right)\left( {i - {u_2} - \left( {i + {u_2}} \right){z^2}} \right)}}dz} 
\end{align}
now factor the denominator and find the singularities ... i think you can proceed, 
where $C$ is the unit circle.
\begin{align}
\int_0^{2\pi } {f\left( {\cos \theta ,\sin \theta } \right)d\theta }  = 2\pi i\sum {\text{residues of $f\left( z \right)$ inside the unit circle}}
\end{align}
Do not forget that $z^{m+n-1}$ have three cases $m+n=1$, $m=n=0$, $m+n>1$.
