热线电话:13121318867

登录
2019-03-01 阅读量: 559
gamma函数具体怎么用

Python语言允许各种数学运算,在科学领域具有多种应用。下面要介绍的是python的一个内置函数:gamma()函数,它以数字方式计算函数中传递的数字的gamma值。

语法: math.gamma(x)
参数:
x: 需要计算其伽玛值的数字。
返回:伽马值,在数值上等于“factorial(x-1)”。

示例代码#:

# Python code to demonstrate

# working of gamma()

import math

# initializing argument

gamma_var = 6

# Printing the gamma value.

print ("The gamma value of the given argument is : "

+ str(math.gamma(gamma_var)))

输出:

The gamma value of the given argument is : 120.0
0.0000
2
关注作者
收藏
评论(0)

发表评论

暂无数据
推荐帖子