betaln

Natural logarithm of the beta function.

Category: Mathematics > Elementary Math

Syntax

L = betaln(Z, W)

Returns log(beta(Z, W)).

Description

For large arguments beta underflows to zero, because it is a tiny number. betaln avoids that by working with gammaln, so it stays accurate. Use it when the beta function appears inside a larger expression that is combined in logarithmic form, for example when computing a likelihood.

Input arguments

Z, W
Positive real arrays of the same size, or scalars.

Output arguments

L
Logarithm of the beta function.

Example

Beta function for large arguments

betaln(10, 20)
beta(10, 20)
log(beta(10, 20))
Output
ans = -19.1153
ans = 4.9925e-09
ans = -19.1153

See also

beta gammaln betainc log