0% found this document useful (0 votes)
10 views

function of math module

math module in python

Uploaded by

ansuljoshi8456
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
10 views

function of math module

math module in python

Uploaded by

ansuljoshi8456
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

Functions of math module

Arithmetic Functions:

 math.ceil(x)

o Returns the smallest integer greater than or equal to x.

 math.floor(x)

o Returns the largest integer less than or equal to x.

 math.trunc(x)

o Truncates x to an integer (removes the fractional part).

Power and Logarithmic Functions:

 math.pow(x, y)

o Returns x raised to the power of y (x**y).

 math.sqrt(x)

o Returns the square root of x.

 math.exp(x)

o Returns e raised to the power of x (exponential function).

 math.log(x, base)

o Returns the logarithm of x to the specified base (default is natural log if base is
omitted).

 math.log10(x)

o Returns the base-10 logarithm of x.

 math.log2(x)

o Returns the base-2 logarithm of x.

Trigonometric Functions:

 math.sin(x)

o Returns the sine of x (angle in radians).

 math.cos(x)

o Returns the cosine of x (angle in radians).

 math.tan(x)

o Returns the tangent of x (angle in radians).


Functions of math module
 math.asin(x)

o Returns the arc sine of x (angle in radians).

 math.acos(x)

o Returns the arc cosine of x (angle in radians).

 math.atan(x)

o Returns the arc tangent of x (angle in radians).

 math.atan2(y, x)

o Returns the arc tangent of y/x, considering the signs of both arguments (angle in
radians).

Hyperbolic Functions:

 math.sinh(x)

o Returns the hyperbolic sine of x.

 math.cosh(x)

o Returns the hyperbolic cosine of x.

 math.tanh(x)

o Returns the hyperbolic tangent of x.

 math.asinh(x)

o Returns the inverse hyperbolic sine of x.

 math.acosh(x)

o Returns the inverse hyperbolic cosine of x.

 math.atanh(x)

o Returns the inverse hyperbolic tangent of x.

Angle Conversion:

 math.degrees(x)

o Converts angle x from radians to degrees.

 math.radians(x)

o Converts angle x from degrees to radians.

Miscellaneous Functions:
Functions of math module
 math.factorial(x)

o Returns the factorial of x (where x must be a non-negative integer).

 math.gamma(x)

o Returns the gamma function of x.

 math.lgamma(x)

o Returns the natural logarithm of the absolute value of the gamma function of x.

Constants:

 math.pi

o The mathematical constant π (approximately 3.14159).

 math.e

o The mathematical constant e (approximately 2.71828).

 math.tau

o The mathematical constant τ (approximately 6.28318, which is 2π).

 math.inf

o Positive infinity.

 math.nan

o Not a Number (NaN).

You might also like