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-combinationswithrep">Function combinationsWithRep <a href="#function-combinationswithrep" title="Permalink">#</a></h1>
|
|
|
|
Compute the number of ways of picking `k` unordered outcomes from `n`
|
|
possibilities, allowing individual outcomes to be repeated more than once.
|
|
|
|
CombinationsWithRep only takes integer arguments.
|
|
The following condition must be enforced: k <= n + k -1.
|
|
|
|
|
|
<h2 id="syntax">Syntax <a href="#syntax" title="Permalink">#</a></h2>
|
|
|
|
```js
|
|
math.combinationsWithRep(n, k)
|
|
```
|
|
|
|
<h3 id="parameters">Parameters <a href="#parameters" title="Permalink">#</a></h3>
|
|
|
|
Parameter | Type | Description
|
|
--------- | ---- | -----------
|
|
`n` | number | BigNumber | Total number of objects in the set
|
|
`k` | number | BigNumber | Number of objects in the subset
|
|
|
|
<h3 id="returns">Returns <a href="#returns" title="Permalink">#</a></h3>
|
|
|
|
Type | Description
|
|
---- | -----------
|
|
number | BigNumber | Number of possible combinations with replacement.
|
|
|
|
|
|
<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.combinationsWithRep(7, 5) // returns 462
|
|
```
|
|
|
|
|
|
<h2 id="see-also">See also <a href="#see-also" title="Permalink">#</a></h2>
|
|
|
|
[combinations](combinations.html),
|
|
[permutations](permutations.html),
|
|
[factorial](factorial.html)
|