Python Math Module














































Python Math Module



                    PYTHON MATH MODULE

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.


ceil():-

ceil() function returns the smallest integral value greater than the number. If the number is already an integer, the same number is returned.

Example:-


Output:-



floor():-

floor() function returns the greatest integral value smaller than the number. If the number is already an integer, the same number is returned.

Example:-


Output:-



fabs():-

fabs() function returns the absolute value of the number.

Example:-

Output:-



factorial():-

 factorial() function returns the factorial of the number. An error message is displayed if the number is not integral.

Example:-


Output:-



pow(x,y):-

pow method returns the power of the x corresponding to the value of y. If the value of x is negative or y is not an integer value then it raises a ValueError.

Example:-


Output:-



log():-

log method returns the natural logarithm of a given number. It is calculated to the base e.

Example:-


Output:-



sqrt():-

 sqrt function returns the square root of the number.

Example:-


Output:- 



This is all about the Python Math module.






Comments