# Why the difference?

When I do the double sum using the sigma notation I get

$$1 + \sum_{n=0}^{\infty}\sum_{k = n}^{\infty} \frac{1}{(k+2)k!}$$

$1 + e - \cosh$

When I do the sums as below, I get the expected answer.

1 + Sum[Sum[1/((k + 2) k!), {k, n, Infinity}], {n, 0, Infinity}]


$e$

Why the difference?

Edit for those who might like to see the only identity I could find:

Defer[1 + Sum[Sum[1/((k + 1)! + k!), {k, n, Infinity}], {n, 0, Infinity}]]

• Could you explain what you mean by "doing" a sum "using the sigma notation"? – whuber Apr 22 '13 at 14:50
• I guess he means this 1 + \!$$\*UnderoverscriptBox[\(\[Sum]$$, $$n = 0$$, $$\[Infinity]$$]$$\*UnderoverscriptBox[\(\[Sum]$$, $$k = n$$, $$\[Infinity]$$] \*FractionBox[$$1$$, $$\((k + 1)$$ $$k!$$\)]\)\). This by the way does not converge in Mathematica 9 and in place of 1 + e - Cosh returns the input unchanged. The Sum version does converge to $\mathrm e$. – PlatoManiac Apr 22 '13 at 14:54
• This seems to work 1 + \!$$\*UnderoverscriptBox[\(\[Sum]$$, $$n = 0$$, $$\[Infinity]$$]$$( \*UnderoverscriptBox[\(\[Sum]$$, $$k = n$$, $$\[Infinity]$$] \*FractionBox[$$1$$, $$\((k + 2)$$\ $$k!$$\)])\)\) – user0501 Apr 22 '13 at 14:59
• @whuber sigma, a Greek letter ;) – BoLe Apr 22 '13 at 14:59
• The sigma notation is a red herring here. The difference is between 1 + Sum[Sum[1/((k + 2) k!), {k, n, Infinity}], {n, 0, Infinity}] and 1 + Sum[1/((k + 2) k!), {n, 0, Infinity}, {k, n, Infinity}] They should give the same answer but they don't. – Simon Woods Apr 22 '13 at 15:37

You can use Defer to see how to properly enter your "summation" type notation.

Defer[1 + Sum[Sum[1/((k + 2) k!), {k, n, Infinity}], {n, 0, Infinity}]]


You can then enter that output to see that it works. You must've entered something different. • +1, I didn't put the () around the second sum. – Fred Kline Apr 22 '13 at 15:08
• Sum[1/((k + 2)*k!), {n, 0, Infinity}, {k, n, Infinity}] takes forever time on my MMA 9. I think there might be something more here than just mis-input? – Silvia Apr 22 '13 at 16:50
• @FredKline If reverse the iterators does the work, I'd call it a bug. And it doesn't work in version 9. – Silvia Apr 22 '13 at 17:27
• @FredKline Please see my answer, especially the note at the end. – Silvia Apr 22 '13 at 17:48

I think it's because in the sigma form the two sums are treated as a double sum with different order as the expression case:

In==> $$\text{Hold}[\sum _{n=0}^{\infty } \sum _{k=n}^{\infty } \frac{1}{(k+2) k!}]//\text{InputForm}$$ Out==>

Hold[Sum[1/((k + 2)*k!), {n, 0, Infinity}, {k, n, Infinity}]]


and according to the documentation, the sum for n will be evaluate first.

In multiple sums, the range of the outermost variable is given first.

So if we interchange the two sigma, it would work:

in==> $$1+\sum _{k=n}^{\infty } \sum _{n=0}^{\infty } \frac{1}{(k+2) k!}$$ out==> $$e$$

I'm using version 8 on Mac. Here is a screen shot: • Curious, interchanging the sigmas doesn't work here ... (Mma 9 on win) – Dr. belisarius Apr 22 '13 at 15:14
• Pretty much exactly the opposite of what I did - very cool! – Mark McClure Apr 22 '13 at 15:33
• @belisarius, exchanging the iterators shouldn't work. The correct way round is for the outermost variable to be given first. Compare Sum[1,{i,1,2},{j,1,i}] with Sum[1,{j,1,i},{i,1,2}] – Simon Woods Apr 22 '13 at 15:46
• @SimonWoods why do you say that? Could you point out where is wrong in my answer? – user0501 Apr 22 '13 at 16:04
• Agree with Simon, the exchanging shouldn't work.(and it indeed does not work in my MMA 9.) By math notation convention, in nested summation, the most inner one (i.e. the rightest one) should be calculated first, as the range of any given iterator is restricted by every iterators to its left. (ref.) The nesting syntax of Sum is similar as Table. – Silvia Apr 22 '13 at 16:44

As we should expect the following identity (maybe under some certain mathematical assumptions, I'm not sure):

$$\sum _i \sum _j f(i,j)=\sum _i \left(\sum _j f(i,j)\right)\;\text{,}$$

which we can confirm in Mathematica 9 by the examples say: However, the nested-iterator version of the summation in the original question takes forever time in my Mathematica 9:

Sum[1/((k + 2)*k!),
{n, 0, Infinity}, {k, n, Infinity}]


while the nested-Sum version

Sum[
Sum[1/((k + 2)*k!),
{k, n, Infinity}],
{n, 0, Infinity}]


as Mark McClure said in answer above, and user0501 said in comment, evaluates quickly to 1 + E.

So for the " Why the difference? ", my guessing is maybe Mathematica uses different algorithms and strategies for this two different kind of summations, which eventually make the former one unable to reach the answer for OP's problem.

# Note

I believe it's a bug or something that in some Mathematica version exchanging the iterators works.

Have a look at the following snapshot taken from Mathematica 9: The upper one, i.e. the iterator-exchanged one, has a lighter-green n under the most left $\sum$, which indicates it's a free global symbol, against the correct situation where it should be a iterator symbol with celadon colored. So $k$ gets wrongly out of the scope of $\sum_{n=0}^\infty$ here.

• I see your point, that's cool to show that. By the way where do you get the second picture? – user0501 Apr 22 '13 at 17:52
• @user0501 It's in the preferences dialog box. – Silvia Apr 22 '13 at 17:57