# cumprod {#cumprod}

## Syntax {#syntax}

`cumprod(X)`

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

## Details {#details}

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

## Examples {#examples}

```
cumprod(2 3 4);
// output: [2,6,24]  // equivalent to  [2, 2*3, 2*3*4]

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

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

```
cumprod(m);
```

|\#0|\#1|
|---|---|
|1|4|
|2|20|
|6|120|

Related functions: [prod](../p/prod.md)

