mirror of
https://github.com/josdejong/mathjs.git
synced 2026-01-18 14:59:29 +00:00
41 lines
888 B
Markdown
41 lines
888 B
Markdown
# Function composition
|
|
|
|
Calculate the number of ways to split `n` into `k` nonempty parts.
|
|
|
|
## Syntax
|
|
|
|
```js
|
|
math.composition(n, k)
|
|
```
|
|
|
|
### Parameters
|
|
|
|
Parameter | Type | Description
|
|
--------- | ---- | -----------
|
|
`n` | Number | BigNumber | Total number of objects
|
|
`k` | Number | BigNumber | Number of objects in the subset
|
|
|
|
### Returns
|
|
|
|
Type | Description
|
|
---- | -----------
|
|
Number | BigNumber | The number of ways to split a set of n elements into k nonempty sets.
|
|
|
|
|
|
## Examples
|
|
|
|
```js
|
|
math.composition(8, 3); // returns Number 21
|
|
math.composition(math.bignumber(70), math.bignumber(3)); // returns Number 2346
|
|
```
|
|
|
|
|
|
## See also
|
|
|
|
[combinations.js](combinations.md),
|
|
[stirlingS2.js](stirlingS2.md),
|
|
[bellNumbers.js](bellNumbers.md)
|
|
|
|
|
|
<!-- Note: This file is automatically generated from source code comments. Changes made in this file will be overridden. -->
|