# Evaluation of this double infinite summation

I want to evaluate the following double summation

Sum[(-1)^(i + j + i*j)*Exp[-Pi/2*( i^2 + j^2)], {i, -Infinity,
Infinity}, {j, -Infinity, Infinity}]


I am really new both in using Mathematica and in doing mathematics using computer. I don't know if there is some special technics to deal with these kind of summations (Lattice sums) in Mathematica.

When I evaluate the former expression, Mathematica refuses to evaluate it and just reprint it in the output.

Theoretically, the expected value is 0.

Mathematica

You can try out numerical summation NSum,

NSum[(-1)^(i + j + i*j)*Exp[-Pi/2*(i^2 + j^2)], {i, -Infinity, Infinity},
{j, -Infinity, Infinity}]


which after some warnings gives an output,

-2.22045*10^-16 - 1.04284*10^-68 I

If we increase the WorkingPrecision, will be able to get the desired result,

NSum[(-1)^(i + j + i*j)*Exp[-Pi/2*(i^2 + j^2)], {i, -Infinity, Infinity},
{j, -Infinity, Infinity}, Method -> "AlternatingSigns", WorkingPrecision -> 30]


0.*10^-30

Rationalize[%]


0

As suggested by @AccidentalFourierTransform, we "can use the option, Method -> "AlternatingSigns" to speed up the computation and remove the warnings".

Maple

Maple's sum(sum(f(k,l), k=m..n),l=m..n) command is able to directly compute the double sum,

restart:
Sum(Sum((-1)^(i + j + i*j)*exp(-Pi/2*( i^2 + j^2)), i=-infinity..infinity),
j=-infinity..infinity);
evalf(%)


0

• Thank you both for the quick feedback. Now using the numerical approach, is there a way to test if the actual limit is 0? Commented Feb 26, 2017 at 17:05
• @AymaneFihadi What you mean by actual limit?
– zhk
Commented Feb 26, 2017 at 17:08
• @ As I mentioned in my question, the limit of the above series is 0. I want to test that using Mathematica. By your valuable answer, we get that the limit value is around 0, as far as I understand there is possibly a way to make sure that this limit is actually 0 ? Commented Feb 26, 2017 at 17:17
• @AymaneFihadi Rationalize[0.*10^-30]=0. BTW, Maple also gives zero.
– zhk
Commented Feb 26, 2017 at 17:19
• OK, Thank you very much. I will tag this answer as Accepted later, in the hope if there is some other insight concerning doing lattice sums in general. Commented Feb 26, 2017 at 17:24

It is possible to do this sum in MA. Let us look at the function and its domain:

fig1 = MatrixPlot[Table[(-1)^(i + j + i j) Exp[-Pi/2*(i^2 + j^2)], {i, -10, 10}, {j, -10, 10}]];
fig2 = MatrixPlot[ Table[(-1)^(i + j + i j) , {i, -10, 10}, {j, -10, 10}]];
fig = GraphicsRow[{fig1, fig2}]


This suggests to split the sum as follows:

r1 = Sum[Exp[-Pi/2*((2 ki)^2 + (2  kj)^2)], {ki, -Infinity, Infinity}, {kj, -Infinity, Infinity}]
(*EllipticTheta[3, 0, E^(-2 Pi)]^2*)
r2 = Sum[Exp[-Pi/2*((2 ki + 1)^2 + (2  kj + 1)^2)], {ki, -Infinity, Infinity}, {kj, -Infinity, Infinity}]
(*EllipticTheta[2, 0, E^(-2 Pi)]^2*)
r3 = Sum[Exp[-Pi/2*((2 ki)^2 + (2  kj + 1)^2)], {ki, -Infinity, Infinity}, {kj, -Infinity, Infinity}]
(*EllipticTheta[2, 0, E^(-2 Pi)] EllipticTheta[3, 0, E^(-2 Pi)]*)


At the end we can numerically verify a nice identity between the elliptic functions

$\vartheta _3\left(0,e^{-2 \pi }\right){}^2-\vartheta _2\left(0,e^{-2 \pi }\right){}^2-2 \vartheta _3\left(0,e^{-2 \pi }\right) \vartheta _2\left(0,e^{-2 \pi }\right)=0$

  N[r1 - r2 - 2 r3]//Chop
(*0*)

• Thank you very much, This is a nice idea. when I was trying to calculate this by pen, I was doing the same splitting of the lattice. btw when I said its theoretically 0, they link it with sigma of Weierstrass, and use some sophisticated argument, it is not direct. Commented Feb 28, 2017 at 10:20
• From formula 8 and 14 here, we find that $$\frac{\vartheta _2\left(0,e^{-2 \pi}\right)^2}{\vartheta _3\left(0,e^{-2 \pi}\right)^2}=3-2\sqrt 2$$ With this, the last identity in this answer can be easily verified. Commented Oct 4, 2018 at 9:35
• @J.M.issomewhatokay. Nice find ! Commented Oct 4, 2018 at 11:15