# cumsum2 {#cumsum2}

## Syntax {#syntax}

`cumsum2(X)`

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

## Details {#details}

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

## Examples {#examples}

```
x=[2,3,4];
cumsum2 x;
// output: [4,13,29]

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

|\#0|\#1|
|---|---|
|1|16|
|5|41|
|14|77|

Related function: [cumsum](cumsum.md), [cumsum3](cumsum3.md), [cumsum4](cumsum4.md)

