python math.gamma()
时间: 2024-05-02 13:17:48 浏览: 176
求gamma函数的值
5星 · 资源好评率100%
The `math.gamma()` function in Python is used to compute the gamma function of a given number. The gamma function is a generalization of the factorial function, defined for all complex numbers except negative integers.
Syntax: `math.gamma(x)`
Parameters:
- `x`: A number whose gamma value needs to be computed.
Return Value: The gamma value of the given number.
Example:
```
import math
# Compute the gamma value of 5
gamma_val = math.gamma(5)
print("Gamma value of 5:", gamma_val)
```
Output:
```
Gamma value of 5: 24.0
```
阅读全文