--- layout: default ---

Function setUnion #

Create the union of two (multi)sets. Multi-dimension arrays will be converted to single-dimension arrays before the operation.

Syntax #

```js math.setUnion(set1, set2) ```

Parameters #

Parameter | Type | Description --------- | ---- | ----------- `a1` | Array | Matrix | A (multi)set `a2` | Array | Matrix | A (multi)set

Returns #

Type | Description ---- | ----------- Array | Matrix | The union of two (multi)sets

Throws #

Type | Description ---- | -----------

Examples #

```js math.setUnion([1, 2, 3, 4], [3, 4, 5, 6]) // returns [1, 2, 3, 4, 5, 6] math.setUnion([[1, 2], [3, 4]], [[3, 4], [5, 6]]) // returns [1, 2, 3, 4, 5, 6] ```

See also #

[setIntersect](setIntersect.html), [setDifference](setDifference.html)