前提:import math
函數介紹:
degrees(x) 將x從弧度轉換爲度數。
radians(x) 將x從度數轉換爲弧度。
例如:
>>> import math
>>> math.degrees(math.pi/2)
90.0
>>> math.radians(90)
1.5707963267948966
>>> math.pi/2
1.5707963267948966
sin(x) 返回x的正弦值(以弧度表示)。
sinh(x) 返回x的雙曲正弦。
asin(x) 返回x的反正弦(以弧度表示)。
asinh(x) 返回x的反雙曲正弦值。
例如:
>>> import math
>>> math.pi
3.141592653589793
>>> x=math.pi/2
>>> math.sin(x)
1.0
>>> math.sinh(x)
2.3012989023072947
>>> math.asin(0)
0.0
>>> math.asin(1)
1.5707963267948966
>>> math.asinh(1)
0.8813735870195429
cos(x) 返回x的餘弦值(以弧度表示)。
cosh(x) 返回x的雙曲餘弦值。
acos(x) 返回x的反餘弦(以弧度表示)。
acosh(x) 返回x的反雙曲餘弦值。
例如:
>>> import math
>>> x=math.pi/2
>>> math.cos(x)
6.123233995736766e-17
>>> math.cosh(x)
2.5091784786580567
>>> math.acos(x)
>>> math.acos(0)
1.5707963267948966
>>> math.acosh(1)
0.0
tan(x) 返回x的正切(以弧度表示)。
tanh(x) 返回x的雙曲正切值。
atan(x) 返回x的反正切(以弧度表示)。
atan2(y,x) 返回y / x的反正切(以弧度表示)。與atan(y / x)不同,考慮x和y的符號。
atanh(x) 返回x的反雙曲正切。
例如:
>>> import math
>>> x=math.pi/2
>>> math.tan(x)
1.633123935319537e+16
>>> math.tanh(x)
0.9171523356672744
>>> math.atan(0)
0.0
>>> math.atanh(0.5)
0.5493061443340549
>>> math.atan2(-1,2)
-0.4636476090008061