FreeMat: GAMMA Gamma Function

FreeMat

- Main Page
- Related Pages

GAMMA Gamma Function

Section: Mathematical Functions

# Usage

Computes the gamma function for real arguments. The `gamma` function takes only a single argument

      y = gamma(x)

where `x` is either a `float` or `double` array. The output vector `y` is the same size (and type) as `x`.

# Internals

The gamma function is defined by the integral:

The gamma function obeys the interesting relationship

and for integer arguments, is equivalent to the factorial function.

# Example

Here is a plot of the gamma function over the range `[-5,5]`.

    --> x = linspace(-5,5);
    --> y = gamma(x);
    --> plot(x,y); xlabel('x'); ylabel('gamma(x)');
    --> axis([-5,5,-5,5]);

which results in the following plot.