Python math - lgamma() Function
The Python math.lgamma() function returns the natural logarithm of the absolute value of the gamma function (log gamma function) of the argument. The log gamma function of x is defined as:
Syntax
math.lgamma(x)
Parameters
x |
Required. Specify the value. |
Return Value
Returns the natural logarithm of the absolute value of the gamma function of the argument.
Example:
The example below shows the usage of lgamma() function.
import math print(math.lgamma(0.1)) print(math.lgamma(1.5)) print(math.lgamma(2.5),"\n") print(math.lgamma(-0.1)) print(math.lgamma(-1.5)) print(math.lgamma(-2.5))
The output of the above code will be:
2.2527126517342055 -0.12078223763524543 0.2846828704729196 2.3689613327287886 0.8600470153764812 -0.05624371649767457
❮ Python Math Module