naginterfaces.library.specfun.gamma_log_real¶
- naginterfaces.library.specfun.gamma_log_real(x)[source]¶
gamma_log_real
returns the value of the logarithm of the gamma function, .For full information please refer to the NAG Library document for s14ab
https://support.nag.com/numeric/nl/nagdoc_30.3/flhtml/s/s14abf.html
- Parameters
- xfloat
The argument of the function.
- Returns
- lgxfloat
The value of .
- Raises
- NagValueError
- (errno )
On entry, .
Constraint: .
- Warns
- NagAlgorithmicWarning
- (errno )
On entry, and the constant .
Constraint: .
- Notes
gamma_log_real
calculates an approximate value for . It is based on rational Chebyshev expansions.Denote by a ratio of polynomials of degree in the numerator and in the denominator. Then:
for ,
for ,
for ,
for ,
and for ,
For each expansion, the specific values of and are selected to be minimal such that the maximum relative error in the expansion is of the order , where is the maximum number of decimal digits that can be accurately represented for the particular implementation (see
machine.decimal_digits
).Let denote machine precision and let denote the largest positive model number (see
machine.real_largest
). For the value is not defined;gamma_log_real
returns zero and exits with = 1. It also exits with = 1 when , and in this case the value is returned. For in the interval , the function to machine accuracy.Now denote by the largest allowable argument for on the machine. For the term in Equation (1) is negligible. For there is a danger of setting overflow, and so
gamma_log_real
exits with = 2 and returns .
- References
NIST Digital Library of Mathematical Functions
Cody, W J and Hillstrom, K E, 1967, Chebyshev approximations for the natural logarithm of the gamma function, Math.Comp. (21), 198–203