FreeMat: GAMMALN Log Gamma Function

FreeMat

- Main Page
- Related Pages

GAMMALN Log Gamma Function

Section: Mathematical Functions

# Usage

Computes the natural log of the gamma function for real arguments. The `gammaln` function takes only a single argument

      y = gammaln(x)

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

# Example

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

    --> x = linspace(0,10);
    --> y = gammaln(x);
    --> plot(x,y); xlabel('x'); ylabel('gammaln(x)');

which results in the following plot.