# Arrays

Reduce a quantity over the elements of a subscript.

Each value is the expression read as an auxiliary at t = 20 of a small model (time step 0.5) with a resource `Desk` of capacity 2 and a stream of arrivals that outruns it, a level `Tank` filled by the flow `fill`, a conversion `Digester` into the level `Holder`, a delay, a series, a table, a variable, a power draw, a two-node network and a subscript `region` with three elements.

## MEAN

`MEAN(x)`: 1 to 3 arguments.

SUM(x) divided by the element count (subscripts); MEAN("pop", "attr"[, "state"]): an attribute's mean over a population (in that state; 0 if none).

Example: `MEAN(AUX("sales[*]"))` gives 20.

Used in the bundled models Boids flock (continuous, heading).

## PROD

`PROD(x)`: 1 argument.

x multiplied over every element its "[*]" index runs over (subscripts).

Example: `PROD(AUX("sales[*]"))` gives 6,000.

## SUM

`SUM(x)`: 1 to 3 arguments.

x summed over every element its "[*]" (or subrange "[North*]") indexes run over (subscripts); SUM("pop", "attr"[, "state"]): an attribute summed over a population's agents (in that state).

Example: `SUM(AUX("sales[*]"))` gives 60.

## VMAX

`VMAX(x)`: 1 argument.

the largest x over every element its "[*]" index runs over (subscripts).

Example: `VMAX(AUX("sales[*]"))` gives 30.

## VMIN

`VMIN(x)`: 1 argument.

the smallest x over every element its "[*]" index runs over (subscripts).

Example: `VMIN(AUX("sales[*]"))` gives 10.

## See also

- [All function groups and the grammar](index.md), [Distributions](../distributions/index.md)
- Guides that use them: [System dynamics](../../system-dynamics.md), [Agent-based modelling](../../agent-based-modelling.md)
