파이썬 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 |