1 |
|
2 |
|
3 | # Function setDifference
|
4 |
|
5 | Create the difference of two (multi)sets: every element of set1, that is not the element of set2.
|
6 | Multi-dimension arrays will be converted to single-dimension arrays before the operation.
|
7 |
|
8 |
|
9 | ## Syntax
|
10 |
|
11 | ```js
|
12 | math.setDifference(set1, set2)
|
13 | ```
|
14 |
|
15 | ### Parameters
|
16 |
|
17 | Parameter | Type | Description
|
18 | --------- | ---- | -----------
|
19 | `a1` | Array | Matrix | A (multi)set
|
20 | `a2` | Array | Matrix | A (multi)set
|
21 |
|
22 | ### Returns
|
23 |
|
24 | Type | Description
|
25 | ---- | -----------
|
26 | Array | Matrix | The difference of two (multi)sets
|
27 |
|
28 |
|
29 | ## Examples
|
30 |
|
31 | ```js
|
32 | math.setDifference([1, 2, 3, 4], [3, 4, 5, 6]) // returns [1, 2]
|
33 | math.setDifference([[1, 2], [3, 4]], [[3, 4], [5, 6]]) // returns [1, 2]
|
34 | ```
|
35 |
|
36 |
|
37 | ## See also
|
38 |
|
39 | [setUnion](setUnion.md),
|
40 | [setIntersect](setIntersect.md),
|
41 | [setSymDifference](setSymDifference.md)
|