gpt4 book ai didi

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

转载 作者:太空狗 更新时间:2023-10-29 20:33:54 26 4
gpt4 key购买 nike

我可以用 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

最佳答案

你需要这个函数的复杂版本:

cmath.exp(1+2j)

参见 http://docs.python.org/library/cmath.html

关于python - 我可以在 python 中计算 exp(1+2j) 吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8498310/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com