### The Maxima on-line user's manual

Algebra Calculator

#### Gamma

Function: gamma (<z>) The basic definition of the gamma function (A&S 6.1.1) is

inf / [ z - 1 - t gamma(z) = I t %e dt ] / 0

Maxima simplifies `gamma` for positive integer and positive and negative rational numbers. For half integral values the result is

`     a rational number times `sqrt(%pi)`. The simplification for`
`     integer values is controlled by `factlim`. For integers greater`
`     than `factlim` the numerical result of the factorial function,`
`     which is used to calculate `gamma`, will overflow.  The`
`     simplification for rational numbers is controlled by `gammalim` to`
`     avoid internal overflow. See `factlim` and `gammalim`.`

For negative integers `gamma` is not definied.

Maxima can evalute `gamma` numerically for real and complex values in float and bigfloat precision.

`gamma` has mirror symmetry.

When `gamma_expand` is `true`, Maxima expands `gamma` for arguments `z+n` and `z-n` where `n` is an integer.

Maxima knows the derivate of `gamma`.

Examples:

Simplification for integer, half integral, and rational numbers:

```          (%i1) map(gamma,[1,2,3,4,5,6,7,8,9]);
(%o1)               [1, 1, 2, 6, 24, 120, 720, 5040, 40320]```

```          (%i2) map(gamma,[1/2,3/2,5/2,7/2]);
sqrt(%pi)  3 sqrt(%pi)  15 sqrt(%pi)
(%o2)          [sqrt(%pi), ---------, -----------, ------------]
2           4            8```

```          (%i3) map(gamma,[2/3,5/3,7/3]);
2           1
2 gamma(-)  4 gamma(-)
2           3           3
(%o3)                [gamma(-), ----------, ----------]
3       3           9```

Numerical evaluation for real and complex values:

```          (%i4) map(gamma,[2.5,2.5b0]);
(%o4)             [1.329340388179137, 1.329340388179137b0]```

```          (%i5) map(gamma,[1.0+%i,1.0b0+%i]);
(%o5) [.4980156681183558 - .1549498283018108 %i,
4.980156681183561b-1 - 1.549498283018107b-1 %i]```

`gamma` has mirror symmetry:

```          (%i8) declare(z,complex)\$
(%i9) conjugate(gamma(z));
(%o9)                         gamma(conjugate(z))```

Maxima expands `gamma(z+n)` and `gamma(z-n)`, when `gamma_expand` is `true`:

```          (%i10) gamma_expand:true\$
(%i11) [gamma(z+1),gamma(z-1),gamma(z+2)/gamma(z+1)];
gamma(z)
(%o11)                   [z gamma(z), --------, z + 1]
z - 1```

The deriviative of `gamma`:

```          (%i12) diff(gamma(z),z);
(%o12)                         psi (z) gamma(z)
0```

See also `makegamma`.

The Euler-Mascheroni constant is `%gamma`.

There are also some inexact matches for `gamma`. Try `?? gamma` to see them.

```(%o1)                                true
(%i2) ```

### Related Examples

##### gamma-log-pi-plot2d

pi(x) := gamma(x + 1);

plot2d([pi(x) / log(p...

Calculate

##### gamma-sqrt

xn1 : pt(sqrt((n*(1+%...

Calculate

eq1:x=lambda;

eq2:y=lambda+mu;

eq3:z=gamma;

Calculate

##### gamma-linsolve-solve

eq1:x*4+y-2=y;

eq2:x+2=y;

eq3: pi*(1+(x-((a-1)/...

Calculate

##### gamma-inf-limit

limit (gamma(x + 72 -...

Calculate

##### gamma-sqrt

N:10;

eq1:(sqrt((2*N-2)/2)*...

eq2:(sqrt(2)*gamma((2...

Calculate

##### gamma-integrate-log

f(s):=integrate((-log...

f(3);

f(2);

Calculate

##### gamma-solve-tan

eq1:(x-z*tan(gamma))*...

eq2:z=5;

solve([eq1,eq2],[x,y,...

Calculate

##### gamma-log-pi-plot2d

pi(x) := gamma(x + 1);

plot2d([pi(x) / log(p...

Calculate

##### gamma-solve-tan

eq1:(x-z*tan(gamma))*...

eq2:z-5;

eq3:gamma-20.923;

Calculate