Lanczos Approximation - Introduction

Introduction

The Lanczos approximation consists of the formula

for the Gamma function, with

Here g is a constant that may be chosen arbitrarily subject to the restriction that Re(z+g+1/2) > 0. The coefficients p, which depend on g, are slightly more difficult to calculate (see below). Although the formula as stated here is only valid for arguments in the right complex half-plane, it can be extended to the entire complex plane by the reflection formula,

The series A is convergent, and may be truncated to obtain an approximation with the desired precision. By choosing an appropriate g (typically a small integer), only some 5-10 terms of the series are needed to compute the Gamma function with typical single or double floating-point precision. If a fixed g is chosen, the coefficients can be calculated in advance and the sum is recast into the following form:

Thus computing the Gamma function becomes a matter of evaluating only a small number of elementary functions and multiplying by stored constants. The Lanczos approximation was popularized by Numerical Recipes, according to which computing the Gamma function becomes "not much more difficult than other built-in functions that we take for granted, such as sin x or ex". The method is also implemented in the GNU Scientific Library.

Read more about this topic:  Lanczos Approximation

Famous quotes containing the word introduction:

    For better or worse, stepparenting is self-conscious parenting. You’re damned if you do, and damned if you don’t.
    —Anonymous Parent. Making It as a Stepparent, by Claire Berman, introduction (1980, repr. 1986)

    Do you suppose I could buy back my introduction to you?
    S.J. Perelman, U.S. screenwriter, Arthur Sheekman, Will Johnstone, and Norman Z. McLeod. Groucho Marx, Monkey Business, a wisecrack made to his fellow stowaway Chico Marx (1931)

    We used chamber-pots a good deal.... My mother ... loved to repeat: “When did the queen reign over China?” This whimsical and harmless scatological pun was my first introduction to the wonderful world of verbal transformations, and also a first perception that a joke need not be funny to give pleasure.
    Angela Carter (1940–1992)