Python/ref math gamma
来自菜鸟教程
<languages />
Python math.gamma()方法
例
查找不同数字的伽玛函数:
# Import math Library
import math
# Return the gamma function for
different numbers
print(math.gamma(-0.1))
print(math.gamma(8))
print(math.gamma(1.2))
print(math.gamma(80))
print(math.gamma(-0.55))
定义和用法
The
math.gamma()
方法以数字形式返回伽玛函数。
Tip:
要查找数字的对数伽马值,请使用
math.lgamma()
方法。
句法
math.gamma(x)
参数值
| 参数 | 描述 |
|---|---|
| x | 需要。查找伽玛函数的数字。如果数字是负整数,则返回ValueError。如果不是数字,则返回TypeError。 |
技术细节
| 返回值: | A
|
| Python版本: | 3.2 |