Home >>Python math Module
Python math module is used for mathematical tasks, which includes trigonometric functions, logarithmic functions, representation functions, etc. it has a set of methods and constant.
Method | Description |
---|---|
math.acos(x) | It is used to Returns the arc cosine value of x |
math.acosh(x) | Math method Returns the hyperbolic arc cosine of x |
math.asin(x) | The arc sine of x returned by this method |
math.asinh(x) | the hyperbolic arc sine of x returned |
math.atan(x) | It is used to Returns the arc tangent value of x |
math.atan2(y,x) | It Returns the arc tangent of y/x in radians |
math.atanh(x) | This method is used to Returns the hyperbolic arctangent value of x |
math.ceil(x) | In this method, rounds a number upwards to the nearest integer, and returns the result |
math.comb(n, k) | Used to Returns the number of ways to choose k items from n items without repetition |
math.copysign(x, y) | It is used to Returns a float consisting of the value of the first parameter and the sign of the second parameter |
math.cos(x) | The cosine of x is returned by this method |
math.cosh(x) | This method Returns the hyperbolic cosine of x |
math.degrees(x) | It is used to Converts an angle from radians to degrees |
math.dist(p,q) | It Calculates the euclidean distance between two specified points (x and y) |
math.erf(x) | It is used to returns the error function of x |
math.erfc(x) | It is used ton returns the complementary error function of x |
math.exp(x) | This method is used to Returns the value of Ex, where E is Euler's number (approximately 2.718281...), and x is the number passed to it |
math.expm1(x) | It Returns the value of Ex - 1, where E is Euler's number (approximately 2.718281...), and x is the number passed to it |
math.fabs(x) | This method Returns the absolute value of a number |
math.factorial() | The factorial of a number returns by this method |
math.floor(x) | It helps to Rounds a number downwards to the nearest integer, and returns the result |
math.fmod(x, y) | It is used to Returns the remainder of specified numbers when a number is divided by another number |
math.frexp() | It is used Returns the mantissa and the exponent, of a specified value |
math.fsum(iterable) | It Returns the sum of all items in an iterable (arrays ,tuples, lists, etc.) |
math.gamma(x) | The gamma value of x returned by using this method |
math.gcd() | It is used to Returns the highest value that can divide two integers |
math.hypot() | It is used to Find the Euclidean distance from the origin |
math.isclose() | It helps to checks whether two values are close, or not |
math.isfinite(x) | It helps to checks whether x is a finite number |
math.isinf(x) | It is used to check whether x is a positive or negative infinity |
math.isnan(x) | It is used to checks whether x is NaN (not a number) |
math.isqrt(n) | It is used to returns the nearest integer square root of the n value |
math.ldexp(x, i) | It is used to returns the expression x * 2i |
math.lgamma(x) | It is used to returns the log gamma value of x |
math.log(x, base) | It is used to returns the natural logarithm of a number |
math.log10(x) | The base-10 logarithm of x returns by using this method |
math.log1p(x) | It helps to returns the natural logarithm of 1+x |
math.log2(x) | It is used to returns the base-2 logarithm of x |
math.perm(n, k) | It is used to returns the number of ways to choose k items from n items |
math.pow(x, y) | This method returns the value of x to the power of y |
math.prod(iterable, *, start=1) | Returns the product of an iterable (lists, array, tuples, etc.) |
math.radians(x) | It is used to converts a degree value (n) to radians |
math.remainder(x, y) | It is used to returns the closest value that can make numerator completely divisible by the denominator |
math.sin(x) | The sine of x returns by this method |
math.sinh(x) | This method returns the hyperbolic sine of x |
math.sqrt(x) | This method returns the square root of x |
math.tan(x) | This method returns the tangent of x |
math.tanh(x) | This method returns the hyperbolic tangent of x |
math.trunc(x) | This method returns the truncated integer parts of x |
Constant | Description |
---|---|
math.e | This method returns Euler's number (2.7182...) |
math.inf | This method returns a floating-point positive infinity |
math.nan | This method returns a floating-point NaN (Not a Number) value |
math.pi | This method returns PI (3.1415...) |
math.tau | This method returns tau (6.2831...) |