Take the 2-minute tour ×
Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

How does one evaluate something like the following? $$\sum_{k=0}^{-1}\left( 5\times 2^k \right)$$

When I type this into Mathematica it returns 0. Can someone explain why this is?

share|improve this question
    
Undefined is a very shot answer. –  Dhaivat Pandya Apr 25 '11 at 21:12
1  
This kind of expression is covered by the second paragraph of the Wikipedia article Empty sum –  Henry Apr 25 '11 at 21:21
1  
Seems like the wikipedia article needs some rewriting. –  Phira Apr 25 '11 at 21:23
add comment

3 Answers

up vote 14 down vote accepted

The sum $$\sum_{k=a}^b f(k)$$ for integers $a$ and $b$ is usually (often, but not exclusively) interpreted as the sum of all values of $f(k)$ for $k$ an integer, $a\leq k\leq b$.

If $a\gt b$, then there are no integers $k$ that satisfy the condition $a\leq k\leq b$, so this is a sum with no summands (or "empty sum").

In order to make sure that associativity laws are respected, empty sums (sums with no summands) are defined to be equal to $0$ (likewise, empty products are defined to be equal to $1$).

Since your sum is empty, it is equal to zero by definition.

See also: this question (discussing the value of a "product with no factors"); the same argument for why the product with no factors "should" be equal to $1$ applies to see why the sum with no summands "should" be equal to $0$, based on associativity.

share|improve this answer
    
This is neither the interpretation of Mathematica nor is it the only useful mathematical interpretation, see my response. –  Phira Apr 25 '11 at 21:25
    
@user9325: If there is something in my response that is false, I'll be happy to correct it. If your whole point is "this is not as good as my answer", then perhaps your comment should be addressed at the OP. –  Arturo Magidin Apr 25 '11 at 21:28
2  
@user9325: I do not "think that Mathematica uses [my] convention" (nor is it my convention; it is a very generally accepted convention). I did not know what Mathematica uses, and voted up your answer for the information. The question does not ask why Mathematica evaluates it to zero (or even how Mathematica evaluates the sum), but rather "how does one" evaluate the sum (the comment about Mathematica follows the question). As such, I disagree that the reply "does not answer the posed question"; the posed question is "how does one evaluate a sum with upper limit smaller than lower limit?" –  Arturo Magidin Apr 25 '11 at 21:38
1  
@user9325: For the record, the response was not that "the comment should go away", it was that perhaps it should be adressed elsewhere. For the record, your claim that I did not "answer the posed question" continues to ignore what the initial question of the post is. For the record, your written explanation as it now stands of Mathematica's treatment of the sum completely ignores the question of what happens when upper limits are larger than lower limits, and your recasting of it with a counter increment of -1 is not the default parsing, according to others. –  Arturo Magidin Apr 26 '11 at 13:16
1  
@user9325: Then perhaps you can clarify that sentence, given that there is no "the comment" to refer to any more, while you spend some time explaining what Mathematica does when the upper limit is smaller than the lower limit (saying it treats it as an explicit sum as you do does not answer the first question asked by the OP, which is how to evaluate a sum of terms where the first term has larger argument than the last term). You know, geese and gander and all that. Or don't. I do begin to understand, though, some of your comments in meta. –  Arturo Magidin Apr 26 '11 at 20:19
show 4 more comments

Mathematica treats a sum $\sum_{k=a}^{b}f(k)$ as the sum $f(a)+f(a+1)+\cdots + f(a+\lfloor{b-a}\rfloor)$ which is one possible interpretation that allows sums with non-integer arguments. You can write Sum[f[k],{k,0,-1,-1}] to get the result of the comment.

Another common interpretation is that this sum runs over all integers between $a$ and $b$.

Another common and useful interpretation is the one that for integers $a,b,c$ respects $$\sum_{k=a}^{b-1}f(k) +\sum_{k=b}^{c-1}f(k) =\sum_{k=a}^{c-1}f(k).$$

This interpretation has the big advantage that many summation formulas hold for positive and negative upper summation index simultaneously.

For your sum, all common interpretations give $0$ even though the last interpretation gives $\sum_{k=0}^{-2}f(k) = -f(-1)$

share|improve this answer
1  
+1 for the interpretation that preserves additivity of sums. Two things worth mentioning in that respect: a) This only makes sense for invertible addition operations. b) There's a direct analogy with integrals, where this is in fact the only accepted interpretation of reversing the limits. The fact that we need awkward $-1$s in case of the sums is also just a matter of convention; the formula would correspond even more closely to the additivity of integrals if we'd define sums so as to exclude one of the limits. –  joriki Apr 25 '11 at 21:33
    
@Arturo Magidin Thanks for the tex clean-up. –  Phira Apr 25 '11 at 21:37
    
If you're going to go that route, you have to find a way to somehow indicate that the increment for the dummy variable is negative. The iterator {k,0,-1,-1} is valid in Mathematica since you keep adding increments of -1 to k==0 until you reach the value k==-1; if you had, say, {k,0,-1} (implicitly, {k,0,-1,1}), then Arturo's answer applies. –  J. M. Apr 26 '11 at 0:43
    
@user9325: Could you clarify something in your first sentence? I don't understand what happens if $b-a\lt 0$; does Mathematica automatically perform a negative increment, or does it parse the sum as empty? If this is implemented as either a while-loop or a for-loop where the index is initialized to $i=a$, the sum to $0$, and at each step we add $f(i)$ to the running total and increment $i$ until the index exceeds $a+\lfloor b-a\rfloor$, then the sum would be empty and give a result of $0$. But if Mathematica adds all integer values "between" $a$ and $a+\lfloor b-a\rfloor$, it's different. –  Arturo Magidin Apr 26 '11 at 2:36
    
@Arturo: The default increment Mathematica uses for an iterator like {i, 0, 10} is 1 (i.e., this is explicitly the same as {i, 0, 10, 1}). Thus, if the starting index is greater than the ending index and there is no explicitly given increment (e.g. {i, 3, 2}), Sum[] will return 0, Product[] will return 1, Table[] will return an empty list {} and Do[] will not execute its body, to use some examples of Mathematica entities that use iterators. –  J. M. Apr 26 '11 at 3:07
show 4 more comments

I think it is a convention that summations start at the lower limit and increment by $1$ until the upper bound is reached. In your example there is no allowable value for $k$ that is no larger than the upper bound. You are adding together an empty collection of elements. Suppose that $A$ is a set of numbers. Consider

$$N = \sum A$$ and

$$ \sum (A \cup \varnothing) = \sum A + \sum \varnothing.$$

Since $A = A \cup \varnothing$ the two sums should be equal. But then $\sum \varnothing = 0$.

share|improve this answer
2  
Punctuation goes outside in-line formulas, but inside displayed formulas. So you should have $$blah.$$ to prevent the orphaned period. –  Arturo Magidin Apr 25 '11 at 21:16
    
@Arturo Magidin: De-orphaned the period. Thank you for the info. –  Jay Apr 25 '11 at 22:22
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.