How do you do natural logs (e.g. "ln()") with numpy in Python? How do you do natural logs (e.g. "ln()") with numpy in Python? python python

How do you do natural logs (e.g. "ln()") with numpy in Python?


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


I usually do like this:

from numpy import log as ln

Perhaps this can make you more comfortable.