Python cmath.sqrt ()วิธี การ
ตัวอย่าง
ค้นหารากที่สองของจำนวนเชิงซ้อน:
#Import cmath Library
import cmath
#Return the square root of a
complex number
print (cmath.sqrt(2 + 3j))
print (cmath.sqrt(15))
ความหมายและการใช้งาน
วิธี การcmath.sqrt()
ส่งคืนรากที่สองของจำนวนเชิงซ้อน
หมายเหตุ:ตัวเลขต้องมากกว่าหรือเท่ากับ 0
ไวยากรณ์
cmath.sqrt(x)
ค่าพารามิเตอร์
Parameter | Description |
---|---|
x | Required. A number to find the square root of. If the number is less than 0, it returns a ValueError. If the value is not a number, it returns a TypeError |
รายละเอียดทางเทคนิค
คืนมูลค่า: | ค่า ที่complex แทนรากที่สองของจำนวนเชิงซ้อน |
---|---|
เวอร์ชันหลาม: | 1.5 |