Approximating $e^x$ to 16 decimal places within given interval $ x \in (-\frac{1}{2},\frac{1}{2})$

65 Views Asked by At

Given $ x \in (-\frac{1}{2},\frac{1}{2}), n \in \mathbb{N} $ and $ s_n(x):= \sum_{k=0}^{\infty} \frac{x^k}{k!} $

How big must $ n $ be to satisfy $ |e^x - s^n(x) \leq \frac{|e^x|}{10^{16}}| $?

So this question is asking me how many terms of the sequence I need to get for $ e^x $ to be accurate to 16 decimal places.

I understand how to solve it for a value like $ x = 2 $:

$ |\frac{{-1}^n{x^n}}{n!}| < 10^{-16} $

$ \frac{x^n}{n!} < \frac{1}{10^{16}}$

$n!$ is greater than $10^{16}$ at $n=19$ and $2^n$ is greater than $ 10^{16}$ at $ n = 54$. So I would need to calculate the first 55 terms of the sequence. (Right? :))

However, this question states $x$ as an interval, which really has me confused. Any help as to how to solve this question would be much appreciated. Thanks!

1

There are 1 best solutions below

0
On BEST ANSWER

Big picture: Taylor expansion is good close to the point of expansion. Usually Taylor expansion gets monotonically worse as you go further from the point of expansion.

Details: using the Lagrange error estimate, for $x>0$ you find that the relative error in approximating $e^x$ by $T_n(x)$ is at most $\frac{x^{n+1}}{(n+1)!}$. (I must emphasize that I said relative error here; this is what you want in your problem, but it should still be noted.) This is a monotonically increasing function of $x$, so to deal with $(0,1/2)$ it is sufficient to take enough terms to handle just $x=1/2$.

For $x<0$ the situation is a bit different, because the bound on the $(n+1)$th derivative now looks a little different than it did before. (In particular, the bound on $|e^x-T_n(x)|$ no longer contains a factor of $|e^x|$.) But the basic setup is the same: write down your Lagrange error estimate for arbitrary $x$, take $n$ large enough that it is small enough for your purposes for all $x$ in $(-1/2,0)$.