TITLE: Numerical coincidence? Why is sum(x^(k^2)) = sum(x^((k+1/2)^2)) for x = 0.8?
QUESTION [8 upvotes]: A well-known formula for the logarithm is given by
$$\log x = -\frac{\pi}{AGM(a^2,b^2)},   \qquad x < 1$$
where AGM is the arithmetic-geometric mean, and $a$ and $b$ are given by
$$a = \sum_{k\in\mathbb{Z}}x^{k^2}, \qquad
b = \sum_{k\in\mathbb{Z}}x^{(k+1/2)^2};$$
Or, equivalently,
$$a = 1 + 2x + 2x^4 + 2x^9 + 2x^{16} + 2x^{25} + \dots$$
and 
$$b = 2x^{1/4} + 2x^{9/4} + 2x^{25/4} + 2x^{49/4} + \dots$$
Why does it happen that $a = b$ occurs when $x = 0.8$?

REPLY [18 votes]: $$\sum_{k \in \mathbb Z} x^{k^2} = \theta_3(0,x)$$ while
$$\sum_{k \in \mathbb Z} x^{(k+1/2)^2} = \theta_2(0,x)$$
where $\theta_2$ and $\theta_3$ are Jacobi theta functions.  The difference 
$$\theta_2(0,0.8) - \theta_3(0,0.8) \approx 9.280378636257491074676461535977 \times 10^{-19}$$
according to Maple.
EDIT:
The difference 
$$\theta_3(0,x) - \theta_2(0,x) = \sum_{j \in \mathbb Z} (-1)^j x^{(j/2)^2} =\theta_3(\pi/2, x^{1/4}) $$
The Poisson summation formula gives us the identity
$$ \theta_3(\pi/2, e^{-t^2}) =  \frac{\sqrt{\pi}}{t} \theta_2(0, e^{-\pi^2/t^2})$$
and for $t \to 0+$, this goes to $0$ very rapidly:
$$\theta_3(\pi/2, e^{-t^2}) \sim \frac{2 \sqrt{\pi}}{t} e^{-\pi^2/(4 t^2)}$$
i.e.
$$ \theta_3(0,x) - \theta_2(0,x) \sim \frac{4 \sqrt{\pi}}{\sqrt{\ln(1/x)}} \exp\left(-\frac{\pi^2}{\ln(1/x)}\right) $$
For $x = 0.8$, the right side above is extremely close to the value I gave for 
$\theta_2(0,0.8) - \theta_3(0,0.8)$ (all digits shown match).

REPLY [5 votes]: The two values $a(0.8)$ and $b(0.8)$ appear "deceivingly" equal, but they actually are not!
Other "near-miss" values include
$$0<\theta_3(0,0.9)-\theta_2(0,0.9)<0.5\times 10^{-39}.$$
Let $f(x)=\theta_3(0,x)-\theta_2(0,x)$. The graph of $f(x)$, for values $0<x<1$ shows a global minimum at $x_*$ near $x=0.9$ (of course $f(x_*)>0$, still) and also a local maximum for some $0.9<x^*<1$. It would be really interesting to figure out these numbers, especially $x_*$. In any case, there are two values of $x$ in the range $0.8<x<1$ for which
$$\theta_3'(0,x)=\theta_2'(0,x).$$
By the way, can someone post the graph for $y=f(x)$? It would be a nice documentation for the discussion and analysis here.