mirror of
https://github.com/josdejong/mathjs.git
synced 2026-01-18 14:59:29 +00:00
44 lines
923 B
Markdown
44 lines
923 B
Markdown
<!-- Note: This file is automatically generated from source code comments. Changes made in this file will be overridden. -->
|
|
|
|
# Function gamma
|
|
|
|
Compute the gamma function of a value using Lanczos approximation for
|
|
small values, and an extended Stirling approximation for large values.
|
|
|
|
For matrices, the function is evaluated element wise.
|
|
|
|
|
|
## Syntax
|
|
|
|
```js
|
|
math.gamma(n)
|
|
```
|
|
|
|
### Parameters
|
|
|
|
Parameter | Type | Description
|
|
--------- | ---- | -----------
|
|
`n` | number | Array | Matrix | A real or complex number
|
|
|
|
### Returns
|
|
|
|
Type | Description
|
|
---- | -----------
|
|
number | Array | Matrix | The gamma of `n`
|
|
|
|
|
|
## Examples
|
|
|
|
```js
|
|
math.gamma(5); // returns 24
|
|
math.gamma(-0.5); // returns -3.5449077018110335
|
|
math.gamma(math.i); // returns -0.15494982830180973 - 0.49801566811835596i
|
|
```
|
|
|
|
|
|
## See also
|
|
|
|
[combinations](combinations.md),
|
|
[factorial](factorial.md),
|
|
[permutations](permutations.md)
|