Finding the degree so that a Taylor polynomial yields an approximation within a specified accuracy.

221 Views Asked by At

So, for the function $f(x)=e^x$ centered around $x_0=0$, I need to find a Taylor polynomial of degree $n$ such that it approximates $f(x)$ within $10^{-6}$ on the interval $[0,0.5]$.

I took this to mean that the error (|$R_n(x)$|) has to be less than or equal to $10^{-6}$.

The formula for the error would be $|R_n(x)|=|\frac{1}{(n+1)!}f^{(n+1)}(z)(x-x_0)^{n+1}$|.

In trying to find the degree of the Taylor polynomial, we are essentially trying to solve for $n$ with the upper-bound being $10^{-6}$.

This means $|R_n(x)|=|\frac{1}{(n+1)!}f^{(n+1)}(z)(x-x_0)^{n+1}|=|\frac{1}{(n+1)!}e^zx^{n+1}| \leq 10^{-6}$. Using a CAS, I brute-forced a numerical solution and got that the first positive solution is approximately $n=6.34354$.

Since the Taylor polynomial must be of integer degree, I rounded up and concluded that a seventh-degree polynomial would be enough to give an estimate with the requested accuracy. Is there any other way of doing this though? I feel like this is a very ad hoc solution that wouldn't be appropriate in all cases.

2

There are 2 best solutions below

0
On

Since $e^x$ and $x^{n+1}$ are increasing on $[0,0.5]$, you have $$|R_n(x)|\leq \underbrace{\frac{1}{(n+1)!}\sqrt{e}\frac{1}{2^{n+1}}}_{a_n:=} \stackrel{!}{\leq }10^{-6}$$ Furthermore, you may estimate $\sqrt{e} < 1.65$.

As $a_n$ is strictly decreasing you just find the first $n \in \mathbb{N}$ for which the inequality is satisfied. There is no solving for $n$ using $\Gamma$ necessary.

0
On

As Ian commented, if you look at this question of mine, there is analytical solutions to the problem of solving for $n$ the equation $$\frac{e^x\,x^{n+1}}{(n+1)!} = 10^{-k}$$ Ignoring the $\sqrt p$ in Stirling approximation of $p!$ (as I did as a shortcut), this would lead to the overestimate $$n=-1+\frac{\log (a)}{W\left(\frac{\log (a)}{e x}\right)}\qquad \text{where}\qquad a=\frac{e^x\, 10^k}{\sqrt{2 \pi }}$$ where appears Lambert function.

Applied to your case $(k=6,x=\frac12)$, this will give $n=6.72$ which is not far from the exact solution you found.

Computing for a few values of $k$, we should get $$\left( \begin{array}{ccc} k & \text{approximation} & \text{exact} \\ 1 & 1.718 & 1.426 \\ 2 & 2.936 & 2.608 \\ 3 & 3.990 & 3.643 \\ 4 & 4.952 & 4.594 \\ 5 & 5.856 & 5.490 \\ 6 & 6.715 & 6.344 \\ 7 & 7.541 & 7.165 \\ 8 & 8.340 & 7.959 \\ 9 & 9.116 & 8.732 \\ 10 & 9.872 & 9.486 \\ 11 & 10.61 & 10.22 \\ 12 & 11.34 & 10.95 \end{array} \right)$$