log() exp()函數


1 對數函數表示法

import numpy as np
import math
print('輸出自然底數e:',math.e)

# np表示法
# np.log()是以e為底的自然對數
print(np.log(math.e))
# np.log10是以10為底的對數函數  這種寫法只可表示底為2和10的對數函數
print(np.log10(10))
# np.log1p()表示ln(1+x)
print(np.log1p(math.e-1))

# math表示法
# 任意的對數函數表示方法,第一個數是冪,第二個是底數
print(math.log(64, 2))
View Code

 參考:https://www.runoob.com/python/func-number-log.html

2 指數函數表示法

import numpy as np
import math

# np表示法
# np.exp()是以e為底的自然對數
print(np.exp(1))
# np.expm1()表示exp(x)-1,輸入的可以是普通數字也可以是數組
print(np.expm1(1))

# math表示法
print(math.exp(1))
# 任意的對數函數表示方法,第一個數是底數,第二個是指數
print(math.pow(2,6))
View Code

參考:https://www.runoob.com/python/func-number-exp.html

          https://blog.csdn.net/jhjbjbn/article/details/44776089


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM