expm1

expm1(x, out=None, **kwargs)

Calculate exp(x) - 1 for all elements in the array.

Parameters:
x : ndarray or scalar

Input values.

out : ndarray or None, optional

A location into which the result is stored. If provided, it must have a shape that the inputs broadcast to. If not provided or None, a freshly-allocated array is returned.

Returns:
out : ndarray or scalar

Output array, element-wise exponential minus one: out = exp(x) - 1. This is a scalar if x is a scalar.

Examples

>>> np.expm1(1)
1.718281828459045
>>> x = np.array([-1, 1, -2, 2])
>>> np.exp(x)
array([-0.63212056,  1.71828183, -0.86466472,  6.3890561])