Python cmath.polar()วิธี การ
ตัวอย่าง
แปลงจำนวนเชิงซ้อนเป็นรูปแบบพิกัดเชิงขั้ว:
#import cmath for complex number operations
import cmath
#find
the polar coordinates of complex number
print (cmath.polar(2 + 3j))
print (cmath.polar(1 + 5j))
ความหมายและการใช้งาน
วิธี การcmath.polar()
แปลงจำนวนเชิงซ้อนเป็นพิกัดเชิงขั้ว ส่งกลับค่าทูเพิลของโมดูลัสและเฟส
ในพิกัดเชิงขั้ว จำนวนเชิงซ้อนถูกกำหนดโดยโมดูลัสr และมุมเฟสพี
ไวยากรณ์
cmath.polar(x)
ค่าพารามิเตอร์
Parameter | Description |
---|---|
x | Required. A number to find polar coordinates of |
รายละเอียดทางเทคนิค
คืนมูลค่า: | ค่าtuple แทนพิกัดเชิงขั้ว |
---|---|
เวอร์ชันหลาม: | 2.6 |