Python matematik.log() Yöntem
Örnek
Farklı sayıların doğal logaritmasını bulun
# 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))
Tanım ve Kullanım
Yöntem math.log()
, bir sayının doğal logaritmasını veya sayının tabana logaritmasını döndürür.
Sözdizimi
math.log(x, base)
Parametre Değerleri
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' |
Teknik detaylar
Geri dönüş değeri: | Bir float sayının doğal logaritmasını veya sayının tabana göre logaritmasını temsil eden bir değer |
---|---|
Python Sürümü: | 2.3 sürümünde değiştirildi |
Günlüğü Değiştir: | Temel parametre eklendi |