You need a complex version of this function:

cmath.exp(1+2j)

See http://docs.python.org/library/cmath.html

Answer from duffymo on Stack Overflow
🌐
W3Schools
w3schools.com › python › ref_cmath_exp.asp
Python cmath.exp() Method
Python Examples Python Compiler Python Exercises Python Quiz Python Challenges Python Server Python Syllabus Python Study Plan Python Interview Q&A Python Bootcamp Python Certificate Python Training ... #import cmath for complex number operations import cmath #find the exponential of a complex number print (cmath.exp(2 + 3j)) Try it Yourself »
🌐
NumPy
numpy.org › devdocs › reference › generated › numpy.exp.html
numpy.exp — NumPy v2.5.dev0 Manual
>>> x = np.linspace(-2*np.pi, 2*np.pi, 100) >>> xx = x + 1j * x[:, np.newaxis] # a + ib over complex plane >>> out = np.exp(xx)
🌐
ESE 224
ese2240.seas.upenn.edu › labs › lab1
Lab1: Discrete Complex Exponentials – ESE 224
January 17, 2023 - Part 1.1 of the lab asks us to create a Python class to represent a complex exponential of discrete frequency $k$ and signal duration $N$. The attributes of the class should include an $N-$dimensional vector containing the elements of the discrete complex exponential.
🌐
Python
docs.python.org › 3 › library › cmath.html
cmath — Mathematical functions for complex numbers
This module provides access to mathematical functions for complex numbers. The functions in this module accept integers, floating-point numbers or complex numbers as arguments. They will also accep...
🌐
GeeksforGeeks
geeksforgeeks.org › complex-numbers-python-set-2-important-functions-constants
Complex Numbers in Python | Set 2 (Important Functions and Constants) | GeeksforGeeks
Introduction to python complex ... article. Operations on complex numbers : 1. exp() :- This function returns the exponent of the complex number mentioned in its argument....
Published   July 15, 2022
🌐
NumPy
numpy.org › doc › stable › reference › generated › numpy.exp.html
numpy.exp — NumPy v2.4 Manual
>>> x = np.linspace(-2*np.pi, 2*np.pi, 100) >>> xx = x + 1j * x[:, np.newaxis] # a + ib over complex plane >>> out = np.exp(xx)
🌐
SciPy
docs.scipy.org › doc › numpy-1.9.0 › reference › generated › numpy.exp.html
numpy.exp — NumPy v1.9 Manual
November 2, 2014 - >>> x = np.linspace(-2*np.pi, 2*np.pi, 100) >>> xx = x + 1j * x[:, np.newaxis] # a + ib over complex plane >>> out = np.exp(xx)
Find elsewhere
🌐
Real Python
realpython.com › python-complex-numbers
Simplify Complex Numbers With Python – Real Python
October 21, 2023 - While there aren’t separate representations for the trigonometric or exponential form in Python, you can verify if mathematical principles hold. For example, plugging in Euler’s formula to the trigonometric form will turn it into the exponential one. You can either call the cmath module’s exp() or raise the e constant to a power to get the same result: ... >>> import cmath >>> algebraic = 3 + 2j >>> geometric = complex(3, 2) >>> radius, angle = cmath.polar(algebraic) >>> trigonometric = radius * (cmath.cos(angle) + 1j*cmath.sin(angle)) >>> exponential = radius * cmath.exp(1j*angle) >>> for number in algebraic, geometric, trigonometric, exponential: ...
🌐
TechWhisperer
logak.hashnode.dev › exploring-complex-numbers-in-python-a-comprehensive-guide
Exploring Complex Numbers in Python: A Comprehensive Guide
September 6, 2024 - In this example, z is a complex number 2 + 3j, and cmath.exp(z) calculates e raised to the power of 2 + 3j. The result is a complex number representing the exponential value.
🌐
Ilya Safro
eecis.udel.edu › ~boncelet › ipynb › ComplexNumbers.html
Complex Numbers
Python handles computation with relative ease. Python uses "j" for the imaginary number · Euler's formula says \[\exp(\theta) = \cos(\theta) + j\sin(\theta)\]
🌐
DataCamp
datacamp.com › tutorial › exponents-in-python
Exponents in Python: A Comprehensive Guide for Beginners | DataCamp
November 25, 2024 - Yes, Python supports negative and ... positive power. Fractional exponents: Use the ** operator or math.pow(). Note that a negative base with a fractional exponent results in a complex number. Modular exponentiation can be performed using the pow() function with three arguments: ...
🌐
Codecademy
codecademy.com › docs › python:numpy › math methods › .exp()
Python:NumPy | Math Methods | .exp() | Codecademy
April 17, 2025 - Yes, np.exp() supports complex numbers and returns the exponential of each complex input using Euler’s formula. math.exp() works only with single scalar values, while np.exp() can handle arrays, lists, and complex numbers, applying the function ...
🌐
MicroPython
docs.micropython.org › en › latest › library › cmath.html
cmath – mathematical functions for complex numbers — MicroPython latest documentation
The cmath module provides some basic mathematical functions for working with complex numbers. Availability: not available on WiPy and ESP8266. Floating point support required for this module. ... Return the cosine of z. ... Return the exponential of z.
🌐
Leapcell
leapcell.io › blog › exponentiation-in-python-a-practical-guide
Exponentiation in Python: A Practical Guide | Leapcell
July 25, 2025 - Python supports negative and fractional exponents: print(2 ** -2) # 0.25 (1 / 2^2) print(9 ** 0.5) # 3.0 (square root of 9) For more complex roots, you can use the ** operator with fractional values: ... Note that fractional exponentiation with ...
🌐
B_Jupyter
audiolabs-erlangen.de › resources › MIR › PCP › PCP_07_exp.html
Unit 7: Exponential Function
Then, in Exercise 2, you will write a Python program to compute and plot the Gaussian function given the exponential function. Finally, you will apply in Exercise 3 the exponential function to create spirals with different properties, which will deepen your understanding of the relationship between the complex ...