# Log of 1-reguralized incomplete gamma function (upper)

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

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
• 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. – gammatester Dec 1 '14 at 7:58