mirror of
https://github.com/josdejong/mathjs.git
synced 2026-01-25 15:07:57 +00:00
1.4 KiB
1.4 KiB
| layout |
|---|
| default |
Function setDifference #
Create the difference of two (multi)sets: every element of set1, that is not the element of set2. Multi-dimension arrays will be converted to single-dimension arrays before the operation.
Syntax #
math.setDifference(set1, set2)
Parameters #
| Parameter | Type | Description |
|---|---|---|
a1 |
Array | Matrix | A (multi)set |
a2 |
Array | Matrix | A (multi)set |
Returns #
| Type | Description |
|---|---|
| Array | Matrix | The difference of two (multi)sets |
Examples #
math.setDifference([1, 2, 3, 4], [3, 4, 5, 6]); // returns [1, 2]
math.setDifference([[1, 2], [3, 4]], [[3, 4], [5, 6]]); // returns [1, 2]