我可以在python中计算exp(1 + 2j)吗?

Sea*_*ene 9 python math

我可以在python中计算exp(1 + 2j)吗?

exp(1+2j)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: can't convert complex to float
Run Code Online (Sandbox Code Playgroud)

Fel*_*Yan 9

您可能希望e从数学模块导入以执行此操作.

例如:

>>> from math import e
>>> print e ** (1+2j)
(-1.1312043837568135+2.4717266720048188j)
Run Code Online (Sandbox Code Playgroud)