igamma
-- the incomplete Gamma
functionigamma
(a, x)
represents the incomplete
Gamma function int(exp(-t)*t^(a-1), t=x..infinity).
igamma(a, x)
a, x |
- | arithmetical expressions |
an arithmetical expression.
a
, x
When called with a floating point argument, the function is
sensitive to the environment variable DIGITS
which determines the numerical
working precision.
Ei
, erfc
, exp
, fact
, gamma
, int
igamma
and/or other special functions may be
returned.igamma
is returned.For real numerical values of a ofigamma(a, 0)
-->gamma(a)
,igamma(0, x)
-->Ei(x)
,igamma(1/2, x)
-->sqrt(PI)*erfc(sqrt(x))
,igamma(1, x)
-->exp(-x)
.
Type::Real
the functional relation
igamma(a, x) = x^(a - 1)*exp(-x) + (a - 1)*igamma(a - 1, x)
is used recursively to shift the first argument to the interval
0<= a <= 1. Thus rewriting in terms of Ei
, erfc
, and exp
occurs if
a is an integer multiple of 1/2. Cf.
example 1.igamma(a,infinity)=0
is
implemented.The floating point evaluation is fast and numerically stable, if both arguments are real and positive. All other floating point evaluations may be subject to numerical cancellation! Cf. example 3.
We demonstrate some calls with exact and symbolic input data:
>> igamma(2, 3), igamma(1/7, x), igamma(sqrt(2), 3)
1/2 4 exp(-3), igamma(1/7, x), igamma(2 , 3)
>> igamma(a, 4), igamma(1 + I, x^2 + 1), igamma(a, infinity)
2 igamma(a, 4), igamma(1 + I, x + 1), 0
If the first argument a is a real numerical
value, then the functional relations are used recursively until
igamma
is called with a first argument from the the
interval 0<= a <= 1:
>> igamma(-1/10, 1), igamma(7/4, 1)
3 igamma(3/4, 1) 10 exp(-1) - 10 igamma(9/10, 1), exp(-1) + ---------------- 4
If the first argument is an integer multiple of
1/2, then complete rewriting in terms of Ei
, erfc
, and exp
occurs:
>> igamma(-3, x), igamma(-5/2, x), igamma(8, x), igamma(13/2, 4)
/ 1 1 2 \ exp(-x) | -- - - - -- | | 2 x 3 | Ei(x) \ x x / - ----- - -----------------------, 6 6 1/2 1/2 8 exp(-x) 4 exp(-x) 2 exp(-x) 8 PI erfc(x ) --------- - --------- + --------- - ------------------, 1/2 3/2 5/2 15 15 x 15 x 5 x / 2 3 4 5 6 7 \ | x x x x x x | 5040 exp(-x) | x + -- + -- + -- + --- + --- + ---- + 1 |, \ 2 6 24 120 720 5040 / 1/2 210979 exp(-4) 10395 PI erfc(2) -------------- + ------------------- 16 64
Floating point values are computed for floating point arguments:
>> igamma(0.1, 4.0), igamma(7, 0.5), igamma(100, 100.0)
0.004420083058, 719.9992783, 4.542198121e155
Fast and numerically stable floating point evaluation is available for all real positive a and x:
>> igamma(1.0, 4.0), igamma(7.0, 10.2), igamma(12.3, 34.5)
0.01831563889, 84.97892788, 361.781135
If a is not real, then no floating point evaluation is available:
>> igamma(1.0*I, 4.0), igamma(7.0 - 3.2*I, 10.2)
igamma(1.0 I, 4.0), igamma(7.0 - 3.2 I, 10.2)
If a is not an integer multiple of 1/2, then no floating point evaluation is available if x is not real and positive:
>> igamma(0.1, -4.0), igamma(3/4, 12.3 + 3.45*I)
igamma(0.1, -4.0), igamma(3/4, 12.3 + 3.45 I)
If a is an integer multiple of 1/2, then floating point evaluation is available for any complex x:
>> igamma(-3/2, -4.0), igamma(12, 12.3 + 3.45*I)
2.363271801 - 2.925061502 I, 13266196.93 - 17206446.91 I
The functional relation between igamma
with
different first arguments is used to ``normalize'' the returned
expressions:
>> igamma(-8, x), igamma(7/3, x)
/ 1 1 2 6 24 120 720 5040 \ exp(-x) | -- - - - -- + -- - -- + --- - --- + ---- | | 2 x 3 4 5 6 7 8 | Ei(x) \ x x x x x x x / ----- + ----------------------------------------------------, 40320 40320 1/3 4 igamma(1/3, x) 4 x exp(-x) 4/3 ---------------- + -------------- + x exp(-x) 9 3
Note that such expansions are also used in floating point evaluations if a and x are not real and positive. However, this representation may be numerically unstable if abs(a) is large:
>> DIGITS := 10: igamma(-100, 100.0)
8.139678825e-223
>> DIGITS := 20: igamma(-100, 100.0)
1.8951666599463620044e-232
>> delete DIGITS:
Type::Real
. The special value
igamma(a,infinity)=0
was implemented.