gamma.md (972B)
1 <!-- Note: This file is automatically generated from source code comments. Changes made in this file will be overridden. --> 2 3 # Function gamma 4 5 Compute the gamma function of a value using Lanczos approximation for 6 small values, and an extended Stirling approximation for large values. 7 8 For matrices, the function is evaluated element wise. 9 10 11 ## Syntax 12 13 ```js 14 math.gamma(n) 15 ``` 16 17 ### Parameters 18 19 Parameter | Type | Description 20 --------- | ---- | ----------- 21 `n` | number | Array | Matrix | A real or complex number 22 23 ### Returns 24 25 Type | Description 26 ---- | ----------- 27 number | Array | Matrix | The gamma of `n` 28 29 30 ### Throws 31 32 Type | Description 33 ---- | ----------- 34 35 36 ## Examples 37 38 ```js 39 math.gamma(5) // returns 24 40 math.gamma(-0.5) // returns -3.5449077018110335 41 math.gamma(math.i) // returns -0.15494982830180973 - 0.49801566811835596i 42 ``` 43 44 45 ## See also 46 47 [combinations](combinations.md), 48 [factorial](factorial.md), 49 [permutations](permutations.md)