simple-squiggle

A restricted subset of Squiggle
Log | Files | Refs | README

permutations.md (991B)


      1 <!-- Note: This file is automatically generated from source code comments. Changes made in this file will be overridden. -->
      2 
      3 # Function permutations
      4 
      5 Compute the number of ways of obtaining an ordered subset of `k` elements
      6 from a set of `n` elements.
      7 
      8 Permutations only takes integer arguments.
      9 The following condition must be enforced: k <= n.
     10 
     11 
     12 ## Syntax
     13 
     14 ```js
     15 math.permutations(n)
     16 math.permutations(n, k)
     17 ```
     18 
     19 ### Parameters
     20 
     21 Parameter | Type | Description
     22 --------- | ---- | -----------
     23 `n` | number &#124; BigNumber | The number of objects in total
     24 `k` | number &#124; BigNumber | The number of objects in the subset
     25 
     26 ### Returns
     27 
     28 Type | Description
     29 ---- | -----------
     30 number &#124; BigNumber | The number of permutations
     31 
     32 
     33 ### Throws
     34 
     35 Type | Description
     36 ---- | -----------
     37 
     38 
     39 ## Examples
     40 
     41 ```js
     42 math.permutations(5)     // 120
     43 math.permutations(5, 3)  // 60
     44 ```
     45 
     46 
     47 ## See also
     48 
     49 [combinations](combinations.md),
     50 [combinationsWithRep](combinationsWithRep.md),
     51 [factorial](factorial.md)