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))
參考: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))
參考:https://www.runoob.com/python/func-number-exp.html
https://blog.csdn.net/jhjbjbn/article/details/44776089