Next: More about Fortran Up: The Goodness of Fit Previous: The Goodness of Fit

### More Mathematical Background

The Goodness of Fit is evaluated by calculating

 (2.12)

where

 (2.13)

and
 = (2.14) = (2.15) = (2.16)

is Euler gamma  function. as well as are called incomplete gamma function . Whenever you hear about the latter, you ought to ask, which incomplete gamma function, because there are two. Sometimes people call one the left incomplete, and the other one the right incomplete. It is left to you as an exercise to figure out which is which. If in doubt, ask for a formula.

Neither complete nor incomplete gamma functions are a part of ANSI Fortran specification, although the complete gamma function is often provided with language libraries. For example, in UNIX Euler gamma function is described in section 3 of the manual, and can be loaded from in libm.a.

There exists a series expansion for and a continued fraction expansion for . The former converges rapidly for x < a+1, and the latter converges rapidly for x>a+1. Consequently when writing a subroutine to calculate Q(a, x), we should check the regime we are in, and use an expansion that converges fastest in that regime:

 (2.17)

The expansions are as follows:

 = (2.18) = (2.19)

Continued fraction expansions are so hard to read (and typeset) that printers invented a special simplified notation for them, which helps programmers too, and so, the above expansion in that notation would look as follows:

 (2.20)

Next: More about Fortran Up: The Goodness of Fit Previous: The Goodness of Fit
Zdzislaw Meglicki
2001-02-26