Python/ref cmath polar

来自菜鸟教程
机器人讨论 | 贡献2020年10月29日 (四) 08:49的版本 (机器人:添加分类Python基础教程
(差异) ←上一版本 | 最后版本 (差异) | 下一版本→ (差异)
跳转至:导航、​搜索

<languages />

Python cmath.polar()方法

❮cmath方法

将复数转换为极坐标形式:

    #import cmath for complex number operations 
import cmath

#find 
    the polar coordinates of complex number
print (cmath.polar(2 + 3j))

    print (cmath.polar(1 + 5j))

定义和用法

The cmath.polar() 方法将复数转换为极坐标。它返回模量和相位的元组。

在极坐标中,复数由模数定义 r 和相位角 phi .

句法

    cmath.polar(x)
  

参数值

参数 描述
x 需要。查找极坐标的数字

技术细节

返回值: A

tuple 值,代表极坐标

Python版本: 2.6

❮cmath方法