csnlp.util.math.gammaln#

csnlp.util.math.gammaln(z, g, n, prec=128)[source]#

Computes the logarithm of the gamma function using the Lanczos approximation. Only valid for non-negative real scalars.

Parameters:
zcasadi.SX, MX or DM

The value at which to compute the logarithm of the gamma function.

gint or float

The constant \(g\) in the Lanczos’ approximation.

nint

The number of coefficients to compute for the approximation.

precint, optional

The precision of the computations for decimal.Decimal, by default 128.

Returns:
casadi.SX, MX or DM

The value of the logarithm of the gamma function at z.

Return type:

Union[SX, MX, DM]

Notes

Requires scipy to be installed. For important details, see