Python 中的 atan2(y, x)函数

首页 / Python2入门教程 / Python 中的 atan2(y, x)函数

Python atan2()返回atan(y/x),以弧度表示。

atan2(y, x) - 语法

atan2(y, x)
  • y  -  这必须是一个数值。

  • x  -  这必须是一个数值。

atan2(y, x) - 返回值

此方法返回atan(y/x),以弧度表示。

atan2(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

祝学习愉快!(内容编辑有误?请选中要编辑内容 -> 右键 -> 修改 -> 提交!)

技术教程推荐

Service Mesh实践指南 -〔周晶〕

趣谈Linux操作系统 -〔刘超〕

手机摄影 -〔@随你们去〕

手把手教你玩音乐 -〔邓柯〕

说透芯片 -〔邵巍〕

大数据经典论文解读 -〔徐文浩〕

超级访谈:对话汤峥嵘 -〔汤峥嵘〕

快手 · 移动端音视频开发实战 -〔展晓凯〕

深入浅出可观测性 -〔翁一磊〕

好记忆不如烂笔头。留下您的足迹吧 :)