Python – lgamma() Function – Examples & Explanation

lgamma() function is used to find the natural logarithm of an absolute value of a gamma function at x, where x is the input value we pass as an argument to the lgamma() function. We can find gamma function by using math.gamma(). lgamma() function is a part of python programming language and it is a new function its available with the python 3.2 and above.

Syntax of lgamma() Function

The syntax of lgamma() function in Python is:


Parameters of lgamma() Function in Python

x – Where x is a gamma function absolute value which we want to find the natural logarithm. This parameter is required.
Note: If the x parameter is not a number, lgamma() function will return an Error.



lgamma() function is available and compatible with python 3.2 and above versions. This function is a part of python standard math library.


Return Value of lgamma() Function in Python

lgamma() function returns the natural logarithm of the absolute value of the Gamma function for the given input (x – parameter).


Python lgamma() Function Example