파이썬 cmath.log() 메서드
예시
복소수 값의 로그 찾기:
#Import cmath Library
import cmath
#print log value of some given
parameters
print (cmath.log(1+ 1j))
print (cmath.log(1, 2.5))
정의 및 사용
이 cmath.log()
메서드는 복소수 값의 로그를 반환합니다.
단일 인수로 이 메서드는 밑이 e인 해당 인수의 자연 로그를 반환합니다.
두 개의 인수가 있는 경우 이 메서드는 첫 번째 인수(x)의 로그를 두 번째 인수(base)의 밑으로 반환합니다.
통사론
cmath.log(x, base)
매개변수 값
Parameter | Description |
---|---|
x | Required. Specifies the value to calculate the logarithm for. If the value is 0 or a negative number, it returns a ValueError. If the value is not a number, it returns a TypeError |
base | Optional. The logarithmic base to use. Default is 'e' |
기술적 세부 사항
반환 값: | complex 숫자의 자연 로그 또는 밑이 되는 숫자의 로그를 나타내는 값 |
---|---|
파이썬 버전: | 버전 2.4에서 변경됨 |
파이썬 변경 로그: | 기본 매개변수가 추가되었습니다. |