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.

  1. Finding the Value of Pie
    >>> import math
    >>> math.pi
    3.141592653589793
    >>>
  2. Finding the value of e(Euler’s number)
  3. >>> import math
    >>> math.e
    2.718281828459045
    >>>
    
  4. Use of SIN,COS,TAN
  5. >>> import math
    >>> math.e
    2.718281828459045
    >>> math.sin(2.718281828459045)
    0.41078129050290885
    >>> math.cos(2.718281828459045)
    -0.9117339147869651
    >>> math.tan(2.718281828459045)
    -0.4505495340698077
    >>>
    
  6. Log function
  7. >>> import math
    >>> math.log(20)
    2.995732273553991
    >>> math.log10(20)
    1.3010299956639813
    >>>
    
  8. math.pow()
  9. To get the power of the given number

    >>> import math
    >>> math.pow(34,32)
    1.0170102859315412e+49
    >>> 
    
  10. Math.sqrt()
  11. To find the square root the given value

    >>> math.sqrt(20)
    4.47213595499958
    >>>
    
  12. Finding ceil and floor value
  13. >>> math.ceil(4.55)
    5
    >>> math.floor(4.55)
    4
    >>>
    
Subscribe Now