-
-
Notifications
You must be signed in to change notification settings - Fork 748
Description
The regularized lower incomplete gamma function P(s,x) is defined as πΎ(s,x)/π€(s) where x β β and s β β with re(s) > 0. πΎ is the lower incomplete gamma function, and π€ is the gamma function.
According to its documentation, std.mathspecial.gammaIncomplete(s, x) implements P(s,x) where s and x have been restricted to ββΊ. However, it supports x = 0 and x = β, where gammaIncomplete(s, real.infinity) evaluates to limxββ P(s,x) = 1 for finite s. For the shape parameter s, its support for s = 0 and s = β is inconsistent. When s is one of these values, for some values of x, gammaIncomplete(s, x) evaluates to NaN, and for others, it evaluates to a number.
P(s,x) = gammaIncomplete(s, x)
P(0βΊ,0) = 0
P(0βΊ,.1) = -nan
P(0βΊ,1) = -nan
P(0βΊ,10) = 1
P(0βΊ,β) = 1
P(β,0) = 0
P(β,.1) = 0
P(β,1) = -nan
P(β,10) = -nan
P(β,β) = -nan
Since s must be positive according to the definition of P, P(0,x) is undefined. However, as long as x > 0, limsβ0βΊ P(s,x) = 1. When x = 0, limsβ0βΊ P(s,0) = 0. Also, limsββ P(s,x) = 0, when x is non-negative and finite. lims,xββ P(s,x) does not exist, but limsββ limxββ P(s,x) = 1. To support using P as the gamma distribution CDF F(x; πΌ,π) β P(πΌ,πx) which requires that F(β; πΌ,π) = 1, P(β,β) is often defined as limsββ limxββ P(s,x).
This issue proposes three changes to gammaIncomplete.
- It is modified so that
gammaIncomplete(+0., x)evaluates to0whenx == 0and1whenx > 0. - It is modified so that
gammaIncomplete(real.infinity, x)evaluates to0, whenx < real.infinityand1whenx is real.infinity. - Its documentation is updated to reflect its existing support for x = 0.