Exponential Functions
numpy.exp
x: array_like - Input values.out: ndarray, optional - A location into which the result is stored.where: array_like, optional - Condition to broadcast over the input.
out: ndarray or scalar - Output array, element-wise exponential ofx.
- For real input,
exp(x)is always positive. - For complex arguments , we can write .
- The first term is real, the second term has magnitude 1 and periodic phase.
numpy.expm1
exp(x) - 1 for all elements in the array.
Parameters:
x: array_like - Input values.out: ndarray, optional - A location into which the result is stored.where: array_like, optional - Condition to broadcast over the input.
out: ndarray or scalar - Element-wise exponential minus one:exp(x) - 1.
exp(x) - 1 for small values of x, where direct computation would suffer from catastrophic cancellation.
Examples:
numpy.exp2
2**p for all p in the input array.
Parameters:
x: array_like - Input values.out: ndarray, optional - A location into which the result is stored.where: array_like, optional - Condition to broadcast over the input.
out: ndarray or scalar - Element-wise 2 to the powerx.
Logarithmic Functions
numpy.log
x: array_like - Input values.out: ndarray, optional - A location into which the result is stored.where: array_like, optional - Condition to broadcast over the input.
y: ndarray - The natural logarithm ofx, element-wise.
- Logarithm is a multivalued function. The convention is to return the real part in the range .
- For real-valued input,
logreturns real output for positive values andnanfor negative values. - For complex-valued input, has a branch cut along the negative real axis.
numpy.log10
x: array_like - Input values.out: ndarray, optional - A location into which the result is stored.where: array_like, optional - Condition to broadcast over the input.
y: ndarray - The logarithm base 10 ofx, element-wise.
numpy.log2
x.
Parameters:
x: array_like - Input values.out: ndarray, optional - A location into which the result is stored.where: array_like, optional - Condition to broadcast over the input.
y: ndarray - Base-2 logarithm ofx.
numpy.log1p
x: array_like - Input values.out: ndarray, optional - A location into which the result is stored.where: array_like, optional - Condition to broadcast over the input.
y: ndarray - Natural logarithm of1 + x, element-wise.
x, log1p(x) provides greater precision than log(1 + x), where direct computation would suffer from catastrophic cancellation.
Examples:
Relationship Between Functions
The exponential and logarithmic functions are inverses of each other:Inverse Relationships:
- (for )
- (for )
Special Exponential Functions
numpy.logaddexp
numpy.logaddexp2
See Also
Arithmetic Functions
Basic arithmetic operations including power
Trigonometric Functions
sin, cos, tan, and their inverses
Rounding Functions
floor, ceil, round, and truncation
Special Functions
sqrt, square, and other mathematical utilities
