طريقة Python 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 |
تغيير السجل: | تم إضافة المعلمة الأساسية |