Python math module is defined as the most famous mathematical functions, which includes trigonometric functions, representation functions, logarithmic functions, etc. Furthermore, it also defines two mathematical constants, i.e., Pie and Euler number, etc.
Pie (n): It is a well-known mathematical constant and defined as the ratio of circumstance to the diameter of a circle. Its value is 3.141592653589793.
Euler's number(e): It is defined as the base of the natural logarithmic, and its value is 2.718281828459045.
There are different math modules which are given below:
math.log()
This method returns the natural logarithm of a given number. It is calculated to the base e.
math.log10()
This method returns base 10 logarithm of the given number and called the standard logarithm.
math.exp()
This method returns a floating-point number after raising e to the given number.
math.pow(x,y)
math.floor(x)
This method returns the floor value of the x. It returns the less than or equal value to x.
math.ceil(x)
This method returns the ceil value of the x. It returns the greater than or equal value to x.
math.fabs(x)
This method returns the absolute value of x.
math.factorial()
This method returns the factorial of the given number x. If x is not integral, it raises a ValueError.
math.modf(x)
This method returns the fractional and integer parts of x. It carries the sign of x is float.
0 Comments