Next: Pochhammer Symbol, Previous: Gamma Functions, Up: Gamma and Beta Functions
Although factorials can be computed from the Gamma function, using the relation n! = \Gamma(n+1) for non-negative integer n, it is usually more efficient to call the functions in this section, particularly for small values of n, whose factorial values are maintained in hardcoded tables.
These routines compute the factorial n!. The factorial is related to the Gamma function by n! = \Gamma(n+1). The maximum value of n such that n! is not considered an overflow is given by the macro
GSL_SF_FACT_NMAX
and is 170.
These routines compute the double factorial n!! = n(n-2)(n-4) \dots. The maximum value of n such that n!! is not considered an overflow is given by the macro
GSL_SF_DOUBLEFACT_NMAX
and is 297.
These routines compute the logarithm of the factorial of n, \log(n!). The algorithm is faster than computing \ln(\Gamma(n+1)) via
gsl_sf_lngamma
for n < 170, but defers for larger n.
These routines compute the logarithm of the double factorial of n, \log(n!!).
These routines compute the combinatorial factor
n choose m
= n!/(m!(n-m)!)