python numpy ln

匿名 (未验证) 提交于 2019-12-03 03:04:01

问题:

Using numpy, how can I do the following:

ln(x) 

Is it equivalent to:

np.log(x) 

I apologise for such a seemingly trivial question, but my understanding of the difference between log and ln is that ln is logspace e?

回答1:

np.log is ln, whereas np.log10 is your standard base 10 log.

Relevant documentation:

http://docs.scipy.org/doc/numpy/reference/generated/numpy.log.html

http://docs.scipy.org/doc/numpy/reference/generated/numpy.log10.html



回答2:

Correct, np.log(x) is the Natural Log (base e log) of x.

For other bases, remember this law of logs: log-b(x) = log-k(x) / log-k(b) where log-b is the log in some arbitrary base b, and log-k is the log in base k, e.g.

here k = e

l = np.log(x) / np.log(100) 

and l is the log-base-100 of x



回答3:

from numpy.lib.scimath import logn from math import e  #using: x - var logn(e, x) 


文章来源: python numpy ln
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!