前言
建议在看本文章时动笔算一算。
概述
泰勒展开用于近似一个函数在某个点附近的值。
通过泰勒展开,你可以把某个简单的东西拉长。看上去是复杂化了,但在某些情况下,化简后你可以完成一些不可思议的操作。
一些看似非常难求的东西,用上泰勒展开就好求了。
举例
本质
泰勒展开的本质是通过用高次函数来模拟目标函数曲线。
公式
泰勒展开(Taylor Series):
在 $a$ 处展开 $f\left(x\right)$:
$$f\left(x\right) = \sum\limits_{n = 0}^\infin \frac{f^{\left(n\right)}\left(x - a\right)}{n!}\left(x - a\right)^n$$
一般情况下都会在 $a = 0$ 处展开,在这种普通又特殊情况下,我们可以称它为 麦克劳林展开(Maclaurin Series):
$$f\left(x\right) = \sum\limits_{n = 0}^\infin \frac{f^{\left(n\right)}\left(0\right)}{n!}x^n$$
证明
我们知道,$f\left(x\right)$ 可以表示成 $\displaystyle\sum\limits_{n \geq 0} a_n x^n$。
当 $x = 0$ 时,$f\left(x\right) = a_0$
因此,对给定的函数进行微分,就变成了
$$f'\left(x\right) = a_1 + 2a_2x + 3a_3x^2 + 4a_4x^3 + \cdots$$
当 $x = 0$ 时,$f'\left(x\right) = a_1$
再次微分,我们得到
$$f''\left(x\right) = 2a_2 + 6a_3x +12a_4x^2 + \cdots$$
当 $x = 0$ 时,$f''\left(x\right) = 2a_2$
再一次这么做,$f'''\left(x\right) = 6a_3$
每项除以对应阶乘即可。
$$f\left(x\right) = \sum\limits_{n = 0}^\infin \frac{f^{\left(n\right)}\left(0\right)}{n!}x^n$$
例子
在 $0$ 处展开 $f\left(x\right) = e^x$
这是最简单的例子。
$f'\left(x\right)$ 也等于 $e^x$。
取 $x = 0$,$e^0 = 1$。于是:
$$f\left(x\right) = \sum\limits_{n = 0}^\infin \frac1{n!}x^n = \sum\limits_{n = 0}^\infin \frac{x^n}{n!}$$
在 $0$ 处展开 $f\left(x\right) = \dfrac1{1 - x}$
$f'\left(x\right)$ 等于 $\dfrac1{\left(1 - x\right)^2}$。
$f''\left(x\right)$ 等于 $\dfrac1{\left(1 - x\right)^3}$。
带入 $x = 0$,得到这些系数全是 $1$,所以:
$$f\left(x\right) = \frac1{1 - x} = \sum\limits_{n = 0}^\infin x^n$$
在 $0$ 处展开 $f\left(x\right) = e^{-x}$
直接列出求导列表:
$f^{\left(0\right)} = e^{-x}$
$f^{\left(1\right)} = -e^{-x}$
$f^{\left(2\right)} = e^{-x}$
$f^{\left(3\right)} = -e^{-x}$
同样的道理,套用公式:
$$f\left(x\right) = \sum\limits_{n = 0}^\infin \frac1{\left(-1\right)^nn!}x^n$$
这里给出一个更妙的方法:
还记得上一个例子吗?
$$f\left(x\right) = e^x = \sum\limits_{n = 0}^\infin \frac{x^n}{n!}$$
我们可以把这个改一下:
$$f\left(-x\right) = e^{-x} = \sum\limits_{n = 0}^\infin \frac{\left(-x\right)^n}{n!} = \sum\limits_{n = 0}^\infin \frac1{\left(-1\right)^nn!}x^n$$
在 $-4$ 处展开 $f\left(x\right) = e^{-x}$
非常简单:
$$f^{\left(n\right)}\left(x\right) = \left(-1\right)^ne^{-x}$$
$$f^{\left(n\right)}\left(-4\right) = \left(-1\right)^ne^4$$
直接套用泰勒展开公式:
$$\sum\limits_{n = 0}^\infin \frac{\left(-1\right)^ne^4}{n!}\left(x + 4\right)^n$$
在 $0$ 处展开 $f\left(x\right) = \cos\left(x\right)$
$f^{\left(0\right)} = \cos\left(x\right)$
$f^{\left(1\right)} = -\sin\left(x\right)$
$f^{\left(2\right)} = -\cos\left(x\right)$
$f^{\left(3\right)} = \sin\left(x\right)$
$f^{\left(4\right)} = \cos\left(x\right)$
$f^{\left(5\right)} = -\sin\left(x\right)$
$f^{\left(6\right)} = -\cos\left(x\right)$
$f^{\left(7\right)} = \sin\left(x\right)$
$f^{\left(0\right)}\left(0\right) = 1$
$f^{\left(1\right)}\left(0\right) = 0$
$f^{\left(2\right)}\left(0\right) = -1$
$f^{\left(3\right)}\left(0\right) = 0$
$f^{\left(4\right)}\left(0\right) = 1$
$f^{\left(5\right)}\left(0\right) = 0$
$f^{\left(6\right)}\left(0\right) = -1$
$f^{\left(7\right)}\left(0\right) = 0$
与之前的不同,导函数和导函数在 $x = 0$ 的值都没有一个简单的公式。
但是,注意到,$n$ 是奇数时函数在 $x = 0$ 的值为 $0$!
$$\underbrace {\,\,1\,\,}_{n = 0} + \underbrace {\,0\,}_{n = 1} - \underbrace {\frac{1}{{2!}}{x^2}}_{n = 2} + \underbrace {\,0\,}_{n = 3} + \underbrace {\frac{1}{{4!}}{x^4}}_{n = 4} + \underbrace {\,0\,}_{n = 5} - \underbrace {\frac{1}{{6!}}{x^6}}_{n = 6} + \cdots$$
于是:
$$\cos x = \underbrace {\,\,1\,\,}_{n = 0} - \underbrace {\frac{1}{{2!}}{x^2}}_{n = 1} + \underbrace {\frac{1}{{4!}}{x^4}}_{n = 2} - \underbrace {\frac{1}{{6!}}{x^6}}_{n = 3} + \cdots$$
所以:
$$\cos x = \sum\limits_{n = 0}^\infty {\frac{{{{\left( { - 1} \right)}^n}{x^{2n}}}}{{\left( {2n} \right)!}}}$$
在 $0$ 处展开 $f\left(x\right) = \sin\left(x\right)$
前面部分与上一个例子相同。
$$\sin x = \frac{1}{{1!}}x - \frac{1}{{3!}}{x^3} + \frac{1}{{5!}}{x^5} - \frac{1}{{7!}}{x^7} + \cdots = \sum\limits_{n = 0}^\infty {\frac{{{{\left( { - 1} \right)}^n}{x^{2n + 1}}}}{{\left( {2n + 1} \right)!}}}$$
在 $2$ 处展开 $f\left(x\right) = \ln\left(x\right)$
$$f^{\left( n \right)}\left( x \right) = \frac{{{{\left( { - 1} \right)}^{n + 1}}\left( {n - 1} \right)!}}{{{x^n}}}$$
$$\begin{aligned}\ln \left( x \right) &= \sum\limits_{n = 0}^\infty {\frac{{{f^{\left( n \right)}}\left( 2 \right)}}{{n!}}{{\left( {x - 2} \right)}^n}} \\ &= f\left( 2 \right) + \sum\limits_{n = 1}^\infty {\frac{{{f^{\left( n \right)}}\left( 2 \right)}}{{n!}}{{\left( {x - 2} \right)}^n}} \\ &= \ln \left( 2 \right) + \sum\limits_{n = 1}^\infty {\frac{{{{\left( { - 1} \right)}^{n + 1}}\left( {n - 1} \right)!}}{{n!\,\,\,\,{2^n}}}{{\left( {x - 2} \right)}^n}} \\ &= \ln \left( 2 \right) + \sum\limits_{n = 1}^\infty {\frac{{{{\left( { - 1} \right)}^{n + 1}}}}{{n\,{2^n}}}{{\left( {x - 2} \right)}^n}}\end{aligned}$$
在 $3$ 处展开 $f\left(x\right) = x^3 - 10x^2 + 6$
$$\begin{aligned}{f^{\left( 0 \right)}}\left( x \right) & = {x^3} - 10{x^2} + 6 & \hspace{0.5in} & {f^{\left( 0 \right)}}\left( 3 \right) = - 57\\ {f^{\left( 1 \right)}}\left( x \right) & = 3{x^2} - 20x & \hspace{0.5in} & {f^{\left( 1 \right)}}\left( 3 \right) = - 33\\ {f^{\left( 2 \right)}}\left( x \right) & = 6x - 20 & \hspace{0.5in} & {f^{\left( 2 \right)}}\left( 3 \right) = - 2\\ {f^{\left( 3 \right)}}\left( x \right) & = 6 & \hspace{0.5in} & {f^{\left( 3 \right)}}\left( 3 \right) = 6\\ {f^{\left( n \right)}}\left( x \right) & = 0 & \hspace{0.5in} & {f^{\left( 4 \right)}}\left( 3 \right) = 0\hspace{0.25in}n \ge 4\end{aligned}$$
当我们求多项式的泰勒级数时,这种情况总会发生。
$$\begin{aligned}{x^3} - 10{x^2} + 6 & = \sum\limits_{n = 0}^\infty {\frac{{{f^{\left( n \right)}}\left( 3 \right)}}{{n!}}{{\left( {x - 3} \right)}^n}} \\ & = f\left( 3 \right) + f'\left( 3 \right)\left( {x - 3} \right) + \frac{{f''\left( 3 \right)}}{{2!}}{\left( {x - 3} \right)^2} + \frac{{f'''\left( 3 \right)}}{{3!}}{\left( {x - 3} \right)^3} + 0\\ & = - 57 - 33\left( {x - 3} \right) - {\left( {x - 3} \right)^2} + {\left( {x - 3} \right)^3}\end{aligned}$$
当求多项式的泰勒级数时,我们不对右侧进行任何简化。事实上,如果我们将所有内容相乘,我们就会回到原来的多项式!
其他公式
例题
参考
https://tutorial.math.lamar.edu/classes/calcii/taylorseries.aspx
https://en.wikipedia.org/wiki/Taylor_series
https://byjus.com/maths/taylor-series/