Math Library
Some most popular functions have been defined in math libraries,with the help of this library we just have to call the function to perform specific tasks. Let’s see some basic function of this library.
- Finding the Value of Pie
>>> import math >>> math.pi 3.141592653589793 >>>
- Finding the value of e(Euler’s number)
- Use of SIN,COS,TAN
- Log function
- math.pow()
- Math.sqrt()
- Finding ceil and floor value
>>> import math >>> math.e 2.718281828459045 >>>
>>> import math >>> math.e 2.718281828459045 >>> math.sin(2.718281828459045) 0.41078129050290885 >>> math.cos(2.718281828459045) -0.9117339147869651 >>> math.tan(2.718281828459045) -0.4505495340698077 >>>
>>> import math >>> math.log(20) 2.995732273553991 >>> math.log10(20) 1.3010299956639813 >>>
To get the power of the given number
>>> import math >>> math.pow(34,32) 1.0170102859315412e+49 >>>
To find the square root the given value
>>> math.sqrt(20) 4.47213595499958 >>>
>>> math.ceil(4.55) 5 >>> math.floor(4.55) 4 >>>