Python| sympy.gamma() 方法
借助sympy.gamma()方法,我们可以在 SymPy 中找到 gamma函数。 gamma(z) 表示其中对于正整数 z 与 .
Syntax: gamma(Z)
Parameters:
Z – It is the input value to the gamma function.
Returns: Returns the gamma function result of the input value.
示例 #1:
# import sympy
from sympy import *
Z = 5
print("Z = {}".format(Z))
# Use sympy.gamma() method
gamma_Z = gamma(Z)
print("gamma(Z) : {}".format(gamma_Z))
输出:
Z = 5
gamma(Z) : 24
示例 #2:
# import sympy
from sympy import *
X = symbols('x')
print("X = {}".format(X))
# Use sympy.gamma() method
gamma_X = gamma(X)
print("gamma(X) : {}".format(gamma_X))
输出:
X = x
gamma(X) : gamma(x)