We Introduce an Algorithm for the Evaluation of the Incomplete Gamma Function, P (M, X), for All M, X > 0
We introduce an algorithm for the evaluation of the Incomplete Gamma Function, P (m, x), for all m, x > 0. For small m, a classical recursive scheme is used to evaluate P (m, x), whereas a newly derived asymptotic expansion is used to evaluate P (m, x) in the large m regime. The number of operations required for evaluation is O(1) for all x and m. Nearly full double and extended precision accuracies are achieved in their respective environments. The performance of the scheme is illustrated via several numerical examples.
An Algorithm for the Evaluation of the Incomplete Gamma Function
P. Greengard‡ , V. Rokhlin‡ , Technical Report YALEU/DCS/TR-1534 June 20, 2017
This author’s work was supported in part under ONR N00014-14-1-0797, AFOSR FA9550- 16-0175, NIH 1R01HG008383 This author’s work was supported in part under ONR N00014-14-1-0797, NSF DMS- 1300120
‡ Dept. of Mathematics, Yale University, New Haven CT 06511 Approved for public release: distribution is unlimited. Keywords: Incomplete Gamma Function, Special Functions, Numerical Evaluation An Algorithm for the Evaluation of the Incomplete Gamma Function
Philip Greengard, Vladimir Rokhlin
June 20, 2017
Contents
1 Introduction 3
2 Preliminaries 3 2.1 Mathematical Apparatus ...... 5 2.2 P (m, x) for Small x ...... 10 2.3 P (m, x) for large x ...... 10
3 Evaluation of P (m, x) by Summation 13
4 Evaluation of P (m, x) by Asymptotic Expansion 14
5 Description of Algorithm 18 5.1 m ≤ 10, 000...... 18 5.2 m > 10, 000...... 19 5.2.1 Precomputing ...... 19 5.2.2 Evaluation ...... 20
6 Numerical Experiments 20
2 1 Introduction
Properties and evaluation of special functions is one of the most developed areas of nu- merical analysis. For some (such as Bessel functions), the theory has been fairly complete for many decades; others (such as Prolate Spheroidal Wave Functions) are still an active area of research. In this respect, the Incomplete Gamma Function occupies an intermediate position. Its mathematical properies appear to be well understood, but the relevant numer- ical techniques leave much to be desired, at least in certain regimes. The purpose of this paper is to introduce a numerical scheme (or rather a class of numerical schemes) for the evaluation of the Incomplete Gamma Functions that produces (more or less) full double pre- cisoion accuracy whenever the calculations are performed in double precision, is sufficiently fast to be compatible with standard schemes for the evaluation of other special functions, and produces roughly extended precision accuracy when implemented in extended precision (though in this regime, the algorithm loses much of its efficiency). The algorithm is based on the combination of an identity concerning the Incomplete Gamma Function (see [1] for- mula 6.5.22), with an asymptotic expansion that appears to be new (see [4], [5], [2], [7] , [8] below); its performance is illustrated with several numerical examples, in both double and extended precision (see Section 6). The structure of this paper is as follows. In Section 2, we introduce notation and sum- marize a number of elementary mathematical results to be used throughout the remainder of the paper. Section 3 describes a technique for the evaluation of P (m, x) via direct sum- mation. Section 4 describes an asymptotic expansion for the evaluation of P (m, x). Section 5 contains a description of an algorithm to evaluate P (m, x) for all m, x > 0. Section 6 contains the results of numerical experiments with the algorithm for P (m, x) described in Section 5.
2 Preliminaries
In accordance with standard practice, we will be denoting by γ(m, x) the Incomplete Gamma Function, Z x γ(m + 1, x) = tme−tdt. (1) 0 We will be denoting by γ(m, x) a scaled version of the Incomplete Gamma Function,
Z x tme−t γ(m + 1, x) = m −m dt 0 m e Z x−m (2) = eφ(s)ds −m where (m + s)me−(m+s) eφ(s) = . (3) mme−m We will be denoting by P (m, x) (see [1]), the Incomplete Gamma Function scaled by the Complete Gamma Function. That is,
γ(m, x) (m − 1)(m−1)e−(m−1) P (m, x) = = γ(m, x). (4) Γ(m) Γ(m)
3 We define fm to be the function on C defined by the formula,