1

I have been looking into methods and formulae that yields approximations of 'e', one thing i have observed is that at least the ones i have tried tend to use by far more iterations than the number of correct digits they generate.

Is there no method that has a better convergence as well as less time needed to generate correct digits than them?.

MarioE
  • 53
  • While the answer is undoubtedly included in the answers of the possible duplicate, it would be nice if an answer is posted here giving explicitly the run-time asymptotics for computing the $n$th digit. As far as I can tell this was not given in the previous question/answers. – Willie Wong Oct 30 '16 at 13:13

1 Answers1

3

The power series expansion $$ \mathrm{e}^x = 1 + x + \frac{1}{2!} x^2 + \frac{1}{3!} x^3 + \cdots + \frac{1}{k!} x^k + \cdots $$ converges quite quickly. Set $x=1$ and you are just summing reciprocal factorials. The sum of the first $n$ terms, $s_n$, satisfies $$ s_n < \mathrm{e} < s_n + \frac{1}{n \cdot n!} $$ so is certainly gaining a digit of precision after $10$ terms, two digits each after $100$ terms, and so on. (Euler actually used this method to find $23$ decimal digits of his constant (that is, $23$ digits after the decimal). See L. Euler, Introduction à l'analyse infinitésimale (French translation by Labey), Barrois, ainé, Librairie, (original 1748, translation 1796), vol. 1, p. 89-90. In fact, page 89, just three lines above the marginal notation "(q)". As an amusing coincidence, this can be obtained after just $23$ terms.)

Binary splitting can be used to improve the running time of an implementation of this series method. See Xavier Gourdon and Pascal Sebah, Binary splitting method, 2001. This is usually overcomplex for "small" number of digits, but can be effective for thousands or millions (or more) of digits.

Eric Towers
  • 67,037
  • I have read about the use of e power series and binary splitting method here http://www.numberworld.org/misc_runs/e-500b.html . Is this one the best method to this day? – MarioE Oct 30 '16 at 04:59
  • I also see that the taylor series of e was used for the current e computation world record (5,000,000,000,000 digits!) http://www.numberworld.org/y-cruncher/records.html Information http://www.numberworld.org/y-cruncher/records/2016_8_28_e.txt – MarioE Oct 30 '16 at 05:06
  • Since the factorials increase so quickly, the number of digits of precision increases quickly as well. As $100! \gt 10^{157}$ we would expect (absent magical cancellation) there to be at least $157$ correct decimals after $100$ terms. – Ross Millikan Oct 30 '16 at 05:47
  • @RossMillikan : ... and, as I mentioned, is gaining (at least) two correct digits per term at $100!$ ... – Eric Towers Oct 30 '16 at 14:27
  • For a medium-size number of bits (few hundreds to few thousands), the following will often be faster than using the power series for $e^x$ without adding much complexity: $t = \sinh x = x + \frac{x^3}{3!} + \frac{x^5}{5!} + ...$ then $\exp x = t + \sqrt{1 + t^2}$, where the square root can be computed via the Halley iteration for the reciprocal square root (cubic convergence). – njuffa Oct 31 '16 at 14:19