lngamma

Purpose

Computes the natural log of the gamma function.

Format

y = lngamma(x)
Parameters

x (NxK matrix or N-dimensional array) – all elements must be positive.

Returns

y (NxK matrix) – containing the natural log of the gamma function of each of the elements in x.

Examples

x = { 4, 8 };
y = lngamma(x);
y =   1.7917595
      8.5251614

Remarks

The relation between lngamma() and lnfact() is:

lngamma(x) = lnfact(x - 1);

Source

See also

Functions gamma(), lnfact()