exp

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

Calculate the exponential of all elements in the input array.

Parameters:
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.

Returns:
out : ndarray or scalar

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

Examples

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