Easy Tutorial
❮ Python Att List Len Python Largest Number ❯

Python math.gamma() Method

Python math Module

The math.gamma(x) method in Python returns the Gamma function at x.

The Gamma function, also known as Euler's second integral, is an extension of the factorial function to real and complex numbers.

To find the logarithmic Gamma value of a number, use the math.lgamma() method.

Python Version: 3.2

Syntax

The syntax for the math.gamma() method is as follows:

math.gamma(x)

Parameter Description:

Return Value

A floating-point value representing the Gamma function at x.

Example

The following example calculates the Gamma function for different numbers:

Example

# Import math package
import math

# Calculate the Gamma function for different numbers
print(math.gamma(-0.1))
print(math.gamma(8))
print(math.gamma(1.2))
print(math.gamma(80))
print(math.gamma(-0.55))

Output result:

-10.686287021193193
5040.0
0.9181687423997604
8.946182130782976e+116
-3.578429819277059

Python math Module

❮ Python Att List Len Python Largest Number ❯