# Lgamma: Natural logarithm of the gamma function and its derivatives. In Rfast: A Collection of Efficient and Extremely Fast R Functions

 Natural logarithm of the gamma function and its derivatives R Documentation

## Natural logarithm of the gamma function and its derivatives.

### Description

Natural logarithm of the gamma function and its derivatives.

### Usage

``````Lgamma(x)
Digamma(x)
Trigamma(x)
``````

### Arguments

 `x` A numerical matrix or vector with positive numbers in either case.

### Details

We have spotted that the time savings come when there are more than 50 elements, with vector or matrix.

### Value

The matrix or the vector with the resulting values.

### References

Abramowitz, M. and Stegun, I. A. (1972) Handbook of Mathematical Functions. New York: Dover. https://en.wikipedia.org/wiki/Abramowitz_and_Stegun provides links to the full text which is in public domain. Chapter 6: Gamma and Related Functions.

```beta.mle, diri.nr2 ```

### Examples

``````x <- matrix( rnorm(500 * 500), ncol = 500 )
a1 <- Lgamma(x)
a2 <- lgamma(x)
all.equal(as.vector(a1), as.vector(a2))

a1 <- Digamma(x)
a2 <- digamma(x)
all.equal(as.vector(a1), as.vector(a2))

x<-a1<-a2<-NULL
``````

Rfast documentation built on Nov. 9, 2023, 5:06 p.m.