2004-11-03 13:51:07 +00:00
|
|
|
.\" Copyright 2002 Walter Harms (walter.harms@informatik.uni-oldenburg.de)
|
|
|
|
.\" Distributed under GPL
|
|
|
|
.\" Based on glibc infopages
|
2004-11-15 08:24:41 +00:00
|
|
|
.\" Modified 2004-11-15, fixed error noted by Fabian Kreutz
|
|
|
|
.\" <kreutz@dbs.uni-hannover.de>
|
|
|
|
.TH TGAMMA 3 2004-11-15 "GNU" "libc math functions"
|
2004-11-03 13:51:07 +00:00
|
|
|
.SH NAME
|
|
|
|
tgamma, tgammaf, tgammal \- true gamma function
|
|
|
|
.SH SYNOPSIS
|
|
|
|
.B #include <math.h>
|
|
|
|
.sp
|
|
|
|
.BI "double tgamma(double " x );
|
|
|
|
.br
|
|
|
|
.BI "float tgammaf(float " x );
|
|
|
|
.br
|
|
|
|
.BI "long double tgammal(long double " x );
|
|
|
|
.sp
|
2005-07-06 07:41:37 +00:00
|
|
|
Compile with \-std=c99; link with \-lm.
|
2004-11-03 13:51:07 +00:00
|
|
|
.SH DESCRIPTION
|
|
|
|
The Gamma function is defined by
|
|
|
|
.sp
|
2005-07-07 08:27:03 +00:00
|
|
|
Gamma(x) = integral from 0 to infinity of t^(x\-1) e^\-t dt
|
2004-11-03 13:51:07 +00:00
|
|
|
.sp
|
2006-06-03 01:26:30 +00:00
|
|
|
It is defined for every real number except for non-positive integers.
|
2007-04-24 19:11:01 +00:00
|
|
|
For non-negative integral \fIm\fP one has
|
2004-11-03 13:51:07 +00:00
|
|
|
.sp
|
|
|
|
Gamma(m+1) = m!
|
|
|
|
.sp
|
|
|
|
and, more generally, for all \fIx\fP:
|
|
|
|
.sp
|
|
|
|
Gamma(x+1) = x * Gamma(x)
|
|
|
|
.sp
|
2004-11-15 08:24:41 +00:00
|
|
|
Furthermore, the following is valid for all values of \fIx\fP
|
|
|
|
outside the poles:
|
2004-11-03 13:51:07 +00:00
|
|
|
.sp
|
2005-07-07 08:27:03 +00:00
|
|
|
Gamma(x) * Gamma(1\-x) = PI/sin(PI*x)
|
2004-11-03 13:51:07 +00:00
|
|
|
.PP
|
|
|
|
This function returns the value of the Gamma function for the
|
2007-04-12 22:42:49 +00:00
|
|
|
argument \fIx\fP.
|
|
|
|
It had to be called "true gamma function"
|
2004-11-03 13:51:07 +00:00
|
|
|
since there is already a function
|
2005-11-02 11:34:24 +00:00
|
|
|
.BR gamma ()
|
2004-11-03 13:51:07 +00:00
|
|
|
that returns something else.
|
|
|
|
.SH ERRORS
|
|
|
|
In order to check for errors, set
|
|
|
|
.I errno
|
|
|
|
to zero and call
|
|
|
|
.I feclearexcept(FE_ALL_EXCEPT)
|
2007-04-12 22:42:49 +00:00
|
|
|
before calling these functions.
|
|
|
|
On return, if
|
2004-11-03 13:51:07 +00:00
|
|
|
.I errno
|
|
|
|
is non-zero or
|
|
|
|
.I fetestexcept(FE_INVALID | FE_DIVBYZERO | FE_OVERFLOW | FE_UNDERFLOW)
|
|
|
|
is non-zero, an error has occurred.
|
|
|
|
.LP
|
|
|
|
A range error occurs if x is too large.
|
|
|
|
A pole error occurs if x is zero.
|
|
|
|
A domain error (or a pole error) occurs if x is a negative integer.
|
|
|
|
.SH "CONFORMING TO"
|
|
|
|
C99.
|
|
|
|
.SH "SEE ALSO"
|
|
|
|
.BR gamma (3),
|
|
|
|
.BR lgamma (3)
|