2
$\begingroup$

There are many well-known methods for efficiently numerically computing $\pi$, such as Chudnovsky's Method or perhaps Gauss-Legendre's algorithm. I was wondering what the best method for computing $e$ is.

I have used the Taylor's series expansion or $e^x$ at $x=1$, which is in fact very convergent and does not cost too much to compute:

$e=\sum_{n=0}^{\infty}\frac{1}{n!} = 1+1+\frac{1}{2}+\frac{1}{6}+\cdots$

Here are a table of some basic values:

n                    Estimation            Error (e - sum) 1                    1.0                   1.718281828459045 5                    2.708333333333333     0.009948495125712054 10                   2.7182815255731922    3.0288585284310443E-7 100                  2.7182818284590455    -4.440892098500626E-16 

I am curious to know if there are even more efficient methods to compute $e$. Keep in mind that computational cost and convergence speed are the priorities.

  • 0
    Also, one can hit a point of diminishing returns when one keeps summing past the supposed point of convergence, ending up with a few eroded digits in the last place...2012-04-14

1 Answers 1

2

A tiny C program from Xavier Gourdon to compute $9000$ decimal digits. (You may change that for more digits).

main(){     int N=9009,n=N,a[9009],x;     while(--n){         a[n]=1+1/n;     }     for(;N>9;printf("%d",x))     for(n=N--;--n;a[n]=x%n,x=10*a[n-1]+x/n); }