The cmath.exp()
function calculates the value of e
(Euler's number) raised to the power of x
. Where x
is the input complex number.
cmath.exp(x)
x |
The value(real or complex) whose exponent value is to be calculated. |
The exp() function returns the value of e
raised to the power of the complex number x
,. If the input numbers is a real number, it is first converted to complex before the operation. The return value is always a complex number.
import cmath
print(cmath.exp(2))
print(cmath.exp(complex(2, -1)))
print(cmath.exp(1 + 2j))
print(cmath.exp(3 + 5j))