The sum( Command

We're glad you came by, but you might find what you're looking for elsewhere.

TI-Basic Developer is not the site it once was. While its information on commands and other calculator features remains almost second-to-none, its forum, archives, and even hosting service, Wikidot, have been decaying for years. The calculator community would love to see what you're working on, or help you in your next coding adventure, but TI-Basic Developer is no longer the place to do it.

Instead, you should head over to Cemetech (primarily American) or TI-Planet (primarily international). Both are active, well-established forums with their own archives, chatrooms, reference material, and abundant coding tools and resources. We'll see you there, we hope.

SUM.GIF

Command Summary

Calculates the sum of all or part of a list.

Command Syntax

sum(list[,start,[end]])

Menu Location

Press:

  1. 2nd LIST to access the list menu.
  2. LEFT to access the MATH submenu.
  3. 5 to select sum(, or use arrows and ENTER.

Calculator Compatibility

TI-83/84/+/SE

Token Size

1 byte

The sum( command calculates the sum of all or part of a list.

When you use it with only one argument, the list, it sums up all the elements of the list. You can also give it a bound of start and end and it will only sum up the elements starting and ending at those indices (inclusive).

sum({1,2,3,4,5})
    15
sum({1,2,3,4,5},2,4)
    9
sum({1,2,3,4,5},3)
    12

Optimization

If the value of end is the last element of the list, it can be omitted:

sum({1,2,3,4,5},3,5)
can be
sum({1,2,3,4,5},3)

Error Conditions

  • ERR:DOMAIN is thrown if the starting or ending value aren't positive integers.
  • ERR:INVALID DIM is thrown if the starting or ending value exceed the size of the list, or are in the wrong order.

Related Commands

.

Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-Noncommercial 2.5 License.