# cumsum {#cumsum}

## Syntax {#syntax}

`cumsum(X)`

Please see [Cumulative Window Functions](../Themes/cumFunctions.md) for the parameter description and windowing logic.

## Details {#details}

Cumulatively calculate the sum of the elements in *X*.

## Examples {#examples}

```python
x=[2,3,4];
cumsum(x);
// output: [2,5,9]

m=matrix(1 2 3, 4 5 6);
m;
```

|\#0|\#1|
|---|---|
|1|4|
|2|5|
|3|6|

```python
cumsum(m);
```

|\#0|\#1|
|---|---|
|1|4|
|3|9|
|6|15|

Related functions: [cumsum2](cumsum2.md), [cumsum3](cumsum3.md), [cumsum4](cumsum4.md)

