# 奇延拓，偶延拓与傅里叶级数

1，周期延拓：我们先考虑周期延拓，若 $$f(x)$$ 为定义在 $$[-\pi,\pi]$$ 上，则定义

$\begin{cases}F(x)=f(x),\quad & x\in [-\pi,\pi]\\ F(x+2\pi)=F(x)&\end{cases}$

2，奇延拓：若函数 $$f(x)$$ 定义在 $$(0,\pi]$$ 上，定义

$F(x)=\begin{cases}f(x),\quad &x\in(0,\pi]\\ 0, &x=0\\ -f(-x), & x\in (-\pi, 0)\end{cases}$

3，偶延拓：若函数 $$f(x)$$ 定义在 $$(0,\pi]$$ 上，定义

$F(x)=\begin{cases}f(x),\quad &x\in(0,\pi]\\ f(-x), & x\in (-\pi, 0)\end{cases}$

\begin{align*}b_n&=\frac{2}{\pi}\int_{0}^{\pi}F(x)\sin nxdx\\ &=\frac{2}{\pi}\int_{0}^{\frac{\pi}{2}}\cos x\sin nxdx\\ &=\frac{2}{\pi}\int_{0}^{\frac{\pi}{2}}\frac{1}{2}\left(\sin(n+1)x+\sin(n-1)x\right)dx\\ &=\frac{2}{\pi}\left(-\frac{1}{n+1}\cos(n+1)x-\frac{1}{n-1}\cos(n-1)x\right)\Big|_0^{\frac{\pi}{2}}\\ &=\frac{2}{\pi}\left(-\frac{1}{n+1}\cos\frac{(n+1)\pi}{2}-\frac{1}{n-1}\cos\frac{(n-1)\pi}{2}+\frac{1}{n+1}+\frac{1}{n-1}\right)\\ &=\frac{2}{\pi}\left(-\frac{1}{n+1}\sin\frac{n\pi}{2}-\frac{1}{n-1}\sin\frac{n\pi}{2}+\frac{1}{n+1}+\frac{1}{n-1}\right)\\ &=\frac{2}{\pi(n^2-1)}\left(n-\sin\frac{n\pi}{2}\right)\end{align*}

$$n=1$$ 时，上面的计算不成立，我们需要另外计算

\begin{align*}b_1&=\frac{2}{\pi}\int_{0}^{\pi}f(x)\sin xdx\\&=\frac{2}{\pi}\int_{0}^{\frac{\pi}{2}}\cos x\sin xdx\\ &=\frac{2}{\pi}\cdot\frac{1}{2} \sin^2x\Big|_0^{\frac{\pi}{2}}=\frac{1}{\pi}\end{align*}

$f(x)=\frac{1}{\pi}\sin x+\sum_{n=2}^{\infty}\frac{2}{\pi(n^2-1)}\left(n-\sin\frac{n\pi}{2}\right)\sin nx$

（2）将 $$f(x)$$ 作偶延拓，

\begin{align*}F(x)&=\begin{cases}f(x),\quad & x\in(0,\pi],\\ f(-x), & x\in (-\pi, 0)\end{cases}\\ &=\begin{cases}0,& x\in[-\pi,-\frac{\pi}{2}]\\ \cos x,& \in [-\frac{\pi}{2},0)\\ \cos x, \quad & x\in [0,\frac{\pi}{2})\\ 0,& x\in [\frac{\pi}{2}, \pi]\end{cases}\end{align*}

\begin{align*}a_0&=\frac{2}{\pi}\int_0^{\pi}F(x)dx=\int_0^{\frac{\pi}{2}}\cos xdx=\frac{2}{\pi}\sin x\Big|_0^{\frac{\pi}{2}}=\frac{2}{\pi}\end{align*}

\begin{align*}a_n&=\frac{2}{\pi}\int_0^{\pi}F(x)\cos nxdx=\frac{2}{\pi}\int_0^{\frac{\pi}{2}}\cos x\cos nxdx\\ &=\frac{2}{\pi}\int_0^{\frac{\pi}{2}}\frac{1}{2}(\cos(n+1)x+\cos(n-1)x)dx\\ &=\frac{1}{\pi}\left(\frac{1}{n+1}\sin (n+1)x+\frac{1}{n-1}\sin(n-1)x\right)\Big|_0^{\frac{\pi}{2}}\\ &=\frac{1}{\pi}\left(\frac{1}{n+1}\sin \frac{(n+1)\pi}{2}+\frac{1}{n-1}\sin\frac{(n-1)\pi}{2}\right)\\ &=\frac{1}{\pi}\left(-\frac{1}{n+1}\cos \frac{n\pi}{2}+\frac{1}{n-1}\cos\frac{n\pi}{2}\right)\end{align*}

\begin{align*}a_1&=\frac{2}{\pi}\int_0^{\frac{\pi}{2}}\cos x\cos xdx\\ &=\frac{2}{\pi}\frac{1+\cos 2x}{2}dx\\ &=\frac{1}{\pi}\left(x+\frac{1}{2}\sin 2x\right)\Big|_0^{\frac{\pi}{2}}\\ &=\frac{1}{2}\end{align*}

$f(x)=\frac{1}{\pi}+\frac{1}{2}\cos x+\sum_{n=2}^{\infty}\frac{1}{\pi}\left(-\frac{1}{n+1}\cos \frac{n\pi}{2}+\frac{1}{n-1}\cos\frac{n\pi}{2}\right)\cos nx$