[英]Compute Gamma(x+1/2)/Gamma(x)
I need to compute Gamma(x+1/2)/Gamma(x) for reasonably large x. 我需要为相当大的x计算Gamma(x + 1/2)/ Gamma(x)。 If I just use http://docs.scipy.org/doc/scipy/reference/generated/scipy.special.gamma.html it fails as the denominator and numerator are huge. 如果我只使用http://docs.scipy.org/doc/scipy/reference/generation/scipy.special.gamma.html,则它会失败,因为分母和分子很大。 However the fraction itself is around sqrt(x). 但是,分数本身约为sqrt(x)。 How can I compute this fraction accurately? 如何准确计算这个分数?
you can use beta(a, b) = gamma(a) * gamma(b) / gamma(a+b)
您可以使用beta(a, b) = gamma(a) * gamma(b) / gamma(a+b)
from scipy.special import gamma, beta
x = 10
print gamma(x+0.5)/gamma(x)
print gamma(0.5)/beta(x, 0.5)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.