The math.gamma
() function is used to calculate the Gamma function( Γ(x)) of a given number. The Gamma function is an extension of the factorial function it is defined by the following equation: Γ(x) = (x-1)!.
However, there is an important distinction between gamma and factorials. While, factorials calculates the number of permutations when a partial arrangement is not allowed, Gamma function is used to calculate the number of permutations when a partial arrangement is also allowed. A resulting effect is that we can get the gamma function of floating point values which is impossible with factorials.
math.gamma(x)
Where, parameter x
is a real number for which the Gamma function is to be calculated.
This function returns the Gamma function of x
as a floating point value.