python math.tan()方法,求三角函数正切值
math.tan()方法
python math module中的tan()方法,可以求取某一个用弧度制度量的角度的正切值。如果已知的是角度制的值,比如45°,则在python的编程过程中,可以通过如下代码进行转换:
x*math.pi / 180
tan()语法
tan(x, /)
python源码的介绍:
Return the tangent of x (measured in radians).
参数
参数 | 描述 |
---|---|
x | measured in radians,即以弧度制测量的角度值。 |
返回值
python浮点数类型值
tan()实例代码
在数学上,三角函数中45°角的正切值为1,下面的python代码将通过math.tan()方法来求取45°角的正切值:
>>> import math
>>> math.tan(45*math.pi / 180)
0.9999999999999999