# double sum with condition

I was trying to compute the following sum:

$$\phi(x,y)=\frac{1}{4\pi^2}\sum_{(n,m)\neq(0,0)}\frac{1}{n^2+m^2}\exp(i(nx+my))$$ where the range of indices is, say, $-10\leq n, \,m\leq 10$.

But I don't know how to "encode" the condition $(n,m)\neq(0,0)$ into Mathematica. I tried this:

phi[x, y] = (1/(4 Pi^2)) Sum[(1/(n^2 + m^2))*Exp[I*(n*x + m*y)], {n, -10, 10},
{m, -10, 10}, n^2+m^2>0]

but it didn't work.

Thanks for any help!

Thanks everyone. I tried to use If statement inside the Sum command, and it worked. Here it is:

phi[x, y] = 1/(4 Pi^2) Sum[ If[0 < n^2 + m^2, 1/(n^2 + m^2) Exp[I*(n*x + m*y)], 0],
{n, -10, 10}, {m, -10, 10}]
• {n, DeleteCases[Range[-10, 10], 0]} ? – Algohi Apr 7 '16 at 20:39
• You could just put an If statement inside your sum: If[n^2 + m^2 == 0, 0, ...]. – wxffles Apr 7 '16 at 20:50

Interestingly, when x=$\pi$ the sum with infinite limits can be computed
• Hi yarchik, what does nmx do here? I think we still have $(n,m)=(0,0)$ here, which is not what I want. – mori39 Apr 8 '16 at 2:32