1
$\begingroup$

I must compute value of 1-regularized incomplete gamma function (upper) $Q(a,z)$.

But unfortunatelly this computing exceeding the precision of the processor (for example I gain 0, but I should have 0.000000000000001).

To resolve this problem I want to use logarithm of $(1 - Q(a,z))$.

How I can compute this $\log(1 - Q(a,z))$ formula using series expansion. Is there any formula for this expansion?

Thanks a lot for help

$\endgroup$
1
$\begingroup$

I guess you are working in the range $z>1, z>a,\;$ otherwise $Q(a,z)$ would not be so small. Here you can use the continued fraction http://dlmf.nist.gov/8.9.E2 without the detour of computing $\ln(1-Q)$ $$ Q(a,z) = \frac{\Gamma(a,z)}{\Gamma(a)} = \frac{e^{-z}z^{a}}{{\Gamma(a)}} \left( \frac{1}{z+} \; \frac{1-a}{1+} \; \frac{1}{z+} \; \frac{2-a}{1+} \; \frac{2}{z+} \cdots \right) $$ With this you get e.g. $Q(1.25, 100)$ with full accuracy for IEEE double using five terms $$Q(1.25, 100) = 1.3010893525585465\times10^{-43}$$ If you want to implement you own function, you may have a look at an old paper of Nico Temme: A Set of Algorithms for the Incomplete Gamma Functions, Probability in the Engineering and Informational Sciences, 8 (1994), pp. 291-307; available as http://oai.cwi.nl/oai/asset/10080/10080A.pdf

$\endgroup$
  • $\begingroup$ Thanks it's works :) Can I use this fraction to z < a too? $\endgroup$ – kolek Nov 29 '14 at 12:12
  • 1
    $\begingroup$ Sorry for the late answer: Theoretically yes, but a series may converge faster than the continued fraction in this range. And for certain combinations of $a,z$ it is better to use the $P(a,z)$ function. The Temme paper recommends (roughly, without asymptotic expansion): If $a > z+0.25$ then use the Taylor series for $P(a,z)$, else if $z < 1$ then Taylor series for $Q(a,z)$, else the continued fraction. $\endgroup$ – gammatester Dec 1 '14 at 7:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.