Math Module
Python has a built-in math
module that we can use for mathematical tasks. This module provides access to the mathematical functions defined by the C standard.
The following functions are provided by this module. Except when explicitly noted otherwise, all return values are float
s.
Math Module
- math.ceil()
- Takes in a numeric data type and rounds the value up to the nearest integer.
- math.cos()
- Returns the cosine of the angle.
- math.exp()
- Returns e raised to the power of x.
- math.log()
- Returns the natural logarithm of n.
- math.pow()
- Returns the float value of x raised to the power of y.
- math.sin()
- Returns the sine of input numeric x, measured in radian value.
- math.sqrt()
- Returns the square root of numeric input x.
- math.tan()
- Returns the tangent of input numeric x, measured in radian value.