# Numerical evaluation by NSum at different values

I have the following code:

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


I want to evaluate this at a list of different values of t at once, say

t={1/1000,1/100,1/10,1,2,5/4,3}


How can I achieve this? It will be nice to display the results as table/matrix of two column, too; values of t and its respective evaluation.

• You could define a function aymane[t_?NumericQ] := NSum[(* stuff *)]... – J. M.'s torpor Apr 6 '17 at 12:34
• Thank you, I already did that. now how I evaluate in a set of values, can you give me some hints because I am beginner user. how I achieve the table look? – Aymane Fihadi Apr 6 '17 at 12:38
• Look up Table[] and Grid[], then. – J. M.'s torpor Apr 6 '17 at 12:40
• Thank you. I come up with this Grid[{{1/1000, 1/100, 1/10, 1, 2, 5/4, 3}, Table[aymane[i], {i, {1/1000, 1/100, 1/10, 1, 2, 5/4, 3}}]}] But I remarked that Grid round the numerical values. – Aymane Fihadi Apr 6 '17 at 13:08
• @J.M. Can you help me with this problem, because I want all the decimals without any rounding. – Aymane Fihadi Apr 6 '17 at 13:19

For a start:

Clear@sum
sum[t_?NumericQ] := {t,
NSum[(-1)^(i + j + i*j)*Exp[(-t*Pi)/2*(i^2 + j^2)], {i, -Infinity,
Infinity}, {j, -Infinity, Infinity}, NSumTerms -> 30,
Method -> "AlternatingSigns", WorkingPrecision -> 40]}

out = sum /@ {1/1000, 1/100, 1/10, 1, 2, 5/4, 3};

Grid[{{"t", "sum"}}~Join~Chop[out], Frame -> All, Alignment -> "."] 