[Math] Euler-Maclaurin summation for $e^{-x^2}$

euler-maclaurinsummation

I want to approximate the sum
$$\sum_{k=0}^\infty e^{-k^2}$$
using the Euler-Maclaurin formula
$$\sum_{k=0}^\infty f(k) = \int_0^\infty f(x) \, dx + \frac{1}{2}(f(0) + f(\infty)) + \frac{1}{12}(f'(\infty) – f'(0)) – \frac{1}{720}(f'''(\infty) – f'''(0)) + \ldots$$

where $f(\infty)$ means $\lim_{x \to \infty} f(x)$. But putting $f(x) = e^{-x^2}$, it's not too hard to see that all derivatives of odd order are an odd polynomial times $f$, implying they vanish at $x = 0$. But this means all terms of the Euler-Maclaurin formula vanish except for the first two! But I know this is wrong because I evaluated the sum numerically in Mathematica.

What's wrong with my calculations?

Best Answer

Nothing is wrong with the details of the computation, but you are treating the Euler-Maclaurian formula as an equality, when it isn't.

Before continuing, I will switch the sum a little bit: You are working with $$S:=\sum_{k=0}^{\infty} e^{-k^2}.$$ The formulas are a little cleaner in terms of $$T:=\sum_{k=-\infty}^{\infty} e^{-k^2}.$$ These are related by $T=2S-1$, so it is easy to switch between them.

The Euler-Macluarin formula with remainder term, combined with your correct computation that $f^{(k)}(x)$ goes to $0$ as $x \to \pm \infty$, tells us that we have $$\sum_{k=-\infty}^{\infty} e^{-k^2} = \int_{x=-\infty}^{\infty} e^{-x^2} dx + \int_{-\infty}^{\infty} \frac{B_N(x-\lfloor x \rfloor)}{N!} \frac{d^N e^{-x^2}}{(dx)^N} dx$$ for any positive integer $N$. Here $B_N$ is the $N$-th Bernouli polynomial and $\lfloor x \rfloor$ is $x$ rounded down to an integer. For some functions, the remainder $\int \frac{B_N(x-\lfloor x \rfloor)}{N!} \frac{d^N f}{(dx)^N} dx$ goes to $0$ as $N \to \infty$, but it often doesn't, and it doesn't in your case.

To give some other examples, if you compute the asymptotics of $\sum_{k \leq M} \frac{1}{k}$ using Euler-Maclaurin, the Euler-Mascheroni constant occurs as the limit of the remainder term. If you derive Stirling's formula by Euler-Maclaurin summation of $\sum \log k$, then the $\log (2 \pi)$ occurs as the limit of the remainder term.

There is a really good discussion of this in Chapter 9 of Concrete Mathematics, by Graham, Knuth and Patashnik. You might particularly enjoy the fourth example in Chapter 9.6, where they use Euler Maclaurin summation to show that, for any $N$, we have $$\sum_{k=-\infty}^{\infty} e^{-k^2/t} = \sqrt{\pi t} + O(t^{-N}) \ \mbox{as}\ t \to \infty.$$

Related Question