TI-BASIC:Cumsum

From Learn @ Cemetech
Jump to navigationJump to search

CUMSUM.GIF

Command Summary

Calculates cumulative sums of a list or of the columns of a matrix.

Command Syntax

cumSum(list or matrix)

Menu Location

Press:

  1. 2nd LIST to access the list menu.
  2. RIGHT to access the OPS submenu.
  3. 6 to select cumSum(, or use arrows.

Alternatively, press:

  1. MATRX (TI-83) or 2nd MATRX (TI-83+ or higher) to access the matrix menu.
  2. RIGHT to access the MATH submenu.
  3. 0 to select cumSum(, or use arrows.

Calculator Compatibility

TI-83/84/+/SE

Token Size

2 bytes

cumSum( calculates the cumulative sums of a list, or of the columns of a matrix, and outputs them in a new list or matrix variable.

For a list, this means that the Nth element of the result is the sum of the first N elements of the list:

cumSum({1,3,5,7,9})
	{1 4 9 16 25}

For a matrix, cumSum( is applied to each column in the same way as it would be for a list (but numbers in different columns are never added):

[[0,1,1][0,1,3][0,1,5][0,1,7]]
	[[0 1 1]
	 [0 1 3]
	 [0 1 5]
	 [0 1 7]]
cumSum(Ans)
	[[0 1 1]
	 [0 2 4]
	 [0 3 9]
	 [0 4 16]]

Advanced Uses

The ΔList( command is very nearly the inverse of the cumSum( command - it calculates the differences between consecutive elements. For any list, ΔList(cumSum(list)) will return the same list, but without its first element:

ΔList(cumSum({1,2,3,4,5,6,7}))
	{2 3 4 5 6 7}


Removing the first element would otherwise be a difficult procedure involving the seq( command, so this is a useful trick to know.


For a matrix, if you want to sum up the rows instead of the columns, use the T (Transpose) command.

Related Commands