mathjs
Version:
Math.js is an extensive math library for JavaScript and Node.js. It features a flexible expression parser with support for symbolic computation, comes with a large set of built-in functions and constants, and offers an integrated solution to work with dif
38 lines (22 loc) • 771 B
Markdown
<!-- Note: This file is automatically generated from source code comments. Changes made in this file will be overridden. -->
# Function setPowerset
Create the powerset of a (multi)set. (The powerset contains very possible subsets of a (multi)set.)
A multi-dimension array will be converted to a single-dimension array before the operation.
## Syntax
```js
math.setPowerset(set)
```
### Parameters
Parameter | Type | Description
--------- | ---- | -----------
`a` | Array | Matrix | A (multi)set
### Returns
Type | Description
---- | -----------
Array | The powerset of the (multi)set
## Examples
```js
math.setPowerset([1, 2, 3]) // returns [[], [1], [2], [3], [1, 2], [1, 3], [2, 3], [1, 2, 3]]
```
## See also
[setCartesian](setCartesian.md)