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

Calculate the exponential of all elements in the input array.

  • 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.


out – Output array, element-wise exponential of x. This is a scalar if x is a scalar.

Return type

ndarray or scalar


>>> np.exp(1)
>>> x = np.array([-1, 1, -2, 2])
>>> np.exp(x)
array([0.36787945, 2.7182817 , 0.13533528, 7.389056  ])