Python math.atan2()เมธอด
ตัวอย่าง
คืนค่าอาร์คแทนเจนต์ของ y/x เป็นเรเดียน:
# Import math Library
import math
# Return the arc tangent of y/x
in radians
print(math.atan2(8, 5))
print(math.atan2(20, 10))
print(math.atan2(34, -7))
ความหมายและการใช้งาน
วิธี การmath.atan2()
ส่งกลับค่าแทนเจนต์ส่วนโค้งของ y/x ในหน่วยเรเดียน โดยที่ x และ y เป็นพิกัดของจุด (x,y)
ค่าที่ส่งคืนอยู่ระหว่าง PI และ -PI
ไวยากรณ์
math.atan2(y, x)
ค่าพารามิเตอร์
Parameter | Description |
---|---|
y | Required. Specifies a positive or negative number |
x | Required. Specifies a positive or negative number |
รายละเอียดทางเทคนิค
คืนมูลค่า: | ค่า ที่float แทนเจนต์อาร์คของ y/x ในหน่วยเรเดียน ซึ่งอยู่ระหว่าง PI และ -PI |
---|---|
เวอร์ชันหลาม: | 1.4 |