描述
Python数法atan2()返回 atan(y /x),以弧度为单位。
用法
以下是语法atan2()方法 -
atan2(y, x)
注意− 此函数不可直接访问,因此需要导入 math 模块,然后使用 math 静态对象调用此函数。
参数
y- 这必须是一个数值。
x- 这必须是一个数值。
返回值
此方法以弧度返回 atan(y /x)。
示例
以下示例显示了 atan2() 方法的用法。
#!/usr/bin/python
import math
print "atan2(-0.50,-0.50):", math.atan2(-0.50,-0.50)
print "atan2(0.50,0.50):", math.atan2(0.50,0.50)
print "atan2(5,5):", math.atan2(5,5)
print "atan2(-10,10):", math.atan2(-10,10)
print "atan2(10,20):", math.atan2(10,20)
当我们运行上面的程序时,它会产生以下结果 -
atan2(-0.50,-0.50): -2.35619449019 atan2(0.50,0.50): 0.785398163397 atan2(5,5): 0.785398163397 atan2(-10,10): -0.785398163397 atan2(10,20): 0.463647609001
相关用法
- Python Number atan()用法及代码示例
- Python Number acos()用法及代码示例
- Python Number asin()用法及代码示例
- Python Number abs()用法及代码示例
- Python Number randrange()用法及代码示例
- Python Number choice()用法及代码示例
- Python Number sqrt()用法及代码示例
- Python Number floor()用法及代码示例
- Python Number round()用法及代码示例
- Python Number shuffle()用法及代码示例
- Python Number exp()用法及代码示例
- Python Number cmp()用法及代码示例
- Python Number max()用法及代码示例
- Python Number min()用法及代码示例
- Python Number sin()用法及代码示例
- Python Number log10()用法及代码示例
- Python Number pow()用法及代码示例
- Python Number uniform()用法及代码示例
- Python Number ceil()用法及代码示例
- Python Number cos()用法及代码示例
注:本文由堆栈答案筛选整理自 Python Number atan2() Method。非经特殊声明,原始代码版权归原作者所有,本译文未经允许或授权,请勿转载或复制。