:cumSum(list)

this returns a list in which each element is the sum of all the elements before it in the parameter.

:cumSum(matrix)

Each element in each row will be the sum of all the matching elements in the preceding rows.

## LocationEdit

- 2ND + STAT (LIST)
*OPS*- 6:cumSum(

or

- 2ND + X
^{-1}(MATRIX) *MATH*- 0:cumSum(

## ExampleEdit

:Input "HOW MANY NUMS?",N : :0→dim(L1) :N→dim(L1) :L1+1→L1 : :cumSum(L1)→L1 : :cumSum(L1)→L1 : :Pause L1

This displays triangle numbers.

The first block asks for how many triangle numbers to calculate. The second block sets L1 to a list full of ones. It does this by clearing the list, than adding 1 to each number.

After the first cumSum, L1 will be `{1,2,3,4,5,...}`

, each position having a number equal to 1 times its position.

After the second cumSum, L1 will be `{1,3,6,10,15,...}`

. The first element is 1, the second 1+2, the third 1+2+3

Then it displays the results.