Calculate the Gamma function
Calculate the CEPHES function, Gamma, in the range [-171 <
z <= 171.6]. The command returns the Gamma function of
the argument (scalar or array).
Arguments |x| <= 34 are reduced by recurrence and the
function approximated by a rational function of degree 6/7 in
the interval (2,3). Large arguments are handled by Stirling's
formula. Large negative arguments are made positive using a
reflection formula.
Relative error:
| DEC |
-34, 34 |
10000 |
1.3e-16 |
2.5e-17 |
| IEEE |
-170,-33 |
20000 |
2.3e-15 |
3.3e-16 |
| IEEE |
-33, 33 |
20000 |
9.4e-16 |
2.2e-16 |
| IEEE |
33, 171.6 |
20000 |
2.3e-15 |
3.2e-16 |
Error for arguments outside the test range will be larger
owing to error amplification by the exponential function.
Cephes Math Library Release 2.0: April, 1987.
Copyright 1985, 1987 by Stephen L. Moshier.
Direct inquiries to 30 Frost Street, Cambridge, MA 02140.
Calculate the gamma of z=3.14 .
sherpa> gamma([3.14,2.71]);
Calculate the gamma of z=[3.14,2.71] .
|