In NumPy, you can calculate the exponential of a complex number using numpy.exp. The exponential of a complex number z can be represented as exp(z) = exp(x) * (cos(y) + 1j * sin(y)), where x and y are the real and imaginary parts of the complex number z, respectively.
Here’s an example of how to calculate the exponential of a complex number in NumPy:
import numpy as np z = 3 + 4j result = np.exp(z) print(result) # Output: (-13.12878308+15.20078808j)
Note: The numpy.exp function also supports element-wise exponential calculations for arrays and matrices, enabling the calculation of exponentials for an array of complex numbers.