指数乘三角函数型积分的3种解法

随笔

Posted by Welt Xing on December 16, 2021

问题引入

求积分

\[\int e^x\cos x\mathrm dx\]

该问题其实在大一的高等数学课上就已经接触过,但囿于笔者记性不好,这里重新记录一下解法。

事实上,我们对问题进行扩展,也就是求积分

\[\int e^{ax}\cos(bx)\mathrm dx\]

这里$\cos$函数可以替换成$\sin x$,做法类似。

分布积分法

利用两次分部积分,求出上式:

\[\begin{aligned} \int e^{ax}\cos(bx)\mathrm dx &=\frac1a\int\cos(bx)\mathrm de^{ax}\\ &=\frac1ae^{ax}\cos(bx)-\frac1a\int e^{ax}\mathrm d\cos(bx)\\ &=\frac1ae^{ax}\cos(bx)+\frac ba\int e^{ax}\sin(bx)\mathrm dx\\ &=\frac1ae^{ax}\cos(bx)+\frac b{a^2}\int\sin(bx)\mathrm de^{ax}\\ &=\frac1ae^{ax}\cos(bx)+\frac b{a^2}e^{ax}\sin(bx)-\frac{b^2}{a^2}\int e^{ax}\cos(bx)\mathrm dx\\ (1+\dfrac{b^2}{a^2})\int e^{ax}\cos(bx)\mathrm dx&=\frac{e^{ax}}{a^2}(a\cos(bx)+b\sin (bx))\\ \int e^{ax}\cos(bx)\mathrm dx&=\dfrac{e^{ax}(a\cos(bx)+b\sin (bx))}{a^2+b^2}+C \end{aligned}\]

待定系数法

我们思考什么样的函数求导后是$e^{ax}\cos(bx)$的形式,考虑$e^xf(x)$求导的特性,我们得知形如

\[f(x)=e^{ax}(m\cos bx+n\sin bx)\]

的函数,才有可能求导出目标形式,我们只需要求导,然后求出未知参数$m,n$即可:

\[\begin{aligned} f'(x) &=e^{ax}(am\cos bx+an\sin bx-bm\sin bx+bn\cos bx)\\ &=e^{ax}((am+bn)\cos bx+(an-bm)\sin bx)\\ &=e^{ax}\cos bx \end{aligned}\]

从而有

\[\begin{cases} am+bn=1\\ an-bm=0\\ \end{cases}\]

解得

\[\begin{cases} m=\dfrac{a}{a^2+b^2}\\ n=\dfrac{b}{a^2+b^2} \end{cases}\]

从而原函数为

\[f(x)=\frac{e^{ax}(a\cos bx+b\sin bx)}{a^2+b^2}+C\]

复数积分

考虑欧拉公式

\[e^{jt}=\cos t+j\sin t\]

我们有

\[\cos bx=\frac{e^{jbx}+e^{-jbx}}{2}\]

从而问题变成了简单的指数积分:

\[\begin{aligned} \int e^{ax}\cos bx\mathrm dx &=\frac12\int e^{ax}(e^{jbx}+e^{-jbx})\mathrm dx\\ &=\frac{1}{2}\bigg(\frac{e^{(a+jb)x}}{a+jb}+\frac{e^{(a-jb)x}}{a-jb}\bigg)+C\\ &=\frac{e^{ax}}2\frac{2a\cos ax+2b\sin bx}{a^2+b^2}+C\\ &=\frac{e^{ax}(a\cos ax+b\sin bx)}{a^2+b^2}+C\\ \end{aligned}\]

三种解法的结果相同。上式其实在第二行时已经求解完成了,后面只是将其转换成实值形式,以和前面进行比较。笔者比较推荐的是第三种解法,尤其是在求定积分的时候,因为避免了三角函数运算,提高了计算效率。