Jul*_*lie 8 python floating-point factorial
我想知道是否有一种快速的Pythonic方法来计算非整数的阶乘(例如,3.4)?当然,模块中的bult-in factorial()功能Math是可用的,但它只适用于积分(我不关心负数).
factorial()
Math
Kri*_*per 14
你想用math.gamma(x).
math.gamma(x)
该伽玛函数是阶乘函数实数的扩展.
请注意,与阶乘函数相比,函数移位1.所以math.factorial(n)是math.gamma(n + 1).
math.factorial(n)
math.gamma(n + 1)
归档时间:
13 年,8 月 前
查看次数:
4446 次
最近记录:
8 年,2 月 前