3
$\begingroup$

I have following summation that I want to implement using Mathematica:

Sum[
 If[m == 0 && n == 0
  , Nothing
  , (1/z^2 + (1/(z - (m 2 π + n 2 π τ))^2 - 
         1/((m 2 π + 
              n 2 π τ))^2) /. {z -> π τ}) - (1/
        z^2 + (1/(z - (m 2 π + n 2 π τ))^2 - 
         1/((m 2 π + n 2 π τ))^2) /. z -> π) // 
   Simplify
  ], {m, -∞, ∞}, {n, -∞, ∞}
 ]

Above code returns the following result:

$-\frac{2 \left(\tau ^2-1\right)}{\pi ^2 \tau ^2}$

However, if I remove the If command in the above summation, Mathematica doesn't do the summation anymore, but I know the above expression is finite when m=0&&n=0. What's going on here?

$\endgroup$
7
  • 1
    $\begingroup$ I'missing "if command" $\endgroup$ Commented Dec 21, 2023 at 21:11
  • $\begingroup$ @UlrichNeumann Ooops, I have copied the code without if $\endgroup$
    – Vayne
    Commented Dec 21, 2023 at 21:17
  • 1
    $\begingroup$ The sum as written diverges. But Sum is not handling that If in the way you might expect, and that result is simply the value when m,n=0. $\endgroup$ Commented Dec 21, 2023 at 21:36
  • 2
    $\begingroup$ What do you expect of using Nothing inside Sum? It has no sense. $\endgroup$ Commented Dec 21, 2023 at 21:42
  • 1
    $\begingroup$ The main issue is that there is a nonzero constant term in the summand. Even with that removed I do not think Sum will manage this though. $\endgroup$ Commented Dec 21, 2023 at 22:40

1 Answer 1

0
$\begingroup$

For Timing reasons, its not a good idea to Simplify inside a sum, because Sum has Attribute HoldFirst, meaning that each summand is simplified with actual numbers n,m. But this sum has to be evaluated algebraically (or by table lookup).

Simplification reveals two problems, removal of 1/m^2, 1/n^2 at infinity and

(1/z^2 + (1/(z - (m 2 \[Pi] + n 2 \[Pi] \[Tau]))^2 - 
   1/((m 2 \[Pi] + 
        n 2 \[Pi] \[Tau]))^2) /. {z -> \[Pi] \[Tau]}) - (1/
  z^2 + (1/(z - (m 2 \[Pi] + n 2 \[Pi] \[Tau]))^2 - 
   1/((m 2 \[Pi] + n 2 \[Pi] \[Tau]))^2) /. 
z -> \[Pi]) // Simplify

$$\frac{1}{(2 \pi m+2 \pi n \tau -\pi \tau )^2}-\frac{1}{(-2 \pi m-2 \pi n \tau +\pi )^2}+\frac{\frac{1}{\tau ^2}-1}{\pi ^2}$$

a constant term, that, in a double sum, occurs inifintely often.

Probably, there is a wrong sign of the compensating constant for the limit $n,m\to 0$

  \[Pi]^2 FullSimplify@ExpandAll[(-1 + 1/\[Tau]^2)/\[Pi]^2 - 
    1/(\[Pi] - 2 m \[Pi] - 2 n \[Pi] \[Tau])^2 + 
  1/(2 m \[Pi] - \[Pi] \[Tau] + 2 n \[Pi] \[Tau])^2 /. {n ->  0}] 

$$\frac{1}{(\tau -2 m)^2}-\frac{1}{(1-2 m)^2}+\frac{1}{\tau ^2}-1$$

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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