def upper_incomplete_gamma(a,x,d=0,iterations=100):
if d == iterations:
if ((d % 2) == 1):
return 1.0 # end iterations
else:
m = d/2
return x + (m-a)
if d == 0:
result = ((x**a) * (e**(-x)))/upper_incomplete_gamma(a,x,d=d+1)
return result
elif ((d % 2) == 1):
m = 1.0+((d-1.0)/2.0)
return x+ ((m-a)/(upper_incomplete_gamma(a,x,d=d+1)))
else:
m = d/2
return 1+(m/(upper_incomplete_gamma(a,x,d=d+1)))
# 6.5.31 Handbook of Mathematical Functions, page 263
# Recursive implementation
评论列表
文章目录