UNPKG

mathjs

Version:

Math.js is an extensive math library for JavaScript and Node.js. It features a flexible expression parser with support for symbolic computation, comes with a large set of built-in functions and constants, and offers an integrated solution to work with dif

41 lines (25 loc) 862 B
<!-- Note: This file is automatically generated from source code comments. Changes made in this file will be overridden. --> # 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 &#124; Matrix | A (multi)set `a2` | Array &#124; Matrix | A (multi)set ### Returns Type | Description ---- | ----------- Array &#124; Matrix | The union of two (multi)sets ## 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.md), [setDifference](setDifference.md)