If trigonometry is your thing, you’ll be glad to know there are plenty of trig functions in the math
module as well. Table 5.4 shows what’s available.
TABLE 5.4 Python Trigonometric Functions
Notice that the trigonometric functions require you to specify the parameter in radians. If you’re
working with degrees, don’t forget to convert first, like this:
Click here to view code image
>>> angle = 90
>>> radangle = math.radians(angle)
>>> anglesine = math.sin(radangle)
>>> print(anglesine)
1.0
>>>
Now you’re all set to start working on your triangle calculations!
Hyperbolic Functions
Somewhat related to the trigonometric functions are hyperbolic functions. Whereas trigonometric
functions are derived from circular calculations, hyperbolic functions are derived from a hyperbola
calculation. Table 5.5 shows the hyperbolic functions that the math module supports.
TABLE 5.5 Python Hyperbolic Functions
Just as with the trigonometric functions, you must specify the hyperbolic function parameters in
radians.
Statistical Math Functions