1\name{Gamma}
2\alias{Gamma}
3\alias{gamma}
4\alias{gsl_sf_gamma}
5\alias{lngamma}
6\alias{lngamma_sgn}
7\alias{gammastar}
8\alias{gammainv}
9\alias{lngamma_complex}
10\alias{taylorcoeff}
11\alias{fact}
12\alias{doublefact}
13\alias{lnfact}
14\alias{lndoublefact}
15\alias{gsl_sf_choose}
16\alias{lnchoose}
17\alias{poch}
18\alias{lnpoch}
19\alias{lnpoch_sgn}
20\alias{pochrel}
21\alias{gamma_inc_Q}
22\alias{gamma_inc_P}
23\alias{gamma_inc}
24\alias{gsl_sf_beta}
25\alias{lnbeta}
26\alias{beta_inc}
27\title{gamma functions}
28\description{
29 Gamma functions as per the Gnu Scientific Library reference manual
30 section 7.19.  These functions are declared in header file
31 \code{gsl_sf_gamma.h}
32}
33\usage{
34gsl_sf_gamma(x,give=FALSE,strict=TRUE)
35lngamma(x,give=FALSE,strict=TRUE)
36lngamma_sgn(x,give=FALSE,strict=TRUE)
37gammastar(x,give=FALSE,strict=TRUE)
38gammainv(x,give=FALSE,strict=TRUE)
39lngamma_complex(zr, zi=NULL, r.and.i=TRUE, give=FALSE, strict=TRUE)
40taylorcoeff(n,x,give=FALSE,strict=TRUE)
41fact(n,give=FALSE,strict=TRUE)
42doublefact(n,give=FALSE,strict=TRUE)
43lnfact(n,give=FALSE,strict=TRUE)
44lndoublefact(n,give=FALSE,strict=TRUE)
45gsl_sf_choose(n,m,give=FALSE,strict=TRUE)
46lnchoose(n,m,give=FALSE,strict=TRUE)
47poch(a,x,give=FALSE,strict=TRUE)
48lnpoch(a,x,give=FALSE,strict=TRUE)
49lnpoch_sgn(a,x,give=FALSE,strict=TRUE)
50pochrel(a,x,give=FALSE,strict=TRUE)
51gamma_inc_Q(a,x,give=FALSE,strict=TRUE)
52gamma_inc_P(a,x,give=FALSE,strict=TRUE)
53gamma_inc(a,x,give=FALSE,strict=TRUE)
54gsl_sf_beta(a,b,give=FALSE,strict=TRUE)
55lnbeta(a,b,give=FALSE,strict=TRUE)
56beta_inc(a,b,x,give=FALSE,strict=TRUE)
57}
58\arguments{
59  \item{x,a,b}{input: real values}
60  \item{m,n}{input: integer value}
61  \item{zr}{In \code{gamma_complex()}, the real part of the argument}
62  \item{zi}{In \code{gamma_complex()}, the imaginary part of the
63    argument.  If missing (ie takes the default value of \code{NULL}),
64    interpret \code{zr} as complex, even if real}
65  \item{r.and.i}{In \code{gamma_complex()}, Boolean variable with
66    default value of \code{TRUE} meaning to return a complex variable as
67    per the details section below; and \code{FALSE} meaning to return
68    the values as advertised in the \acronym{GSL} manual}
69    \item{give}{Boolean with \code{TRUE} meaning to return a list of three
70    items: the value, an estimate of the error, and a status number}
71  \item{strict}{Boolean, with \code{TRUE} meaning to return \code{NaN}
72    if status is an error}
73}
74\details{
75
76  All functions as documented in the \acronym{GSL} reference manual section 7.19.
77
78  Note that \code{gamma_inc_P()} gives the area of the left tail of the
79  gamma distribution so, for example, \code{gamma_inc_P(1.8, 5) =
80  pgamma(5, 1.8)} to numerical accuracy.
81
82}
83\references{\url{https://www.gnu.org/software/gsl/}}
84\author{Robin K. S. Hankin}
85\examples{
86gsl_sf_gamma(3)
87
88lngamma_complex(1+seq(from=0,to=5,by=0.1)*1i)  #table 6.7, p 277 (LH col)
89                                               #note 2pi phase diff
90
91
92jj <- expand.grid(1:10,2:5)
93x <- taylorcoeff(jj$Var1,jj$Var2)
94dim(x) <- c(10,4)
95x    #table 23.5, p818
96
97
98jj <- expand.grid(36:50,9:13)
99x <- gsl_sf_choose(jj$Var1,jj$Var2)
100dim(x) <- c(15,5)
101x     #table 24.1, p829  (bottom bit)
102
103gamma_inc(1.2,1.3)
104beta(1.2, 1.3)
105lnbeta(1.2,1.55)
106beta_inc(1.2,1.4,1.6)
107
108gamma_inc_P(1.8, 5) - pgamma(5, 1.8)  # should be small
109
110}
111\keyword{array}
112