3
$\begingroup$

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.

$\endgroup$
7
  • 2
    $\begingroup$ Hint: what terms in the sum for $e$ are missing? $\endgroup$ Commented Dec 7, 2021 at 6:23
  • 1
    $\begingroup$ $$0<e-\sum_1^N\frac1{k!}<\frac{N+2}{(N+1)\cdot (N+1)!}$$ $\endgroup$ Commented Dec 7, 2021 at 6:25
  • $\begingroup$ @ThomasAndrews That is correct only if you start summing from $k=0$. $\endgroup$
    – Gary
    Commented Dec 7, 2021 at 9:01
  • $\begingroup$ No sure what you call a very good approximation. There is no problem tabulating the, say, first $20$ values. Then any term that you add will make no difference to a double-precision float. $\endgroup$
    – user1001492
    Commented Dec 7, 2021 at 9:02
  • 1
    $\begingroup$ See also math.stackexchange.com/q/3279850 $\endgroup$
    – Gary
    Commented Dec 7, 2021 at 9:16

2 Answers 2

5
$\begingroup$

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$$

$\endgroup$
1
  • $\begingroup$ +1 Very nice! :) $\endgroup$ Commented Dec 7, 2021 at 9:53
1
$\begingroup$

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

$\endgroup$
3
  • $\begingroup$ Thanks for your answer, is it possible you could elaborate on how $\frac{e^{\xi}}{(N+1)!}$ is derived from the taylor formula? $\endgroup$
    – user983799
    Commented Dec 7, 2021 at 15:13
  • 1
    $\begingroup$ 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)!} $$ $\endgroup$ Commented Dec 7, 2021 at 15:53
  • $\begingroup$ @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! $\endgroup$ Commented Dec 7, 2021 at 16:01

You must log in to answer this question.