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

$\int_{-\infty}^{\infty}\frac{P(x)}{Q(x)}e^{imx}dx$

$\int_0^{\infty}\frac{\cos x}{x^2+1}dx=\frac{1}{2}\int_{-\infty}^{\infty}\frac{\cos x}{x^2+1}dx$

$\oint_{\Gamma}\frac{e^{iz}}{(1+z^2)}=2\pi i\text{Res}(f(z),i)$

\begin{align*}\text{Res}(f(z),i)&=\lim_{z\to i}(z-i)\frac{e^{iz}}{(z+i)(z-i)}\\ &=\lim_{z\to i}\frac{e^{iz}}{z+i}=\frac{e^{-1}}{2i}\end{align*}

$\oint_{\Gamma}\frac{e^{iz}}{(1+z^2)}=2\pi i\cdot\frac{e^{-1}}{2i}=\frac{\pi}{e}$

\begin{align*}\left|\int_{\Gamma_R}\frac{e^{iz}}{z^2+1}dz\right|&\le \frac{1}{R^2-1}\left|\int_{\Gamma_R}e^{ix-y}dz\right|\\&\le \frac{1}{R^2-1}\left|\int_0^{\pi}e^{ix-y}iRe^{i\theta}d\theta\right|\\ &\le \frac{2R}{R^2-1}\int_0^{\frac{\pi}{2}}e^{-y}Rd\theta\\&=\frac{2R}{R^2-1}\int_{\Gamma_R}e^{-R\sin\theta}d\theta\end{align*}

\begin{align*}\frac{2R}{R^2-1}\int_{\Gamma_R}e^{-R\sin\theta}d\theta&\le \frac{2R}{R^2-1}\int_0^{\frac{\pi}{2}}e^{-R\frac{2}{\pi}\theta}d\theta\\ &=\frac{R}{R^2-1}\cdot\left(-\frac{\pi}{2R}\right)\cdot e^{-R\frac{2}{\pi}\theta}\Big|_0^{\frac{\pi}{2}}\\ &=\frac{\pi}{R^2-1}(1-e^{-R})\to 0\end{align*}

$\int_{-\infty}^{\infty}\frac{e^{ix}}{x^2+1}dx=\frac{\pi}{e}$

\begin{align*}\int_0^{\infty}\frac{\cos x}{x^2+1}dx&=\frac{1}{2}\int_{-\infty}^{\infty}\frac{\cos x}{x^2+1}dx\\ &=\frac{1}{2}\text{Re}\int_{-\infty}^{\infty}\frac{e^{ix}}{x^2+1}dx\\ &=\frac{\pi}{2e}\end{align*}