NumPy - exp() function
The NumPy exp() function is used to calculate e raised to the power of given value, i.e., ex. Please note that e is the base of the natural system of logarithms, and its value is approximately 2.718282.
Returns the exponential of each element of a.
In the below example, numpy exp() function is used to calculate the exponential of each element present in array Arr.
import numpy as np Arr = np.array([0, 1, 2, 3]) print("The exponential of values:") print(np.exp(Arr))
The output of the above code will be:
The exponential of values: [ 1. 2.71828183 7.3890561 20.08553692]
❮ NumPy - Functions