파이썬 math.log() 메서드
예시
다른 숫자의 자연 로그 찾기
# Import math Library
import math
# Return the natural logarithm
of different numbers
print(math.log(2.7183))
print(math.log(2))
print(math.log(1))
정의 및 사용
이 math.log()
메서드는 숫자의 자연 로그 또는 밑수에 대한 숫자의 로그를 반환합니다.
통사론
math.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' |
기술적 세부 사항
반환 값: | float 숫자의 자연 로그 또는 밑이 되는 숫자의 로그를 나타내는 값 |
---|---|
파이썬 버전: | 버전 2.3에서 변경됨 |
변경 로그: | 기본 매개변수가 추가되었습니다 . |