3

I'd like to approximate $$\sum_{k=1}^N \frac{1}{k!}$$

I know that $\sum_{n=0}^\infty \frac{1}{n!}=e$ but since I am dealing with only the finite case I'm not sure this approximation is very good. Is there a better one? Note: Not looking for the closed form with the $\Gamma$ function, an approximation in terms of elementary functions is desired.

2 Answers2

5

There is an exact representation $$\sum_{k=1}^n \frac{1}{k!}=e\frac{ \Gamma (n+1,1)}{\Gamma (n+1)}-1=\frac{\lfloor e \,n!\rfloor }{n!}-1$$

1

If you use Taylor's formula, you get $$ \sum_{k=1}^N \frac{1}{k!} = e - 1 -\frac{e^{\xi}}{(N+1)!}, \quad \xi \in (0,1) $$

So, if you choose to approximate the sum by $e-1$, the error you commit is bounded by $\frac{e}{(N+1)!}$. As an example, if $N=10$ you get an error of the order $10^{-8}$.

PierreCarre
  • 20,974
  • 1
  • 18
  • 34
  • Thanks for your answer, is it possible you could elaborate on how $\frac{e^{\xi}}{(N+1)!}$ is derived from the taylor formula? –  Dec 07 '21 at 15:13
  • 1
    If $f\in c^{N+1}$ in some open set centred in $a$ and containing $x$, we have that $$ f(x) = f(a) + f'(a)(x-a) + \cdots + \frac{f^{(N)}(a)}{N!}(x-a)^N + \frac{f^{(N+1)}(\xi)}{(N+1)!}(x-a)^{N+1}, \quad \xi \in (a,x). $$ In this case, since $a=0$, $x=1$ and $f^{(N+1)}(x) = e^x$, we have that $$ \left| \dfrac{f^{(N+1)}(\xi)}{(N+1)!}(1-0)^{N+1}\right| = \dfrac{e^{\xi}}{(N+1)!}\leq \frac{e}{(N+1)!} $$ – PierreCarre Dec 07 '21 at 15:53
  • @a6623 Please consider marking as correct the answer by Claude Leibovici. Note that the formula he presented, although derived using the $\Gamma$ function, does not actually use it in the calculations. For instance, $$ \sum_{k=1}^{10}\frac{1}{k!} = \frac{\lfloor e 10!\rfloor}{10!} -1 = \frac{6235301}{3628800} $$

    This is an exact result. It can't get any better!

    – PierreCarre Dec 07 '21 at 16:01