Python Mathematical Function
Functions can do anything, but their primary use pattern is taking parameters and returning values . The math module provides some basic mathematical functions for working with floating-point numbers. Using Math module in python, we can access to different mathematical functions already defined by the C standard. These functions perform various arithmetic operations like calculating the floor, ceiling, or absolute value of a number using the floor(x), ceil(x), and fabs(x) functions respectively. Here is the list of all the functions and attributes defined in math module with a brief explanation of what they do. ceil(x)Return the ceiling of x as a float, the smallest integer value greater than or equal to x.
Return x with the sign of y. On a platform that supports signed zeros, copysign(1.0, -0.0) returns -1.0. (New in version 2.6.)
This function will return an absolute or positive value.
Returns the factorial of x
The method floor() returns floor of x - the largest integer not greater than x.
This function returns x % y.
Returns the mantissa and exponent of x as the pair (m, e)
This function adds the items of an iterable and returns the sum.
This function is either True or False.
This function Returns True if x is a positive or negative infinity
Returns True if x is a NaN
This function returns the result of x * (2**i) which is an inverse of the frexp() function.
This function returns the fractional and integer parts of x in a two-item tuple. Both parts have the same sign as x. The integer part is returned as a float.
This function returns the truncated integer of x.
This function returns exponential of x: ex.
This function returns x raised to the power y
Returns the square root of x
Mathematical constant, the ratio of circumference of a circle to it's diameter (3.14159...)
mathematical constant e (2.71828...)
- Keywords in Python
- Python Operator - Types of Operators in Python
- Python Variables and Data Types
- Python Shallow and deep copy operations
- Python Datatype conversion
- Basic String Operations in Python
- Python Substring examples
- How to check if Python string contains another string
- Check if multiple strings exist in another string : Python
- Memory Management in Python
- Python Identity Operators
- What is a None value in Python?
- How to Install a Package in Python using PIP
- How to update/upgrade a package using pip?
- How to Uninstall a Package in Python using PIP
- How to call a system command from Python
- How to use f-string in Python
- Python Decorators (With Simple Examples)
- Python Timestamp Examples