log
Description
Calculate the natural logarithm of each element (non-negative), that is, ln(x).
Mandatory Input Parameters
Parameter |
Type |
Description |
|---|---|---|
x |
array_like |
Input array or scalar |
Optional Input Parameters
Return Value
Type |
Description |
|---|---|
ndarray/scalar |
Natural logarithm of each element (non-negative) |
Examples
>>> import numpy as np >>> np.log(1.0) 0.0 >>> x = np.array([1.0, np.e, np.e**2, 0]) >>> np.log(x) array([ 0., 1., 2., -inf]) >>>
Parent topic: Basic Operation Functions