mirror of
https://github.com/josdejong/mathjs.git
synced 2026-01-25 15:07:57 +00:00
54 lines
1.5 KiB
Markdown
54 lines
1.5 KiB
Markdown
---
|
|
layout: default
|
|
---
|
|
|
|
<!-- Note: This file is automatically generated from source code comments. Changes made in this file will be overridden. -->
|
|
|
|
<h1 id="function-setcartesian">Function setCartesian <a href="#function-setcartesian" title="Permalink">#</a></h1>
|
|
|
|
Create the cartesian product of two (multi)sets.
|
|
Multi-dimension arrays will be converted to single-dimension arrays
|
|
and the values will be sorted in ascending order before the operation.
|
|
|
|
|
|
<h2 id="syntax">Syntax <a href="#syntax" title="Permalink">#</a></h2>
|
|
|
|
```js
|
|
math.setCartesian(set1, set2)
|
|
```
|
|
|
|
<h3 id="parameters">Parameters <a href="#parameters" title="Permalink">#</a></h3>
|
|
|
|
Parameter | Type | Description
|
|
--------- | ---- | -----------
|
|
`a1` | Array | Matrix | A (multi)set
|
|
`a2` | Array | Matrix | A (multi)set
|
|
|
|
<h3 id="returns">Returns <a href="#returns" title="Permalink">#</a></h3>
|
|
|
|
Type | Description
|
|
---- | -----------
|
|
Array | Matrix | The cartesian product of two (multi)sets
|
|
|
|
|
|
<h3 id="throws">Throws <a href="#throws" title="Permalink">#</a></h3>
|
|
|
|
Type | Description
|
|
---- | -----------
|
|
|
|
|
|
<h2 id="examples">Examples <a href="#examples" title="Permalink">#</a></h2>
|
|
|
|
```js
|
|
math.setCartesian([1, 2], [3, 4]) // returns [[1, 3], [1, 4], [2, 3], [2, 4]]
|
|
math.setCartesian([4, 3], [2, 1]) // returns [[3, 1], [3, 2], [4, 1], [4, 2]]
|
|
```
|
|
|
|
|
|
<h2 id="see-also">See also <a href="#see-also" title="Permalink">#</a></h2>
|
|
|
|
[setUnion](setUnion.html),
|
|
[setIntersect](setIntersect.html),
|
|
[setDifference](setDifference.html),
|
|
[setPowerset](setPowerset.html)
|