Skip to content

math

Supported functions and constants in the Python standard library math module.

e: float module-attribute

The mathematical constant e.

inf: float module-attribute

Positive infinity.

pi: float module-attribute

The mathematical constant pi.

tau: float module-attribute

The mathematical constant tau.

acos(x: float) -> float

Compute the arccosine of x in radians.

Parameters:

Name Type Description Default
x float

A value between -1 and 1.

required

asin(x: float) -> float

Compute the arcsine of x in radians.

Parameters:

Name Type Description Default
x float

A value between -1 and 1.

required

atan(x: float) -> float

Compute the arctangent of x in radians.

Parameters:

Name Type Description Default
x float

A numeric value.

required

atan2(y: float, x: float) -> float

Compute the arctangent of y / x in radians, considering the quadrant.

Parameters:

Name Type Description Default
y float

The y-coordinate.

required
x float

The x-coordinate.

required

ceil(x: float) -> int

Return the smallest integer greater than or equal to x.

Parameters:

Name Type Description Default
x float

A numeric value.

required

cos(x: float) -> float

Compute the cosine of x.

Parameters:

Name Type Description Default
x float

The angle in radians.

required

cosh(x: float) -> float

Compute the hyperbolic cosine of x.

Parameters:

Name Type Description Default
x float

A numeric value.

required

degrees(x: float) -> float

Convert radians to degrees.

Parameters:

Name Type Description Default
x float

An angle in radians.

required

floor(x: float) -> int

Return the largest integer less than or equal to x.

Parameters:

Name Type Description Default
x float

A numeric value.

required

log(x: float, base: float = ...) -> float

Compute the logarithm of x to the given base.

Parameters:

Name Type Description Default
x float

The number for which to compute the logarithm.

required
base float

The base of the logarithm. If omitted, returns the natural logarithm of x.

...

radians(x: float) -> float

Convert degrees to radians.

Parameters:

Name Type Description Default
x float

An angle in degrees.

required

sin(x: float) -> float

Compute the sine of x.

Parameters:

Name Type Description Default
x float

The angle in radians.

required

sinh(x: float) -> float

Compute the hyperbolic sine of x.

Parameters:

Name Type Description Default
x float

A numeric value.

required

sqrt(x: float) -> float

Compute the square root of x.

Parameters:

Name Type Description Default
x float

A non-negative numeric value.

required

tan(x: float) -> float

Compute the tangent of x.

Parameters:

Name Type Description Default
x float

The angle in radians.

required

tanh(x: float) -> float

Compute the hyperbolic tangent of x.

Parameters:

Name Type Description Default
x float

A numeric value.

required

trunc(x: float) -> int

Truncate x to the nearest integer towards zero.

Parameters:

Name Type Description Default
x float

A numeric value.

required