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?
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?
Numpy seems to take a cue from MATLAB/Octave and uses log
to be "log base e" or ln
. Also like MATLAB/Octave, Numpy does not offer a logarithmic function for an arbitrary base.
If you find log
confusing you can create your own object ln
that refers to the numpy.log function:
>>> import numpy as np
>>> from math import e
>>> ln = np.log # assign the numpy log function to a new function called ln
>>> ln(e)
1.0
np.log
isln
, whereasnp.log10
is your standard base 10 log.