# 利用留数定理计算定积分（一）：三角有理函数的积分

1，积分 $$\displaystyle\int_0^{2\pi}R(\sin\theta,\cos\theta)d\theta$$ 可以通过适当的变换化成单位圆上的复变函数的积分。

$\sin\theta=\frac{e^{i\theta}-e^{-i\theta}}{2i}=\frac{z-z^{-1}}{2i},\quad \cos\theta=\frac{e^{i\theta}+e^{-i\theta}}{2}=\frac{z+z^{-1}}{2}$

$dz=ie^{i\theta}d\theta\quad\Rightarrow \quad d\theta=\frac{dz}{iz}$

$\int_0^{2\pi}R(\sin\theta,\cos\theta)d\theta=\int_{|z|=1}R\left(\frac{z-z^{-1}}{2i},\frac{z+z^{-1}}{2}\right)\frac{dz}{iz}$

\begin{align*}\int_0^{2\pi}\frac{d\theta}{2+\cos\theta}d\theta&=\int_{|z|=1}\frac{1}{2+\frac{z+z^{-1}}{2}}\frac{dz}{iz}\\ &=\frac{2}{i}\int_{|z|=1}\frac{dz}{z^2+4z+1}\end{align*}

\begin{align*}\text{Res}(f(z),-2+\sqrt3)&=\lim_{z\to -2+\sqrt3}(z-(-2+\sqrt3))f(z)\\ &=\lim_{z\to -2+\sqrt3}(z+2-\sqrt3))\frac{1}{(z+2-\sqrt3)(z+2+\sqrt{3})}\\ &=\frac{1}{2\sqrt3}\end{align*}

\begin{align*}\int_0^{2\pi}\frac{d\theta}{2+\cos\theta}d\theta&=\frac{2}{i}\cdot 2\pi i\cdot\text{Res}(f(z),-2+\sqrt3) \\ &=4\pi \cdot \frac{1}{2\sqrt3}=\frac{2\pi}{\sqrt3}\end{align*}

\begin{align*}\int_0^{2\pi}\frac{\cos\theta}{1-2p\cos\theta+p^2}d\theta&=\int_{|z|=1}\frac{\frac{z^2+z^{-2}}{2}}{1-2p\cdot\frac{z+z^{-1}}{2}+p^2}\frac{dz}{iz}\\ &=\int_{|z|=1}\frac{z^4+1}{2z^2-2p z^3-2p z+2p^2z^2}\frac{dz}{iz}\\ &=\int_{|z|=1}\frac{z^4+1}{2iz^2(z-pz^2-p+p^2z)}dz\\ &=\int_{|z|=1}\frac{z^4+1}{2iz^2(z-p)(1-pz)}\end{align*}

$$z=p$$ 时，

$\text{Res}(f(z),p)=\lim_{z\to p}(z-p)\cdot\frac{z^4+1}{2iz^2(1-pz)}=\frac{p^4+1}{2ip^2(1-p^2)}$

$$z=0$$ 时，

\begin{align*}\text{Res}(f(z),p)&=\left[\frac{z^4+1}{2i(z-pz^2-p+p^2z)}\right]’\Big|_{z=0}\\ &=\frac{4z^3\cdot 2i(z-pz^2-p+p^2z^2)-(z^4+1)(2i(1-2pz+p^2))}{(2i(z-pz^2-p+p^2z))^2}\Big|_{z=0}\\ &=\frac{-2i(1+p^2)}{-4p^2}\Big|_{z=0}=\frac{i(1+p^2)}{2p^2}\end{align*}