import math
def log_n_back(x, base):
return math.pow(math.log(x, base), base)
x = 14
y = log_n_back(x, math.e)
print(y) # 13.983525601880974
y = log_n_back(x, 10)
print(y) # 3.9113921541997523
使用math.e至少近似答案的那個。但是使用的那個10是錯誤的。
另外語境:我必須與之間的數字作品1,000和100,000。
uj5u.com熱心網友回復:
將引數的順序交換為pow():
return math.pow(base, math.log(x, base))
然后它會做你想要做的事情,結果會非常接近你想要的。
轉載請註明出處,本文鏈接:https://www.uj5u.com/shujuku/382593.html
