Python – Find Gamma Function – gamma() Function with Examples

gamma() function is used to find the Gamma function at x in Python for the given input(x – parameter).

 

Syntax of gamma() Function

The syntax of gamma() function in Python is:

math.gamma(x)

 

Parameters of gamma() Function in Python

x – Where x is any valid python number (positive or negative). This parameter is required.
Note: If the x parameter is not a number, gamma() function will return an Error.

 

Compatibility

gamma() function is available and compatible with both Python 2.x and 3.x. This function is a part of python standard math library.

 

Return Value of gamma() Function in Python

gamma() function returns the Gamma function at x for the given input.

 

Python gamma() Function Example

# import math library
import math

print(math.gamma(-0.2))
print(math.gamma(10))
print(math.gamma(0.2))
print(math.gamma(77))
print(math.gamma(-0.36))

Output:

-5.821148568626516
362880.0
4.5908437119988035
1.8854947016660504e+111
-3.9003560337085226