# sum() Function & Examples

Use the sum() statistics function in Calcul.io. Review its syntax, edit working examples, understand the result, and explore related math functions.

## sum

#### sum(a, b, c, ...)

#### sum(A)

#### sum(A, dimension)

Try it yourself:

```calculio
sum(2, 3, 4, 1)
sum([2, 3, 4, 1])
sum([2, 5; 4, 3])
```

[max](https://calcul.io/function/max/index.md)

[mean](https://calcul.io/function/mean/index.md)

[median](https://calcul.io/function/median/index.md)

[min](https://calcul.io/function/min/index.md)

[prod](https://calcul.io/function/prod/index.md)

[std](https://calcul.io/function/std/index.md)

[variance](https://calcul.io/function/variance/index.md)

---

## sum(): add collection values

**sum(values)** adds the entries in a collection. It is the basic aggregate for totals, weighted calculations, and normalization.

## Examples

`sum([2, 4, 6])` is 12. In a matrix workflow, check which dimension is being aggregated so a row total is not mistaken for a whole-matrix total.

## Related summaries

Divide a sum by a count with [mean()](https://calcul.io/function/mean/index.md), inspect extremes with [min()](https://calcul.io/function/min/index.md) and [max()](https://calcul.io/function/max/index.md), and measure spread with [variance()](https://calcul.io/function/variance/index.md). Use [size()](https://calcul.io/function/size/index.md) to confirm collection shape.

## Caveat

Validate that entries are finite numeric values; a missing or exceptional value can spoil a total.

[All functions](https://calcul.io/functions/index.md)
