exp(1 - 1j).real有什么问题

时间:2018-04-11 02:45:48

标签: python

enter image description here

我不知道如何处理具有复杂幂enter image description here

的指数函数

2 个答案:

答案 0 :(得分:2)

复杂感知数学函数在模块cmath中:

>>> import math, cmath
>>> math.exp(1-1j)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: can't convert complex to float
>>> cmath.exp(1-1j)
(1.4686939399158851-2.2873552871788423j)

答案 1 :(得分:-1)

使用numpy可以更容易

np.real(np.exp(1-1j))
  

1.4686939399158851