Take the 2-minute tour ×
Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

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, by knowing what was the value of $n$?

share|improve this question
    
You need $\displaystyle\sum_{i=0}^\infty$, starting with $i=0$, not with $i=1$, and going to $\infty$, not to $n$. Also, the fraction should be $\dfrac{1}{i!}$, not $\dfrac{1}{n!}$. –  Michael Hardy Dec 29 '13 at 23:30
1  
@MichaelHardy I think the $n$ on top is what the OP wants. He should have written $\approx$ instead of $=$. –  Git Gud Dec 29 '13 at 23:32
    
@GitGud : If so, then it should not say "$=$". ${}\qquad{}$ –  Michael Hardy Dec 29 '13 at 23:45
1  
Unrelated but potentially useful to the OP: using the continued fraction expansion for $\exp(z)$ is more accurate, and if you compute the convergents $A_{n}$, $B_{n}$ recursively...it is faster since it uses fewer division operations... –  Alex Nelson Dec 30 '13 at 0:37
1  
@user21820 Well, look at (e.g.) Wikipedia's page for the general formulas for the numerator and denominator. You can compute them recursively, requiring (for each iteration) 2 additions and 4 multiplications. So $N$ iterations costs 1 division operation (the final division) + $2N$ addition + $4N$ multiplication, far better than the naive Taylor series. –  Alex Nelson Dec 30 '13 at 14:41
show 13 more comments

4 Answers

up vote 10 down vote accepted

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)!}$.

share|improve this answer
    
This is definitely not the simplest way. It relies, for example, on the mean value theorem. –  Michael Hardy Dec 29 '13 at 23:41
add comment

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.

share|improve this answer
add comment

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.

share|improve this answer
add comment

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.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.