UNPKG

mathjs

Version:

Math.js is an extensive math library for JavaScript and Node.js. It features a flexible expression parser and offers an integrated solution to work with numbers, big numbers, complex numbers, units, and matrices.

44 lines (26 loc) 837 B
# Function combinations Compute the number of ways of picking `k` unordered outcomes from `n` possibilities. Combinations only takes integer arguments. The following condition must be enforced: k <= n. ## Syntax ```js math.combinations(n, k) ``` ### Parameters Parameter | Type | Description --------- | ---- | ----------- `n` | Number &#124; BigNumber | Total number of objects in the set `k` | Number &#124; BigNumber | Number of objects in the subset ### Returns Type | Description ---- | ----------- Number &#124; BigNumber | Number of possible combinations. ## Examples ```js math.combinations(7, 5); // returns 21 ``` ## See also [permutations](permutations.md), [factorial](factorial.md) <!-- Note: This file is automatically generated from source code comments. Changes made in this file will be overridden. -->