2
$\begingroup$

I want to sum over $\mathbb{Z} \times \mathbb{ Z} \setminus \{(0,0)\}$ . So, something like

Sum[f[m,n],{m,-Infinity,Infinity},{n,-Infinity,Infinity}]

but I want to exclude f[0,0] as infinities might appear.

Any suggestions?

$\endgroup$
9
  • $\begingroup$ If f[0,0] is defined, then Sum[f[m,n],{m,-Infinity,Infinity},{n,-Infinity,Infinity}]-f[0,0]. If not, then try Sum[f[m,n]*(1-KroneckerDelta[m,,n],{m,-Infinity,Infinity},{n,-Infinity,Infinity}]. $\endgroup$
    – user64494
    Commented Apr 1, 2021 at 10:36
  • $\begingroup$ Sadly it is not defined. $\endgroup$ Commented Apr 1, 2021 at 10:38
  • 2
    $\begingroup$ Can you remove the singularity (by adding $+i\eta$ in the denominator, for example)? Then, after analytic summing over the entire $\mathbb{Z}\times\mathbb{Z}$, subtract $f(0,0)$ and then take the limit $\eta\to0^+$. $\endgroup$
    – Roman
    Commented Apr 1, 2021 at 11:08
  • $\begingroup$ Thanks, will try this; $\endgroup$ Commented Apr 1, 2021 at 11:16
  • $\begingroup$ @Roman: The same results are produced by your approach and mine for f[n_,k_]:=1/(n+I*k)^2, but my code seems faster. $\endgroup$
    – user64494
    Commented Apr 1, 2021 at 12:12

3 Answers 3

1
$\begingroup$

I suggest using a function

sumZZ0[f_, M_:Infinity] := (
      Sum[f[n, k], {n, M}, {k, 0, M}]
    + Sum[f[k, -n], {n, M}, {k, 0, M}]
    + Sum[f[-n, -k], {n, M}, {k, 0, M}]
    + Sum[f[-k, n], {n, M}, {k, 0, M}]);

This code may or may not help you depending on which f[n,k] you want to sum. If the original sum is not absolutely convergent, then splitting the sum into four sums may not give correct results.

As a simple example, using sumZZ0[(#1 + #2 I)^-4 &] to evaluate the Eisenstein series $G_4(i)$ does not produce a useful result. However, the code

Sum[Piecewise[{{(n + k I)^-4, n^2 + k^2 != 0}, {0, True}}],
   {n, -Infinity, Infinity}, {k, -Infinity, Infinity}]

does produce a useful result after a few seconds.

Still, an example that works is sumZZ0[x^(#1^2 + #2^2) &] which returns -1 + EllipticTheta[3, 0, x]^2 as it should in under a second. The code

 Sum[If[n == 0 && k == 0, 0, x^(n^2 + k^2)],
    {n, -Infinity, Infinity}, {k, -Infinity, Infinity}]

takes much longer to produce the same result. Also, using the Piecewise method takes even longer.

$\endgroup$
3
  • $\begingroup$ Sum[Piecewise[{{x^(m^2 + n^2), m^2 + n^2 != 0}, {0, True}}], {m, -Infinity, Infinity}, {n, -Infinity, Infinity}] also returns -1 + EllipticTheta[3, 0, x]^2., though slowly. This example is shooting a cannon at sparrows. $\endgroup$
    – user64494
    Commented Apr 2, 2021 at 13:46
  • $\begingroup$ I'd like to add that -1 + EllipticTheta[3, 0, x]^2 is a formal result since the series under consideration diverges if Abs[x]>1. $\endgroup$
    – user64494
    Commented Apr 2, 2021 at 13:52
  • $\begingroup$ In fact, this is my approach, onlly expressed by a complicated and uncommented code. I don't see any advantage. $\endgroup$
    – user64494
    Commented Apr 2, 2021 at 14:09
4
$\begingroup$

Instead of dealing with indices, try

Sum[Piecewise[{{f[m, n], m^2 + n^2 != 0}, {0, True}}], {m, -Infinity,  Infinity}, {n, -Infinity, Infinity}]

It should be noticed the notation n,k is preferable over n,m which are similar.

$\endgroup$
2
  • $\begingroup$ Yes, it works in general. But, sadly not in my case... Other problems. $\endgroup$ Commented Apr 1, 2021 at 12:01
  • 4
    $\begingroup$ @niloderoock: Please, present your case. What was asked, that was answered. $\endgroup$
    – user64494
    Commented Apr 1, 2021 at 12:14
2
$\begingroup$

You can do

Sum[If[n == 0 && m == 0,0, f[m,n]],{m,-Infinity,Infinity},{n,-Infinity,Infinity}]
$\endgroup$
1
  • 1
    $\begingroup$ This is my approach only formulated in other formulas. I don't see any advantage. $\endgroup$
    – user64494
    Commented Apr 2, 2021 at 13:55

Not the answer you're looking for? Browse other questions tagged or ask your own question.