Python/ref cmath sqrt
来自菜鸟教程
<languages />
Python cmath.sqrt()方法
例
找到复数的平方根:
#Import cmath Library
import cmath
#Return the square root of a
complex number
print (cmath.sqrt(2 + 3j))
print (cmath.sqrt(15))
定义和用法
The
cmath.sqrt()
方法返回复数的平方根。
注意: 该数字必须大于或等于0。
句法
cmath.sqrt(x)
参数值
| 参数 | 描述 |
|---|---|
| x | 需要。找到一个数字的平方根。如果数字小于0,则返回ValueError。如果该值不是数字,则返回TypeError |
技术细节
| 返回值: | A
|
| Python版本: | 1.5 |