Python in its language allows various mathematical operations, which has manifolds application in scientific domain. One such offering of Python is the inbuilt
gamma() function, which numerically computes the gamma value of the number that is passed in the function.
Syntax : math.gamma(x)
Parameters :
x : The number whose gamma value needs to be computed.
Returns : The gamma value, which is numerically equal to "factorial(x-1)".
Code #1 : Demonstrating the working of gamma()
Output:
The gamma value of the given argument is : 120.0
factorial() vs gamma()
The gamma value can also be found using
factorial(x-1), but the use case of
gamma() is because, if we compare both the function to achieve the similar task,
gamma() offers better performance.
Code #2 : Comparing
factorial() and
gamma()