difference between the integral and the sum over a function I have a function of $\sigma> 0$,
$$ f(\sigma) = \int d^3 \mathbb{u} \frac{e^{-u^2 \sigma^2}}{u^2} - \sum_{\mathbb{n}\in \mathbb{Z}^{3*}} \frac{e^{-n^2 \sigma^2 }}{n^2} . $$
Here $n = (n_1, n_2, n_3) $, $n^2 = n_1^2 + n_2^2 + n_3^2 $. Similarly,  $u= (u_1, u_2, u_3)$, $u^2 = u_1^2 + u_2^2 + u_3^2 $.
The integral can be done easily, it is $2\pi\sqrt{\pi}/\sigma $. This should also be the lead term of the sum as $\sigma \rightarrow 0^+ $.
I want to find out the value $f(\sigma \rightarrow 0^+ )$. Numerically, it is close to 8.9148. For this value, I take $\sigma = 0.02$ and sum in a cube of width $400$. It takes huge memory. I am wonder whether there is a smart way to get the value.
 A: $\xi:=\lim_{\sigma\to0^+}f(\sigma)$ has the following integral representations: $$\xi=2\pi\int_0^\infty\big(1+t^{-3}-\vartheta(t)^3\big)\,dt=2\pi\int_0^\infty t\big(1+t^{-3}-\vartheta(t)^3\big)\,dt,$$ where $\vartheta(t)=\sum_{n\in\mathbb{Z}}e^{-\pi(nt)^2}$ for $t>0$ (a kind of theta functions). The second of these integrals is obtained from the trivial $\xi=-\int_0^\infty g'(t)\,dt$, where $g(t)=f(t\sqrt\pi)$; the substitution $t=1/x$, together with the known identity $\vartheta(1/x)=x\vartheta(x)$, gives the first integral.
While the above doesn't give a closed form for $\xi$, we can compute it using numerical integration. A simple but efficient recipe here is to combine the above with the substitution $t=e^x$: $$\xi=\pi\int_{-\infty}^\infty F(x)\,dx,\qquad F(x)=e^x(1+e^x)\big(1+e^{-3x}-\vartheta(e^x)^3\big).$$ Here we have $F(-x)=F(x)$, and $F(x)$ decays exponentially as $x\to\pm\infty$. The last property implies that the simple trapezoidal rule $\xi\approx\pi h\sum_{n\in\mathbb{Z}}F(nh)$ converges very quickly as $h\to 0$: $$\xi=\underbrace{8.91363291}_{h=0.2}\underbrace{7585151272}_{h=0.1}\underbrace{687120136008681131187}_{h=0.05}\underbrace{6260368122105976533005323519\cdots}_{h=0.02}$$
