Python - Math Module

Python - Math Module


The Python has a number of methods and functions that are available for mathematical operation. These methods and functions are listed below in alphabetical order. For more details about any one of these, please visit its page.

Python Math Functions
MethodDescription
Rounds the given number up to the nearest integer.
The Python has a number of methods and functions that are available for mathematical operation. These methods and functions are listed below in alphabetical order. For more details about any one of these, please visit its page. Returns a number with magnitude of first argument and sign of second argument.
Returns the absolute value of a given number
Returns factorial of a given integer.
Python Math Functions Rounds the given number down to the nearest integer.
getExponent(x) Returns the unbiased exponent used in x
IEEEremainder(x, y) Computes the remainder operation on x and y as prescribed by the IEEE 754 standard
Check if the argument is positive or negative infinity.
Method Check if the argument is a NaN (not a number).
nextAfter(x, y) Returns the floating point number adjacent to x in the direction of y
nextUp(x) Returns the floating point value adjacent to x in the direction of positive infinity
random() Returns a random number between 0 and 1
round(x) Returns the value of x rounded to its nearest integer
rint() Returns the double value that is closest to x and equal to a mathematical integer
signum(x) Returns the sign of x
ulp(x) Returns the size of the unit of least precision (ulp) of x

Power & Logarithmic Functions

FunctionsDescription
Description Returns the exponent of e.
Returns the exponent of e minus 1, i.e., ex-1.
ceil() Returns the natural logarithm of a given number.
Returns the natural logarithm of (1+number), i.e., log(1+number).
Rounds the given number up to the nearest integer. Returns the base-2 logarithm of a given number.
Returns the base-10 logarithm of a given number.
copySign() Returns base raised to the power of exponent.
Returns the square root of the given number.

Trigonometric Functions

FunctionsDescription
Returns a number with magnitude of first argument and sign of second argument. Returns the trigonometric sine of an angle in radians.
Returns the trigonometric cosine of an angle in radians.
fabs() Returns the trigonometric tangent of an angle in radians.
Returns the arc sine of a value.
Returns the absolute value of a given number Returns the arc cosine of a value.
Returns the arc tangent of a value.
factorial() Returns the angle theta from the conversion of rectangular coordinates (x, y) to polar coordinates (r, theta).
Returns square root of sum of squares of two arguments, i.e., sqrt(x2 +y2).

Hyperbolic Functions

FunctionsDescription
Returns factorial of a given integer. Returns the hyperbolic sine of a value.
Returns the hyperbolic cosine of a value.
floor() Returns the hyperbolic tangent of a value.
Returns the inverse hyperbolic sine of a value
Rounds the given number down to the nearest integer. Returns the inverse hyperbolic cosine of a value
Returns the inverse hyperbolic tangent of a value

Angular Conversion

FunctionsDescription
getExponent(x) Returns an angle measured in radians to an approx. equivalent angle measured in degrees.
Returns an angle measured in degrees to an approx. equivalent angle measured in radians.

Special Functions

FunctionsDescription
Returns the unbiased exponent used in x Returns the error function of the argument.
Returns the complementary error function of the argument.