中学时学习了三角函数,下面这类图象天天看也没啥特别感觉,但是对于数学大咖而言就不一样了:
傅里叶大神看到这些图象后,提出了一个重要思想:任何一个周期性的函数,都可以用一系列三角函数叠加模拟出来,比如:
\[f(x) = sin(x) + \frac{sin(3x)}{3} + \frac{sin(5x)}{5}+\frac{sin(7x)}{7}+\frac{sin(9x)}{9}... \tag{1} \]叠加起来效果如下,得到了一个"方波":
\[\begin{aligned} f(t) &= \sum_{n=0}^{\infty} \left [ a_n cos(n t)+b_n sin(n t) \right ] \\\\ &= a_0 + a_1cos( t) + b_1sin( t) + a_2cos(2 t) + b_2sin(2 t) + ... + a_ncos(n t) + b_nsin(n t) + ... \end{aligned} \tag{2} \]这里面的an,bn系数怎么求呢?别急,先回忆几个中学学过的三角函数积化和差公式
\[\begin{aligned} sin \alpha \cdot cos \beta &= {1 \over 2} [sin(\alpha + \beta) + sin(\alpha - \beta)] \\ \\ cos\alpha \cdot sin\beta &= \frac{1}{2}[sin(\alpha+\beta)-sin(\alpha-\beta)] \\ \\ sin \alpha \cdot sin \beta &= -{1 \over 2} [cos(\alpha + \beta) - cos(\alpha-\beta)] \\ \\ cos\alpha \cdot cos\beta &= \frac{1}{2}[cos(\alpha+\beta)+cos(\alpha-\beta)] \\ \\ sin^2\alpha &= \frac{1-cos2\alpha}{2} \\ \\ cos^2\alpha &= \frac{1+cos2\alpha}{2} \end{aligned} \tag{3} \]再回忆2个大学数学中的三角函数积分公式
\[ \begin{aligned} \int sinxdx &= -cosx+c \\ \\ \int cosxdx &= sinx+c \end{aligned} \tag{4} \]有了上面这些基本公式,先来证明几个恒等式:
\[ \begin{aligned} \int_{0}^{2\pi}sin(mt)dt &=0 , (m \ne 0) \end{aligned} \tag{a} \] \[ \begin{aligned} \int_{0}^{2\pi}cos(mt)dt &=0,(m \ne 0) \\ \end{aligned} \tag{b} \] \[ \begin{aligned} \int_{0}^{2\pi}sin(mt) \cdot cos(nt)dt &=0,(m \ne n , m \ne -n) \\ \end{aligned} \tag{c} \] \[ \begin{aligned} \int_{0}^{2\pi}cos(mt) \cdot cos(nt)dt &=0,(m \ne n , m \ne -n) \\ \end{aligned} \tag{d} \] \[ \begin{aligned} \int_{0}^{2\pi}sin(mt) \cdot sin(nt)dt &=0,(m \ne n , m \ne -n) \\ \end{aligned} \tag{e} \] \[ \begin{aligned} \int_{0}^{2\pi}sin^2(mt) dt &=\pi,(m \ne 0) \\ \end{aligned} \tag{f} \] \[ \begin{aligned} \int_{0}^{2\pi}cos^2(mt)dt &=\pi,(m \ne 0) \\ \end{aligned} \tag{g} \]证明过程也不复杂,比如(a)式:
\[ \begin{aligned} \int_{0}^{2\pi}sin(mt)dt &= \frac{1}{m}\int_{0}^{2\pi}sin(mt)d(mt) \\\\ &= -\frac{1}{m} cos(mt)|_0^{2\pi} //根据积分公式(4)\\\\ &= -\frac{1}{m}[cos(2m\pi)-cos(0)] //牛顿-莱布尼茨公式展开\\ \\ &= -\frac{1}{m} \cdot 0 \\\\ &= 0 ,(m\neq0) \end{aligned} \](b)式的证明过程类似,留给同学们自己去练习。(c)、(d)、(e)式的证明过程也是类似的,以(c)式为例:
\[ \begin{aligned} \int_{0}^{2\pi}sin(mt) \cdot cos(nt)dt &= \frac{1}{2}\int_{0}^{2\pi}[sin(m+n)+sin(m-n)]dt //根据公式(3)\\\\ &= \frac{1}{2}\int_{0}^{2\pi}sin(m+n)dt + \frac{1}{2}\int_0^{2\pi}sin(m-n)dt \\\\ &= 0-0 ,( [m+n]\ne0 ,[m-n]\ne0) //根据(a)式 \\\\ &=0 \end{aligned} \](f)、(g)式的证明同样类似,以(f)式为例:
\[ \begin{aligned} \int_{0}^{2\pi}sin^2(mt) dt &= \frac{1}{2}\int_0^{2\pi} [1-cos(2m)]dt \\\\ &= \frac{1}{2}\int_0^{2\pi} dt-\frac{1}{2}\int_0^{2\pi}cos(2m)dt \\\\ &= \frac{1}{2}t|_0^{2\pi} \\\\ &= \frac{1}{2}(2\pi-0) \\\\ &= \pi \end{aligned} \]傅里叶级数系数的求解:
对(2)二边求积分:
\[ \begin{aligned} \int_{0}^{2\pi}f(t)dt &= \int_{0}^{2\pi}\sum_{n=0}^{\infty} \left [ a_n cos(n t)+b_n sin(n t) \right ]dt \\\\ &=\int_{0}^{2\pi}a_0dt + \int_{0}^{2\pi}a_1cos(t)dt + \int_{0}^{2\pi}b_1sin(t)dt + ... + \int_{0}^{2\pi}a_ncos(nt)dt + \int_{0}^{2\pi}b_nsin(nt)dt + ... \\\\ &=a_0\int_{0}^{2\pi}dt + a_1\int_{0}^{2\pi}cos(t)dt + b_1\int_{0}^{2\pi}sin(t)dt + ... + a_n\int_{0}^{2\pi}cos(nt)dt + b_n\int_{0}^{2\pi}sin(nt)dt + ... \\\\ &=a_0|^{2\pi} _0 + 0 + 0 + ... //注:根据上面的恒等式(a)(b) \\\\ &=a_0 \cdot 2\pi - a_0 \cdot 0 \\\\ &=2\pi \cdot a_0 \\ \end{aligned} \] \[ \begin{aligned} &\Downarrow \\ a_0 &= \frac{1}{2\pi}\int_{0}^{2\pi}f(t)dt \end{aligned} \tag{1-1} \] \[ 我们知道定积分的几何意义:被积函数与坐标轴围成的面积,x轴之上部分为正,x轴之下部分为负; \\ 对于周期为 2\pi 的函数f(t)来说,\frac{1}{2\pi}\int_{0}^{2\pi}f(t)dt 正好是面积在周期上的平均值 \]接下来求系数an,二边同乘cos(nt)并求积分:
\[\begin{aligned} \int_{0}^{2\pi} f(t)cos(nt) dt &= \int_{0}^{2\pi}\sum_{n=0}^{\infty} \left [ a_n cos(n t)cos(nt)+b_n sin(n t)cos(nt) \right ]dt \\\\ &= a_0 \int_{0}^{2\pi} cos(nt)dt + a_1\int_{0}^{2\pi} cos( t)cos(nt)dt + b_1 \int_{0}^{2\pi} sin( t)cos(nt)dt + ... + a_n \int_{0}^{2\pi} cos(n t)cos(nt)dt + b_n \int_{0}^{2\pi} sin(n t)cos(nt)dt + ... \\\\ &= 0+ ...+a_n \int_{0}^{2\pi} cos(n t)cos(nt)dt +... // 参考前的恒等式(a)至 (g) \\\\ &= a_n*\pi \end{aligned} \] \[\begin{aligned} &\Downarrow \\ a_n &= \frac{1}{\pi}\int_{0}^{2\pi}f(t)cos(nt)dt \\ \end{aligned} \tag{1-2} \]类似的方法,二边同乘sin(nt),然后求积分,就能得到bn:
\[\begin{aligned} \int_{0}^{2\pi} f(t)sin(nt) dt &= \int_{0}^{2\pi}\sum_{n=0}^{\infty} \left [ a_n cos(n t)sin(nt)+b_n sin(n t)sin(nt) \right ]dt \\\\ &= a_0\int_{0}^{2\pi}sin(nt)dt+ a_1\int_{0}^{2\pi} cos( t)sin(nt)dt + b_1 \int_{0}^{2\pi} sin( t)sin(nt)dt + ... + a_n \int_{0}^{2\pi} cos(n t)sin(nt)dt + b_n \int_{0}^{2\pi} sin(n t)sin(nt)dt + ... \\\\ &= 0+...+b_n \int_{0}^{2\pi} sin(n t)sin(nt)dt+... // 参考前的恒等式(a)至 (g) \\\\ &= b_n*\pi \end{aligned} \] \[\begin{aligned} &\Downarrow \\ b_n &= \frac{1}{\pi}\int_{0}^{2\pi}f(t)sin(nt)dt \\ \end{aligned} \tag{1-3} \]有了这几个系数的通用解,下面具体来应用一下,假设有一个方波函数,在1个周期内的值如下:
\[f(x)=\begin{cases} 3, & x\in[0,\pi] \\ 0, & x\in(\pi,2\pi] \end{cases} \]套用刚才解出来的公式:
\[\begin{aligned} a_0 &=\frac{1}{2\pi}\int_{0}^{2\pi}f(x)dx\\\\ &=\frac{1}{2\pi}[\int_{0}^{\pi}3dx+\int_{\pi}^{2\pi}0dx] \\\\ &=\frac{1}{2\pi}[3x|_0^\pi+0x|_\pi^{2\pi}] \\\\ &=\frac{3}{2} \end{aligned} \] \[\begin{aligned} a_n &= \frac{1}{\pi}\int_{0}^{2\pi}f(x)cos(nx)dx \\\\ &=\frac{1}{\pi}[\int_0^{\pi}3cos(nx)dx+\int_\pi^{2\pi}0cos(nx)dx] \\\\ &=\frac{3}{\pi}\int_0^{\pi}cos(nx)dx \\\\ &=\frac{3}{n\pi}\int_0^{\pi}cos(nx)d(nx) \\\\ &=\frac{3}{n\pi}sin(nx)|_0^\pi \\\\ &=0 ,(n>1) \end{aligned} \]即:所有cos(nx)前的系数都是0,展开结果中不包含余弦项。
\[\begin{aligned} b_n &= \frac{1}{\pi}\int_{0}^{2\pi}f(x)sin(nx)dx \\\\ &=\frac{1}{\pi}[\int_0^{\pi}3sin(nx)dx+\int_\pi^{2\pi}0sin(nx)dx] \\\\ &=\frac{3}{\pi}\int_0^{\pi}sin(nx)dx \\\\ &=\frac{3}{n\pi}\int_0^{\pi}sin(nx)d(nx) \\\\ &=\frac{-3}{n\pi}cos(nx)|_0^\pi \\\\ &=\frac{-3}{n\pi}[cos(n\pi)-1] \\\\ &=\begin{cases} 0, & x\in[偶数] \\ \frac{6}{n\pi}, & x\in[奇数] \end{cases} \end{aligned} \]画出来效果如下: