Compute trigonometric ratios (angles are in radians and degrees)
kodingwindow@kw:~$ python3
...
>>> import math
>>> math.pi
3.141592653589793

math.degrees(math.pi)
180.0

>>> math.radians(180)
3.141592653589793

>>> math.sin(0) 0.0 >>> math.cos(30) 0.15425144988758405 >>> math.tan(45) 1.6197751905438615
>>> math.sin(math.radians(0)) 0.0 >>> math.cos(math.radians(30)) 0.8660254037844387 >>> math.tan(math.radians(45)) 0.9999999999999999
Compute inverse trigonometric ratios
>>> math.asin(0)
0.0

>>> math.acos(0)
1.5707963267948966

>>> math.atan(1)
0.7853981633974483
Compute hyperbolic trigonometric ratios
>>> math.sinh(0)
0.0

>>> math.cosh(0)
1.0

>>> math.tanh(1)
0.7615941559557649
Advertisement