Python math Module Functions

Python provides a variety of mathematical functions through the math module. These functions make it easy to perform common mathematical operations. Below is a list of some commonly used math functions, along with their descriptions and links to detailed guides for each function.

Python Math Functions Table

Function Description
acosh() Returns the inverse hyperbolic cosine of a number.
asin() Returns the inverse sine of a number.
atan() Returns the inverse tangent of a number.
atan2() Returns the inverse tangent of y/x in radians.
atanh() Returns the inverse hyperbolic tangent of a number.
ceil() Rounds a number up to the nearest integer.
comb() Returns the number of ways to choose k items from n items without repetition and without order.
copysign() Returns a float consisting of the value of the first parameter and the sign of the second parameter.
cos() Returns the cosine of a number.
cosh() Returns the hyperbolic cosine of a number.
degrees() Converts an angle from radians to degrees.
dist() Returns the Euclidean distance between two points (p and q), where p and q are the coordinates of that point.
erf() Returns the error function of a number.
exp() Returns e raised to the power of a number.
fabs() Returns the absolute value of a number.
factorial() Returns the factorial of a number.
floor() Rounds a number down to the nearest integer.
fmod() Returns the remainder of dividing the first number by the second number.
frexp() Returns the mantissa and exponent of a number as a pair (m, e).
fsum() Returns the sum of all items in an iterable (accurately).
gamma() Returns the Gamma function at x.
hypot() Returns the Euclidean norm.
isclose() Checks whether two values are close to each other.
isfinite() Checks whether a number is finite.
isinf() Checks whether a number is infinite.
isnan() Checks whether a value is NaN (not a number).
isqrt() Returns the integer square root of a number.
lcm() Returns the least common multiple of two integers.
ldexp() Returns the result of x * (2**i).
lgamma() Returns the natural logarithm of the absolute value of the Gamma function at x.
log() Returns the natural logarithm of a number, or the logarithm of a number to a specified base.
log10() Returns the base-10 logarithm of a number.
log1p() Returns the natural logarithm of 1+x.
log2() Returns the base-2 logarithm of a number.
modf() Returns the fractional and integer parts of a number.
perm() Returns the number of ways to choose k items from n items with order and without repetition.
pow() Returns the value of x raised to the power of y.
prod() Returns the product of all the elements in an iterable.
radians() Converts a degree value to radians.
remainder() Returns the IEEE 754-style remainder of x with respect to y.
sin() Returns the sine of a number.
sinh() Returns the hyperbolic sine of a number.
sqrt() Returns the square root of a number.
tan() Returns the tangent of a number.
tanh() Returns the hyperbolic tangent of a number.
trunc() Returns the truncated integer parts of a number.

For more detailed information on each function, refer to the official Python documentation.

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top