UNPKG

1 kBMarkdownView Raw
1<!-- Note: This file is automatically generated from source code comments. Changes made in this file will be overridden. -->
2
3# Function setCartesian
4
5Create the cartesian product of two (multi)sets.
6Multi-dimension arrays will be converted to single-dimension arrays
7and the values will be sorted in ascending order before the operation.
8
9
10## Syntax
11
12```js
13math.setCartesian(set1, set2)
14```
15
16### Parameters
17
18Parameter | Type | Description
19--------- | ---- | -----------
20`a1` | Array &#124; Matrix | A (multi)set
21`a2` | Array &#124; Matrix | A (multi)set
22
23### Returns
24
25Type | Description
26---- | -----------
27Array &#124; Matrix | The cartesian product of two (multi)sets
28
29
30## Examples
31
32```js
33math.setCartesian([1, 2], [3, 4]) // returns [[1, 3], [1, 4], [2, 3], [2, 4]]
34math.setCartesian([4, 3], [2, 1]) // returns [[3, 1], [3, 2], [4, 1], [4, 2]]
35```
36
37
38## See also
39
40[setUnion](setUnion.md),
41[setIntersect](setIntersect.md),
42[setDifference](setDifference.md),
43[setPowerset](setPowerset.md)