# Problem with infinite sum

I am facing a problem in evaluating infinite sums of the following form.

As a first thing define the following function

Z[n_] := Product[1/(1 - t^i), {i, 1, n}]

P[list_] := (num = Union[list]; Product[Z[Count[list, num[[i]]]], {i, 1, Length[num]}])


Then consider a sum of the following kind

Sum[P[{i, j}]*t^(-i - j), {i, 0, ∞}, {j, 0, ∞}]


Now, Mathematica behaves in a strange way: it considers the P[{i,j}] factor as if i is always different than j. This does not make sense, since for example I am summing over the couples (2,2) and (3,3).

I believe the problem relies in the way the infinity is considered, since everything works fine with arbitrary high finite sums.

What could I do?

• You are attempting to have a symbolic summation understand procedurally computed arguments (that is, they require Union and Count). I cannot imagine how one might get this to work in its current form. – Daniel Lichtblau Sep 9 '14 at 21:26

a bit of a cheat maybe:

 Z[n_] := Product[1/(1 - t^i), {i, 1, n}]
P1[list_] := (Z^2)
P2[list_] := Z
Sum[P1[{i, j}]*t^(-i - j), {i, 0, j - 1}, {j, 0, Infinity}] +
Sum[P2[{j, j}]*t^(-2 j), {j, 0, Infinity}] +
Sum[P1[{i, j}]*t^(-i - j), {i, j + 1, Infinity}, {j, 0, Infinity}] // Simplify


(t (-(-1 + t) t^-j + (t^2 (3 + t))/(1 + t)^2))/(-1 + t)^4

• This does work, but it doesn't solve the problem at all. Probably it's my fault that I have not explained well. I would like P[list_], defined as it is, to work for any list and not only a list of 2 elements. If for example I have 894 elements in the list, your method of splitting the sum by hand, in order to insert the right factor, will be quite annoying to carry out. – Federico Carta Jul 12 '14 at 17:38