# Cumulated sum of the elements of a list: cumSum

### 5.40.27 Cumulated sum of the elements of a list: cumSum

The cumSum command finds the partial sums of a list or sequence; namely, the kth element of the

- cumSum takes one argument:
  L, a list or sequence of numbers or of strings.
- cumSum(L) returns the list or sequence with same length as L and whose kth element is the sum or concatenation of elements 0 through k of L.

#### Examples.

- Input:
  cumSum(sqrt(2),3,4,5,6)
  Output:

  √

  2

  ,

  √

  2

  +3,

  √

  2

  +3+4,

  √

  2

  +3+4+5,

  √

  2

  +3+4+5+6

  Input:
  normal(cumSum(sqrt(2),3,4,5,6))
  Output:

  √

  2

  ,

  √

  2

  +3,

  √

  2

  +7,

  √

  2

  +12,

  √

  2

  +18

- Input:
  cumSum(1.2,3,4.5,6)
  Output:

  1.2,4.2,8.7,14.7

- Input:
  cumSum([0,1,2,3,4])
  Output:

  ⎡ ⎣ | 0,1,3,6,10 | ⎤ ⎦

- Input:
  cumSum("a","b","c","d")
  Output:

  "a","ab","abc","abcd"

- Input:
  cumSum(["a","ab","abc","abcd"])
  Output:

  ⎡ ⎣ | "a","aab","aababc","aababcabcd" | ⎤ ⎦