On this page
numpy.emath.log
- emath.log(x)[source]
-
Compute the natural logarithm of
x.Return the “principal value” (for a description of this, see
numpy.log) of \(log_e(x)\). For realx > 0, this is a real number (log(0)returns-infandlog(np.inf)returnsinf). Otherwise, the complex principle value is returned.- Parameters
-
- xarray_like
-
The value(s) whose log is (are) required.
- Returns
-
- outndarray or scalar
-
The log of the
xvalue(s). Ifxwas a scalar, so isout, otherwise an array is returned.
See also
Notes
For a log() that returns
NANwhen realx < 0, usenumpy.log(note, however, that otherwisenumpy.logand thislogare identical, i.e., both return-infforx = 0,infforx = inf, and, notably, the complex principle value ifx.imag != 0).Examples
>>> np.emath.log(np.exp(1)) 1.0Negative arguments are handled “correctly” (recall that
exp(log(x)) == xdoes not hold for realx < 0):>>> np.emath.log(-np.exp(1)) == (1 + np.pi * 1j) True
© 2005–2022 NumPy Developers
Licensed under the 3-clause BSD License.
https://numpy.org/doc/1.23/reference/generated/numpy.emath.log.html