On this page
numpy.log
numpy.log(x[, out]) =-
Natural logarithm, element-wise.
The natural logarithm
logis the inverse of the exponential function, so thatlog(exp(x)) = x. The natural logarithm is logarithm in basee.Parameters: x : array_like
Input value.
Returns: y : ndarray
The natural logarithm of
x, element-wise.Notes
Logarithm is a multivalued function: for each
xthere is an infinite number ofzsuch thatexp(z) = x. The convention is to return thezwhose imaginary part lies in[-pi, pi].For real-valued input data types,
logalways returns real output. For each value that cannot be expressed as a real number or infinity, it yieldsnanand sets theinvalidfloating point error flag.For complex-valued input,
logis a complex analytical function that has a branch cut[-inf, 0]and is continuous from above on it.loghandles the floating-point negative zero as an infinitesimal negative number, conforming to the C99 standard.References
[R44] M. Abramowitz and I.A. Stegun, “Handbook of Mathematical Functions”, 10th printing, 1964, pp. 67. http://www.math.sfu.ca/~cbm/aands/ [R45] Wikipedia, “Logarithm”. http://en.wikipedia.org/wiki/Logarithm Examples
>>> np.log([1, np.e, np.e**2, 0]) array([ 0., 1., 2., -Inf])
© 2008–2016 NumPy Developers
Licensed under the NumPy License.
https://docs.scipy.org/doc/numpy-1.11.0/reference/generated/numpy.log.html