What exactly does numpy.exp() do? [closed]
The exponential function is e^x
where e
is a mathematical constant called Euler's number, approximately 2.718281
. This value has a close mathematical relationship with pi
and the slope of the curve e^x
is equal to its value at every point. np.exp()
calculates e^x
for each value of x
in your input array.
It calculates ex for each x in your list where e is Euler's number (approximately 2.718). In other words, np.exp(range(5))
is similar to [math.e**x for x in range(5)]
.
exp(x) = e^x where e= 2.718281(approx)
import numpy as npar=np.array([1,2,3])ar=np.exp(ar)print ar
outputs:
[ 2.71828183 7.3890561 20.08553692]