Chandra X-Ray Observatory
	(CXC)
Skip to the navigation links
Last modified: December 2013

URL: http://cxc.harvard.edu/sherpa/ahelp/gamma.html
Jump to: Description · Examples · Bugs · See Also


AHELP for CIAO 4.6 Sherpa v2

gamma

Context: utilities

Synopsis

Calculate the Gamma function

Syntax

gamma(z)

Description

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:

arithmetic domain # trials peak rms
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.

Reference

Cephes Math Library Release 2.0: April, 1987. Copyright 1985, 1987 by Stephen L. Moshier. Direct inquiries to 30 Frost Street, Cambridge, MA 02140.

Example 1

sherpa> gamma(3.14)

Calculate the gamma of z=3.14 .

Example 2

sherpa> gamma([3.14,2.71])

Calculate the gamma of z=[3.14,2.71] .

Bugs

See the bugs pages on the Sherpa website for an up-to-date listing of known bugs.

See Also

tools
aprates, modelflux
utilities
calc_chisqr, calc_energy_flux, calc_model_sum, calc_photon_flux, calc_source_sum, calc_stat, igam, igamc, incbet, lgam

Last modified: December 2013
Smithsonian Institute Smithsonian Institute

The Chandra X-Ray Center (CXC) is operated for NASA by the Smithsonian Astrophysical Observatory. 60 Garden Street, Cambridge, MA 02138 USA.   Email:   cxcweb@head.cfa.harvard.edu Smithsonian Institution, Copyright © 1998-2014. All rights reserved.