UNPKG

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

46 lines (29 loc) 939 B
<!-- Note: This file is automatically generated from source code comments. Changes made in this file will be overridden. --> # Function permutations Compute the number of ways of obtaining an ordered subset of `k` elements from a set of `n` elements. Permutations only takes integer arguments. The following condition must be enforced: k <= n. ## Syntax ```js math.permutations(n) math.permutations(n, k) ``` ### Parameters Parameter | Type | Description --------- | ---- | ----------- `n` | number &#124; BigNumber | The number of objects in total `k` | number &#124; BigNumber | The number of objects in the subset ### Returns Type | Description ---- | ----------- number &#124; BigNumber | The number of permutations ## Examples ```js math.permutations(5) // 120 math.permutations(5, 3) // 60 ``` ## See also [combinations](combinations.md), [combinationsWithRep](combinationsWithRep.md), [factorial](factorial.md)