Main Content


Logarithm of beta function


L = betaln(Z,W)


L = betaln(Z,W) computes the natural logarithm of the beta function log(beta(Z,W)), for corresponding elements of arrays Z and W, without computing beta(Z,W). Since the beta function can range over very large or very small values, its logarithm is sometimes more useful.

Z and W must be real and nonnegative. They must be the same size, or either can be scalar.


collapse all

Compute the natural logarithm of the beta function according to the value of X without directly computing the beta function. beta(X,X) results in floating point arithmetic underflow.

X = 510;
ans = -708.8616


betaln(z,w) = gammaln(z)+gammaln(w)-gammaln(z+w)

Extended Capabilities

C/C++ Code Generation
Generate C and C++ code using MATLAB® Coder™.

Version History

Introduced before R2006a

See Also

| |