Python math.lgamma()วิธี การ
ตัวอย่าง
ค้นหาค่าแกมมาล็อกของตัวเลขต่างๆ:
# Import math Library
import math
# Return the log gamma value of
different numbers
print (math.lgamma(7))
print (math.lgamma(-4.2))
ความหมายและการใช้งาน
เมธอดส่งคืน ค่าmath.lgamma()
แกมมาลอการิทึมธรรมชาติของตัวเลข
เคล็ดลับ:เราสามารถหาค่าแกมมาของล็อกได้โดยใช้math.gamma()
วิธีการหาค่าแกมมา แล้วใช้math.log()
วิธีคำนวณค่าล็อกของค่านั้น
เคล็ดลับ:ค่าแกมมาเท่ากับแฟกทอเรียล(x-1)
ไวยากรณ์
math.lgamma(x)
ค่าพารามิเตอร์
Parameter | Description |
---|---|
x | Required. The number to find the log gamma value of. If the number is a negative integer, it returns a ValueError. If it is not a number, it returns a TypeError. |
รายละเอียดทางเทคนิค
คืนมูลค่า: | ค่า ที่float แทนค่าแกมมาล็อกของตัวเลข |
---|---|
เวอร์ชันหลาม: | 3.2 |