Python math.gamma()- Methode
Beispiel
Finden Sie die Gammafunktion verschiedener Zahlen:
# Import math Library
import math
# Return 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))
Definition und Verwendung
Die math.gamma()
Methode gibt die Gammafunktion bei einer Zahl zurück.
Tipp: Um den Log-Gammawert einer Zahl zu finden, verwenden Sie die math.lgamma()
Methode.
Syntax
math.gamma(x)
Parameterwerte
Parameter | Description |
---|---|
x | Required. A number to find the gamma function for. If the number is a negative integer, it returns a ValueError. If it is not a number, it returns a TypeError. |
Technische Details
Rückgabewert: | Ein float Wert, der die Gammafunktion bei x darstellt |
---|---|
Python-Version: | 3.2 |