# setMultiplicity() Function & Examples

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

## setMultiplicity

#### setMultiplicity(element, set)

Try it yourself:

```calculio
setMultiplicity(1, [1, 2, 2, 4])
setMultiplicity(2, [1, 2, 2, 4])
```

---

## Count repeated members with setMultiplicity

**setMultiplicity** measures how often a member occurs in a multiset-like collection. It retains frequency information that ordinary set operations discard.

## When it helps

Use it for inventory counts, repeated observations, and bag comparisons. Contrast [setDistinct](https://calcul.io/function/setDistinct/index.md), which keeps only membership, and [mode](https://calcul.io/function/mode/index.md), which identifies the most frequent value.

## Caveats

Define equality consistently before counting, especially for objects and rounded numeric data. Use [count](https://calcul.io/function/count/index.md) for total entries and [setSize](https://calcul.io/function/setSize/index.md) for distinct cardinality; those answer different questions.

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