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

Solution 1:

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

Solution 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