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 |
---|---|
เวอร์ชันหลาม: | 3.2 |