comb(n, k):
Number of ways to choose k items from n items without repetition and without order
factorial(n):
n factorial
gcd(*integers):
Greatest common divisor of the integer arguments
isqrt(n):
Integer square root of a nonnegative integer n
lcm(*integers)
Least common multiple of the integer arguments
perm(n, k)
Number of ways to choose k items from n items without repetition and with order
Floating point arithmetic
ceil(x)
Ceiling of x, the smallest integer greater than or equal to x
fabs(x)
Absolute value of x
floor(x)
Floor of x, the largest integer less than or equal to x
fma(x, y, z)
Fused multiply-add operation: (x * y) + z
fmod(x, y)
Remainder of division x / y
modf(x)
Fractional and integer parts of x
remainder(x, y)
Remainder of x with respect to y
trunc(x)
Integer part of x
Floating point manipulation functions
copysign(x, y)
Magnitude (absolute value) of x with the sign of y
frexp(x)
Mantissa and exponent of x
isclose(a, b, rel_tol, abs_tol)
Check if the values a and b are close to each other
isfinite(x)
Check if x is neither an infinity nor a NaN
isinf(x)
Check if x is a positive or negative infinity
isnan(x)
Check if x is a NaN (not a number)
ldexp(x, i)
x * (2**i), inverse of function frexp()
nextafter(x, y, steps)
Floating-point value steps steps after x towards y
ulp(x)
Value of the least significant bit of x
Power, exponential and logarithmic functions
cbrt(x)
Cube root of x
exp(x)
e raised to the power x
exp2(x)
2 raised to the power x
expm1(x)
e raised to the power x, minus 1
log(x, base)
Logarithm of x to the given base (e by default)
log1p(x)
Natural logarithm of 1+x (base e)
log2(x)
Base-2 logarithm of x
log10(x)
Base-10 logarithm of x
pow(x, y)
x raised to the power y
sqrt(x)
Square root of x
Summation and product functions
dist(p, q)
Euclidean distance between two points p and q given as an iterable of coordinates
fsum(iterable)
Sum of values in the input iterable
hypot(*coordinates)
Euclidean norm of an iterable of coordinates
prod(iterable, start)
Product of elements in the input iterable with a start value
sumprod(p, q)
Sum of products from two iterables p and q
Angular conversion
degrees(x)
Convert angle x from radians to degrees
radians(x)
Convert angle x from degrees to radians
Trigonometric functions
acos(x)
Arc cosine of x
asin(x)
Arc sine of x
atan(x)
Arc tangent of x
atan2(y, x)
atan(y / x)
cos(x)
Cosine of x
sin(x)
Sine of x
tan(x)
Tangent of x
Hyperbolic functions
acosh(x)
Inverse hyperbolic cosine of x
asinh(x)
Inverse hyperbolic sine of x
atanh(x)
Inverse hyperbolic tangent of x
cosh(x)
Hyperbolic cosine of x
sinh(x)
Hyperbolic sine of x
tanh(x)
Hyperbolic tangent of x
Special functions
erf(x)
Error function at x
erfc(x)
Complementary error function at x
gamma(x)
Gamma function at x
lgamma(x)
Natural logarithm of the absolute value of the Gamma function at x
Constants
pi
π = 3.141592…
e = 2.718281…
tau
τ = 2π = 6.283185…
inf
Positive infinity
nan
“Not a number” (NaN)