# Need to take infinite sum of residues, is there a way to choose the order of operations for ReleaseHold?

I'm computing an infinite sum of residues. I want to do something like this:

Sum[Sum[(-1)^n (2 \[Pi] I) Residue[(w^(I nu + n/2) ws^(I nu - n/2))/(I nu + n/2)^2, {nu, I n/2 + I m}], {n, 1, \[Infinity]}], {m, 0, \[Infinity]}]


Evaluated like that, this gives zero. However, if I choose a specific value of m, specifically m=0,

Sum[(-1)^n (2 \[Pi] I) Residue[(w^(I nu + n/2) ws^(I nu - n/2))/(I nu + n/2)^2, {nu, I n/2}], {n, 1, \[Infinity]}]


I get a nonzero result. The problem is that for generic m,

Sum[(-1)^n (2 \[Pi] I) Residue[(w^(I nu + n/2) ws^(I nu - n/2))/(I nu + n/2)^2, {nu, I n/2 + I m }], {n, 1, \[Infinity]}]


is zero. It's only nonzero for m=0.

I thought that I could make this work by using Hold[], holding evaluation of the residue and releasing it outside the infinite sum. But it appears that applying ReleaseHold[] there doesn't fix the problem, it still evaluates the Residue for the generic case before fitting in the specific ones.

Is there a way to make this work, and get the correct answer out of the infinite sum over m?

(By the way, I know that in this case, all terms besides m=0 will be zero. I need the infinite sum because the same setup needs to treat cases where some of those terms are nonzero.)

-
I would say it's a bug. –  b.gatessucks Dec 31 '13 at 8:00
I don't think it's fair to say it's a bug, Mathematica just has a fixed way it handles order of operations. But there should be a way around it, no? –  Matt Dec 31 '13 at 18:37