Python Tutorial Python Advanced Python References Python Libraries

Python math - gamma() Function



The Python math.gamma() function returns the gamma function of the argument. The gamma function of x is defined as:

gamma
Gamma Function

Syntax

math.gamma(x)   

Parameters

x Required. Specify the value.

Return Value

Returns the gamma function of the argument.

Example:

The example below shows the usage of gamma() function.

import math

print(math.gamma(0.1))
print(math.gamma(1.5))
print(math.gamma(2.5),"\n")

print(math.gamma(-0.1))
print(math.gamma(-1.5))
print(math.gamma(-2.5))

The output of the above code will be:

9.513507698668732
0.886226925452758
1.3293403881791372 

-10.686287021193193
2.3632718012073544
-0.9453087204829417

❮ Python Math Module

5