Evaluating the precision in the calculation of $\mathrm{e}$

568 Views Asked by At

I'm calculating $\mathrm{e}$ using a computer like this: $$ \mathrm{e} \approx \sum\limits_{i=0}^n {1\over i!} $$ I'm storing it as a rational number.

I was wondering, if I write down my rational number as a decimal number, could I determine, how many digits after the decimal point are correct for a given value of $n$?

4

There are 4 best solutions below

1
On BEST ANSWER

Using the Taylor remainder formula you get that, for some $\xi\in (0,1)$ $$ 0<\mathrm{e}-\sum_{i=0}^n\frac{1}{n!}=\frac{\mathrm{e}^\xi}{(n+1)!}<\frac{3}{(n+1)!}. $$ Thus the error is less than $\frac{3}{(n+1)!}$.

0
On

Since the factorials grow so fast, the first term you ignore is a very good estimate for the error. So if you sum up through $n=10$, the first ignored term is $\frac 1{11!}\approx 2.5\cdot 10^{-8}$ The next is a factor $12$ smaller, so using the first as your error estimate is pretty good.

0
On

The tail of the series is bounded above by a geometric series: \begin{align} \sum_{i=n+1}^\infty \frac{1}{i!} \le \frac{1}{(n+1)!}\sum_{i=0}^\infty \frac{1}{(n+1)^i}. \end{align}

It's easy to find the sum of that series, so you get an upper bound on $e$.

The lower bound comes from stopping after finitely many terms.

0
On

As yet another possibility, if you calculate $$\frac1e = \sum_{i=0}^\infty \frac{(-1)^i}{i!} $$ then you have an alternating series, so the true value of $1/e$ is strictly between any two successive partial sums, which you can then invert and represent in decimal. Any digits they agree on are certain.