网站首页 美食营养 游戏数码 手工爱好 生活家居 健康养生 运动户外 职场理财 情感交际 母婴教育 时尚美容 知识问答

python中如何使用复数

时间:2024-11-01 06:58:50

1、数学中复数有a+bi表示,python中复数是由一个实数和一个虚数组合构成,表示为:x+yj一个复数有一对有序浮点数 (x,y),其中 x 是实数部分,y 是虚数部分。

python中如何使用复数

3、我们通过dir(a)命令,发现复数有这些属性。['__abs__', '__add__', '__bool__媪青怍牙', '__class__', '__delattr__', '__dir__', '__divmod__', '__doc__', '__eq__', '__float__', '__floordiv__', '__format__', '__ge__', '__getattribute__', '__getnewargs__', '__gt__', '__hash__', '__init__', '__init_subclass__', '__int__', '__le__', '__lt__', '__mod__', '__mul__', '__ne__', '__neg__', '__new__', '__pos__', '__pow__', '__radd__', '__rdivmod__', '__reduce__', '__reduce_ex__', '__repr__', '__rfloordiv__', '__rmod__', '__rmul__', '__rpow__', '__rsub__', '__rtruediv__', '__setattr__', '__sizeof__', '__str__', '__sub__', '__subclasshook__', '__truediv__', 'conjugate', 'imag', 'real']

python中如何使用复数

5、同样复数的__add__()属性也不会改变a的值,a.__add__(x)会返回a和x的和。注意x为一个单位的虚值时不能写成j(这样j就是一个变量),而要写成1j。

python中如何使用复数
© 2025 智德知识库
信息来自网络 所有数据仅供参考
有疑问请联系站长 site.kefu@gmail.com