我可以在python中计算exp(1 + 2j)吗? [英] Can i calculate exp(1+2j) in python?

查看:226
本文介绍了我可以在python中计算exp(1 + 2j)吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

Can i calculate exp(1+2j) in python?

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

推荐答案

您需要此函数的复杂版本:

You need a complex version of this function:

cmath.exp(1+2j)

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

这篇关于我可以在python中计算exp(1 + 2j)吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆