mirror of
https://github.com/josdejong/mathjs.git
synced 2025-12-08 19:46:04 +00:00
869 B
869 B
Function setCartesian
Create the cartesian product of two (multi)sets. Multi-dimension arrays will be converted to single-dimension arrays before the operation.
Syntax
math.setCartesian(set1, set2)
Parameters
| Parameter | Type | Description |
|---|---|---|
a1 |
Array | Matrix | A (multi)set |
a2 |
Array | Matrix | A (multi)set |
Returns
| Type | Description |
|---|---|
| Array | Matrix | The cartesian product of two (multi)sets |
Examples
math.setCartesian([1, 2], [3, 4]) // returns [[1, 3], [1, 4], [2, 3], [2, 4]]