Use the NumPy library numpy.exp() function to calculate the exponential value of each element in an array. The
exp the function returns an array with the element-wise exponent.
Python exponential numpy example
Simple example code import the NumPy library and use the
np.exp() function to calculate the exponential of a scalar value
x and an array
import numpy as np
# scalar value
x = 2
exp_x = np.exp(x)
arr = np.array([1, 2, 3])
exp_arr = np.exp(arr)
Comment if you have any doubts or suggestions on this Python exponential topic.
Note: IDE: PyCharm 2021.3.3 (Community Edition)
All Python Examples are in Python 3, so Maybe its different from python 2 or upgraded versions.
Degree in Computer Science and Engineer: App Developer and has multiple Programming languages experience. Enthusiasm for technology & like learning technical.