讲解对象:python3 三角函数

作者:融水公子 rsgz

常见的三角函数

#!/usr/bin/python3
import math

反余弦弧度值

math.acos(0.64)# 0.8762980611683406
math.acos(0)# 1.5707963267948966

反正弦弧度值

math.asin(0.64)# 0.694498265626556
math.asin(0)# 0.0

反正切弧度值

math.atan(0.64)# 0.5693131911006619
math.atan(0)# 0.0

返回给定的 X 及 Y 坐标值的反正切值

math.atan2(-0.50,-0.50)# -2.356194490192345
math.atan2(0.50,0.50)# 0.7853981633974483

返回x的弧度的余弦值

math.cos(3)# -0.9899924966004454
math.cos(-3)# -0.9899924966004454

返回欧几里德范数 sqrt(x*x + y*y)

math.hypot(3, 2)# 3.605551275463989
math.hypot(-3, 3)# 4.242640687119285

返回的x弧度的正弦值

math.sin(3)# 0.1411200080598672
math.sin(-3)# -0.1411200080598672

返回x弧度的正切值

math.tan(3)# -0.1425465430742778
math.tan(-3)# 0.1425465430742778

弧度转换为角度

math.degrees(3)# 171.88733853924697
math.degrees(-3)# -171.88733853924697

角度转换为弧度

math.radians(3)# 0.05235987755982989
math.radians(-3)# -0.05235987755982989

----