Previous Page Next Page Contents

gamma -- the gamma function

Introduction

gamma(x) represents the gamma function int(exp(-t)*t^(x-1), t=0..infinity).

Call(s)

gamma(x)

Parameters

x - an arithmetical expression

Returns

an arithmetical expression.

Overloadable:

x

Side Effects

When called with a floating point argument, the function is sensitive to the environment variable DIGITS which determines the numerical working precision.

Related Functions

beta, fact, igamma, psi

Details

Example 1

We demonstrate some calls with exact and symbolic input data:

>> gamma(15), gamma(23/2), gamma(sqrt(2)), gamma(x + 1)
                                    1/2
                      13749310575 PI            1/2
         87178291200, -----------------, gamma(2   ), gamma(x + 1)
                            2048

Floating point values are computed for floating point arguments:

>> gamma(11.5), gamma(2.0 + 10.0*I)
           11899423.08, - 0.00001089258677 + 0.00000504737724 I

Example 2

gamma is singular for nonpositive integers:

>> gamma(-2)
      Error: singularity [gamma]

Example 3

The functions diff, expand, float, limit, and series handle expressions involving gamma:

>> diff(gamma(x^2 + 1), x), float(ln(3 + gamma(sqrt(PI))))
                         2             2
                2 x psi(x  + 1) gamma(x  + 1), 1.367203476
>> expand(gamma(3*x - 4))
                                gamma(3 x)
                  ---------------------------------------
                  (3 x - 1) (3 x - 2) (3 x - 3) (3 x - 4)
>> limit(1/gamma(x), x = infinity), 
   limit(gamma(x - 4)/gamma(x - 10), x = 0)
                                 0, 151200
>> series(gamma(x), x = 0, 4)
                              /          2        2 \
                              |        PI    EULER  |
                              |      - --- + ------ |
             1                | PI     12      2    |      2
             - - EULER + x PI | -- + -------------- | + O(x )
             x                \ 6          PI       /

The Stirling formula is obtained as an asymptotic series:

>> series(gamma(x), x = infinity, 3)
                                x         / 2 PI \1/2
                               x  exp(-x) | ---- |
       x         / 2 PI \1/2              \  x   /
      x  exp(-x) | ---- |    + ---------------------- +
                 \  x   /               12 x
      
          x         / 2 PI \1/2    /  x         / 2 PI \1/2 \
         x  exp(-x) | ---- |       | x  exp(-x) | ---- |    |
                    \  x   /       |            \  x   /    |
         ---------------------- + O| ---------------------- |
                      2            |            3           |
                 288 x             \           x            /

Changes




Do you have questions or comments?


Copyright © SciFace Software GmbH & Co. KG 2000