1

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.

  • Not really, although one might replace $e$ by $3$ is one were doing this by hand. – Michael Burr Jun 07 '18 at 02:26
  • How would I get around solving for $n$ when there is a factorial involved? – A. Lieber Jun 07 '18 at 02:29
  • Since the goal is to solve for $n$, you can't get around solving for $n$. In this case, the best option is to just plug in numbers until the remainder is small enough. – Michael Burr Jun 07 '18 at 02:32
  • Is that essentially how a CAS does it? Not through any analytical way? – A. Lieber Jun 07 '18 at 02:33
  • It might, but it's unclear how a CAS deals with a non-integer factorial. Perhaps through the Gamma function. – Michael Burr Jun 07 '18 at 02:40
  • A program intended to deal with a much broader range of values of $n$ and of intervals would most likely search using routine like Newton's method. (Technically, for that you need to replace the factorial by some smooth monotone interpolant like the Gamma function, but this is not really an obstacle). The actual problem you are asking to solve, i.e. $\frac{e^{0.5} 0.5^{n+1}}{\Gamma(n+2)}=10^{-6}$, is probably not expressible in terms of even standard special functions, much less elementary functions. – Ian Jun 07 '18 at 02:41
  • However, a way to get a bound that can be represented in terms of standard special functions is to estimate $(n+1)!>\left ( \frac{n+1}{e} \right )^{n+1}$ using Stirling's approximation, then you are left to solve $e^{0.5} \left ( \frac{0.5e}{n+1} \right )^{n+1}=10^{-6}$, which I think is expressible using the Lambert W function. – Ian Jun 07 '18 at 02:47

2 Answers2

1

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)$$

0

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.

trancelocation
  • 33,349
  • 1
  • 21
  • 46