# Why does this theta function value yield such a good Riemann sum approximation?

Let $$T(q)$$ denote the third Jacobi theta function at $$z=0$$; i.e., $$T(q) := \sum_{n\in\mathbb{Z}} q^{n^2}.$$ Then for any $$x>0$$, $$T(\exp(-1/x)) \approx \sqrt{\pi x}$$. For example, as the entry for A195907 in the OEIS notes, when $$x=1$$, we can regard $$T(\exp(-1))$$ as a Riemann sum approximation to the integral $$\int_{-\infty}^\infty \exp(-x^2)\, dx = \sqrt{\pi}$$. Numerically, \eqalign{T(\exp(-1)) &\approx 1.772637 \cr \sqrt{\pi} &\approx 1.772454\cr} What surprises me, however, is that the ratio $$T(\exp(-1/x))/\sqrt{\pi x}$$ converges to $$1$$ very rapidly, more rapidly than I would naïvely expect based solely on the Riemann sum idea. For example, if we take $$x=10$$, then \eqalign{T(\exp(-1/10)) &\approx 5.604991216397928699311282433868800893854325311 \cr \sqrt{10\pi} &\approx 5.604991216397928699311282433868800893854323775\cr} Is there some theta-function magic that explains this rapid convergence? Or maybe my intuition is wrong, and the rate of convergence is not any faster than one would "expect"?

I would give a slightly more direct explanation than WhatsUp. The Poisson summation formula states that for $$f$$ a smooth rapidly decreasing function on $$\mathbb R$$, $$\hat{f}$$ the Fourier transform, and $$y>0$$ that

$$y\sum_{n \in \mathbb Z} f(yn) = \sum_{n \in \mathbb Z} \hat{f} (y^{-1} n)$$

where $$\hat{f}(0) = \int_{-\infty}^\infty f(t)dt$$ is the integral to which $$y\sum_{n \in \mathbb Z} f(yn)$$ is a Riemann sum. Hence $$\sum_{n\neq 0} \hat{f} (y^{-1} n)$$ is the error in the Riemann sum approximation to this integral.

For $$y$$ small, $$y^{-1}$$ is large, so $$y^{-1} n$$ is large for all nonzero $$n$$. Thus the more rapidly decreasing $$\hat{f}$$ is, the smaller the error term $$\sum_{n\neq 0} \hat{f} (y^{-1} n)$$ is, and the more rapidly this Riemann sum converges.

The Fourier transform of $$e^{-x^2}$$ is another function of the form $$C e^{ - B x^2}$$ and thus is pretty rapidly decreasing.

The Poisson summation formula is exactly how the functional equation of the theta function is proved, showing the relation to WhatsUp's answer.

This is because the theta function has a functional equation.

Under the usual definition $$\theta(t) = \sum_n e^{-\pi t n^2}$$, the functional equation is $$\theta(t) = \frac 1{\sqrt t} \theta\left(\frac 1 t\right).$$

Translating to your $$T$$, it gives $$T\left(e^{-\frac 1 x}\right) = \theta\left(\frac 1 {\pi x}\right) = \sqrt{\pi x} \theta(\pi x).$$

So, what you are observing is the fact that $$\theta(\pi x)$$ converges very fast to $$1$$. This is nothing magical because $$\theta(\pi x) - 1 = \sum_{n \ne 0} e^{-x(\pi n)^2}$$ which is pretty small, even for $$x = 1$$.

• Borwein and Borwein, "Strange series and high precision fraud" make a meal of this with their Sum 12. It's really worth a read. Commented Sep 4 at 23:13
• Reference for the Borweins' paper: The American Mathematical Monthly, Vol. 99, No. 7. (Aug. - Sep., 1992), pp. 622-640. Currently available at carmamaths.org/resources/jon/Preprints/Books/MbyE/Second-Ed/… Commented Sep 5 at 0:08