Метод Python math.gamma()
Пример
Найдите гамма-функцию различных чисел:
# 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))
Определение и использование
Метод math.gamma()
возвращает гамма-функцию в виде числа.
Совет: Чтобы найти значение логарифмической гаммы числа, используйте math.lgamma()
метод.
Синтаксис
math.gamma(x)
Значения параметров
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. |
Технические детали
Возвращаемое значение: | Значение float , представляющее гамма-функцию в точке x |
---|---|
Версия Python: | 3.2 |