The math.lgamma() function is used to calculate the natural logarithm of the absolute value of the Gamma function of a given argument. The lgamma part of the function name is the shortened form of log gamma.

Gamma function, in mathematics,  is an extension of the factorial function to all real numbers. It is defined by the expression: γ(x) = (x-1)!

Syntax:
math.lgamma(x
copy

Parameter x must be a real number.

ExampleEdit & Run
import math

print(math.lgamma(0.5))
print(math.lgamma(4))
print(math.lgamma(5))
print(math.lgamma(10))
copy
Output:
0.5723649429247004 1.7917594692280554 3.178053830347945 12.801827480081467 [Finished in 0.011253587901592255s]