1 |
|
2 |
|
3 | # Function setPowerset
|
4 |
|
5 | Create the powerset of a (multi)set. (The powerset contains very possible subsets of a (multi)set.)
|
6 | A multi-dimension array will be converted to a single-dimension array before the operation.
|
7 |
|
8 |
|
9 | ## Syntax
|
10 |
|
11 | ```js
|
12 | math.setPowerset(set)
|
13 | ```
|
14 |
|
15 | ### Parameters
|
16 |
|
17 | Parameter | Type | Description
|
18 | --------- | ---- | -----------
|
19 | `a` | Array | Matrix | A (multi)set
|
20 |
|
21 | ### Returns
|
22 |
|
23 | Type | Description
|
24 | ---- | -----------
|
25 | Array | The powerset of the (multi)set
|
26 |
|
27 |
|
28 | ## Examples
|
29 |
|
30 | ```js
|
31 | math.setPowerset([1, 2, 3]) // returns [[], [1], [2], [3], [1, 2], [1, 3], [2, 3], [1, 2, 3]]
|
32 | ```
|
33 |
|
34 |
|
35 | ## See also
|
36 |
|
37 | [setCartesian](setCartesian.md)
|