python-三角函数

三角函数

导入import math模块
1.cos()

需借助 π,cos(45°) 应该表示成 cos(π/4)

print(math.cos(math.pi/4))
print( math.sqrt(2)/2 )
2.sin()

sin(45°) 应该表示成 sin(π/4)

print( math.sin( math.pi/4 ) )
3.tan()

tan(45°) 应该表示成 tan(π/4)

print( math.tan( math.pi/4 ) )
4.math.degrees()

弧度转为角度

print( math.degrees( math.pi/2 ) )
5.math.radians()

角度变成弧度值

print( math.radians(45) ) # π/4
print( math.pi/4 )

你可能感兴趣的:(Python基本的函数和方法,python)