NumPy Tutorial NumPy Statistics NumPy Resources
Python Java C++ C C# PHP R SQL DS Algo InterviewQ

NumPy - expm1() function

The NumPy expm1() function is used to calculate e raised to the power of given value minus 1, i.e., ex-1. Please note that e is the base of the natural system of logarithms, and its value is approximately 2.718282.


numpy.expm1(a, out=None)


a Required. Specify array (array_like) containing elements, of which the exponential minus 1 is calculated.
out Optional. Specify 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.

Return Value

Returns the exponential minus 1 of each element of a.


In the example below, numpy expm1() function is used to calculate the exponential minus 1 of each element present in array Arr.

import numpy as np

Arr = np.array([0, 1, 2, 3])

print("The exponential minus 1 of values:")

The output of the above code will be:

The exponential minus 1 of values:
[  0.           1.71828183   6.3890561   19.08553692]

❮ NumPy - Functions