Multiple sums are documented with two or more iterators, for example:

Sum[1/(j^2 (i + 1)^2), {i, 1, Infinity}, {j, 1, i}]

however the same answer can be obtained with two nested sums:

Sum[Sum[1/(j^2 (i + 1)^2), {j, 1, i}], {i, 1, Infinity}]

Is there a specific example where a properly formatted single Sum[] command with two iterators will give or should give a different answer from two nested Sum[] commands with the same limits?

I am interested in mathematical reasons, like possible convergence issues, for the moment I am not interested in evaluation speed, neither in ill-formatted code. This is my context: I am the main author of an old Mathematica package for quantum mechanics Quantum, and I have been working during several months on a totally new version, from zero. In the package I define my own versions of several Mathematica commands, which will work on kets and operators instead of complex numbers.

In the old package a single QuantumSum with two iterators was always transformed to two nested QuantumSum commands, but I have been always worried that they way it is implemented in Mathematica implies that they are not always the same. If so, do you have a specific example, maybe one relevant to quantum mechanics?

  • 2
    $\begingroup$ There is a mistake in the subject line, the first iterator is for the outer sum when expanded into nested sums. Your code examples do this correctly. Either a Sum with multiple iterators or expressed with nested sums should be equivalent. If not, I believe that there would be a bug in Mathematica's implementation. $\endgroup$
    – Bob Hanlon
    May 17 '16 at 0:06
  • $\begingroup$ Thank you @BobHanlon I corrected the subject line. $\endgroup$ May 17 '16 at 0:45
  • 2
    $\begingroup$ Shouldn't be a problem for finite sums (or more precisely, if the inner sum is finite); stuff like the sum for the Madelung constant are a different matter, tho. $\endgroup$
    – J. M.'s torpor
    May 17 '16 at 0:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.