## Taylor series --- ## Taylor series #### Definition If $f$ is infinitely differentiable at $a$, then the *Taylor series for $f(x)$ at $x=a$* is $\displaystyle \sum\_{n=0}^\infty \frac{f\^{(n)}(a)}{n!}(x-a)^n$. --- ## Taylor series ### (Maclaurin's version) #### Definition If $f$ is infinitely differentiable at $a$, then the *Taylor series for $f(x)$ at $x=a$* is $\displaystyle \sum\_{n=0}^\infty \frac{f\^{(n)}(a)}{n!}(x-a)^n$. #### Definition If $f$ is infinitely differentiable at $0$, then the *Maclaurin series for $f$* is the Taylor series for $f(x)$ at $x=0$: the function $\displaystyle \sum\_{n=0}^\infty \frac{f\^{(n)}(0)}{n!}x^n$. --- ## Taylor series #### Definition If $f$ is infinitely differentiable at $a$, then the *Taylor series for $f(x)$ at $x=a$* is $\displaystyle \sum\_{n=0}^\infty \frac{f\^{(n)}(a)}{n!}(x-a)^n$. #### Example 1 If $\displaystyle f(x) = \mathrm{e}^x$, then $f'(x) = f(x)$, so $f\^{(n)}(0)=1$ for all $n\in\mathbb N\cup\\{0\\}$. Therefore, the Taylor series for $f$ at $0$ converges on $(-\infty,\infty)$, and it converges to $f$ there. [Excel file demonstrating Taylor series of exp](https://nc.dasmithmaths.com/index.php/s/xiGSBG99CWgzW9G) --- ## Taylor series #### Definition If $f$ is infinitely differentiable at $a$, then the *Taylor series for $f(x)$ at $x=a$* is $\displaystyle \sum\_{n=0}^\infty \frac{f\^{(n)}(a)}{n!}(x-a)^n$. #### Example 1 If $\displaystyle f(x) = \mathrm{e}^x$, then $f'(x) = f(x)$, so $f\^{(n)}(0)=1$ for all $n\in\mathbb N\cup\\{0\\}$. Therefore, the Taylor series for $f$ at $0$ converges on $(-\infty,\infty)$, and it converges to $f$ there. The Taylor/Maclaurin series may not converge at all, and may not converge to $f(x)$. #### Example 2 If $\displaystyle f(x) = \begin{cases} \mathrm{e}^x & \text{if } x\leqslant1 \\\\ \mathrm{e}(2-x) & \text{if } x\gt1 \end{cases}$, then the Taylor series for $f$ converges everywhere, but not to $f$; see spreadsheet. --- ## Taylor series #### Definition If $f$ is infinitely differentiable at $a$, then the *Taylor series for $f(x)$ at $x=a$* is $\displaystyle \sum\_{n=0}^\infty \frac{f\^{(n)}(a)}{n!}(x-a)^n$. #### Example 3 Let $\displaystyle f(x)=e\^{-1/x^2}$. This is defined and infinitely differentiable everywhere except at $x=0$. We can fix this by redefining $\displaystyle f(x) = \begin{cases} 0 & \text{if } x=0, \\\\ e\^{-1/x^2} & \text{otherwise.} \end{cases}$ [Let's look at the derivatives of this function.](https://nc.dasmithmaths.com/index.php/s/zEAGSfR9z3os2gg) --- ## Taylor series #### Definition If $f$ is infinitely differentiable at $a$, then the *Taylor series for $f(x)$ at $x=a$* is $\displaystyle \sum\_{n=0}^\infty \frac{f\^{(n)}(a)}{n!}(x-a)^n$. #### Example 3 Let $\displaystyle f(x)=e\^{-1/x^2}$. This is defined and infinitely differentiable everywhere except at $x=0$. We can fix this by redefining $\displaystyle f(x) = \begin{cases} 0 & \text{if } x=0, \\\\ e\^{-1/x^2} & \text{otherwise.} \end{cases}$ It can be shown that $f\^{(n)}(0)=0$ for all $n\in\mathbb N\cup\\{0\\}$. Proof: by induction, $\displaystyle f\^{(n)}(x) = \begin{cases} 0 & \text{if } x=0, \\\\ e\^{-1/x^2}P_n(x) & \text{otherwise,} \end{cases}$
for $P_0(x)=1$ and $P_n(x) = 2x\^{-3}P\_{n-1}(x)+P'\_{n-1}(x)$. --- ## Taylor series #### Definition If $f$ is infinitely differentiable at $a$, then the *Taylor series for $f(x)$ at $x=a$* is $\displaystyle \sum\_{n=0}^\infty \frac{f\^{(n)}(a)}{n!}(x-a)^n$. #### Example 3 Let $\displaystyle f(x)=e\^{-1/x^2}$. This is defined and infinitely differentiable everywhere except at $x=0$. We can fix this by redefining $\displaystyle f(x) = \begin{cases} 0 & \text{if } x=0, \\\\ e\^{-1/x^2} & \text{otherwise.} \end{cases}$ It can be shown that $f\^{(n)}(0)=0$ for all $n\in\mathbb N\cup\\{0\\}$. So the Maclaurin series for $f(x)$ converges and is the constant function $0$, which is not $f(x)$. --- ## Taylor series #### Definition If $f$ is infinitely differentiable at $a$, then the *Taylor series for $f(x)$ at $x=a$* is $\displaystyle \sum\_{n=0}^\infty \frac{f\^{(n)}(a)}{n!}(x-a)^n$. So we do have to be careful with Taylor series. For a Taylor series at $a$ to exist and be useful, we have to know: * $f\^{(n)}(a)$ exists for all $n\in\mathbb N\cup\\{0\\}$.
Calculus, MATH2340
* The Taylor series converges on $(a-R,a+R)$ for some $R$ large enough for our application.
MATH2340
* The Taylor series converges to $f(x)$ on that interval.
MATH2350
We may also want: * The Taylor series converges fast enough.
Asymptotic analysis
--- ## Taylor series #### Definition If $f$ is infinitely differentiable at $a$, then the *Taylor series for $f(x)$ at $x=a$* is $\displaystyle \sum\_{n=0}^\infty \frac{f\^{(n)}(a)}{n!}(x-a)^n$. So we do have to be careful with Taylor series. For a Taylor series at $a$ to exist and be useful, we have to know: * $f\^{(n)}(a)$ exists for all $n\in\mathbb N\cup\\{0\\}$.
Calculus, MATH2340
* The Taylor series converges on $(a-R,a+R)$ for some $R$ large enough for our application.
MATH2340
* The Taylor series converges to $f(x)$ on that interval.
MATH2350
We may also want: * The Taylor series converges fast enough.
Asymptotic analysis
--- ## Taylor series For a Taylor series at $a$ to exist and be useful, we have to know: * $f\^{(n)}(a)$ exists for all $n\in\mathbb N\cup\\{0\\}$.
Calculus, MATH2340
* The Taylor series converges on $(a-R,a+R)$ for some $R$ large enough for our application.
MATH2340
* The Taylor series converges to $f(x)$ on that interval.
MATH2350
We may also want: * The Taylor series converges fast enough.
Asymptotic analysis
#### Exercise Assess how fast the Maclaurin series for sin converges using [this spreadsheet](https://nc.dasmithmaths.com/index.php/s/xiGSBG99CWgzW9G). --- ## Taylor series For a Taylor series at $a$ to exist and be useful, we have to know: * $f\^{(n)}(a)$ exists for all $n\in\mathbb N\cup\\{0\\}$.
Calculus, MATH2340
* The Taylor series converges on $(a-R,a+R)$ for some $R$ large enough for our application.
MATH2340
* The Taylor series converges to $f(x)$ on that interval.
MATH2350
We may also want: * The Taylor series converges fast enough.
Asymptotic analysis
#### Exercise Assess how fast the Maclaurin series for sin converges using [this spreadsheet](https://nc.dasmithmaths.com/index.php/s/xiGSBG99CWgzW9G). #### Conclusion For $x\in(-0.1,0.1)$ very fast. But for $x\in(-10,10)$ quite slowly. --- ## Application of Taylor series The Maclaurin series for $\sin(x)$ is $\displaystyle \sum\_{\substack{n=0 \\\\ n \text{ odd}}}^\infty \frac{(-1)\^{\frac{n-1}2}}{n!}x^n$. It converges to $\sin(x)$ on $(-\infty,\infty)$. #### Exercise Evaluate $\displaystyle \lim\_{x\to0} \frac{\sin(x)}x$. Evaluate $\displaystyle \lim\_{x\to0} \frac{\mathrm e^x - 1 - x}{x^2}$. Think carefully about what we need to know about the relevant Taylor series to make this argument. --- ## Application of Taylor series The Maclaurin series for $\sin(x)$ is $\displaystyle \sum\_{\substack{n=0 \\\\ n \text{ odd}}}^\infty \frac{(-1)\^{\frac{n-1}2}}{n!}x^n$. It converges to $\sin(x)$ on $(-\infty,\infty)$. #### Exercise Evaluate $\displaystyle \lim\_{x\to0} \frac{\sin(x)}x$. Evaluate $\displaystyle \lim\_{x\to0} \frac{\mathrm e^x - 1 - x}{x^2}$. Think carefully about what we need to know about the relevant Taylor series to make this argument. The limits are $1$ and $\frac12$. You only need to know that there is some (possibly very small) $\varepsilon\gt0$ such that the Maclaurin series converge on $(-\varepsilon,\varepsilon)$. It does not matter how fast. --- ## Application of Taylor series We want to cut a curve of shape approximately $f(x)=\frac1{1-x}$ for $x\in[-3,\frac12]$, but the cutting machine only accepts polynomial functions. Can we use a polynomial truncation of the Maclaurin series for $f$? #### Exercise Calculate the first few coefficients of the Maclaurin series. Hypothesise the general formula for the coefficients. Then either: * prove the formula by induction, or * use [the spreadsheet](https://nc.dasmithmaths.com/index.php/s/zsn82EADec9rjf5) to evaluate the first few polynomial truncations of the Maclaurin series Conclude. --- ## Application of Taylor series We want to cut a curve of shape approximately $f(x)=\frac1{1-x}$ for $x\in[-3,\frac12]$, but the cutting machine only accepts polynomial functions. Can we use a polynomial truncation of the Maclaurin series for $f$? #### Exercise Calculate the first few coefficients of the Maclaurin series. Hypothesise the general formula for the coefficients. Then either: * prove the formula by induction, or * use [the spreadsheet](https://nc.dasmithmaths.com/index.php/s/zsn82EADec9rjf5) to evaluate the first few polynomial truncations of the Maclaurin series Conclude. The coefficients are all $1$. The Maclaurin polynomials are not a good approximation for $x\lt-1$. In fact, the Maclaurin series diverges for $x\lt-1$.