MCPcopy Index your code
hub / github.com/clips/pattern / gs

Function gs

pattern/metrics.py:835–844  ·  view source on GitHub ↗
(a, x, epsilon=3.e-7, iterations=700)

Source from the content-addressed store, hash-verified

833
834 # Series approximation to the incomplete gamma function.
835 def gs(a, x, epsilon=3.e-7, iterations=700):
836 ln = gammaln(a)
837 s = 1.0 / a
838 d = 1.0 / a
839 for i in range(1, iterations):
840 d = d * x / (a + i)
841 s = s + d
842 if abs(d) < abs(s) * epsilon:
843 return (s * exp(-x + a * log(x) - ln), ln)
844 raise StopIteration, (abs(d), abs(s) * epsilon)
845
846 # Continued fraction approximation of the incomplete gamma function.
847 def gf(a, x, epsilon=3.e-7, iterations=200):

Callers 1

gammaiFunction · 0.85

Calls 2

gammalnFunction · 0.85
absFunction · 0.50

Tested by

no test coverage detected