English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
Conozca todas las funciones matemáticas disponibles en Python y cómo usarlas en sus programas.
math MóduloEs un módulo estándar de Python y siempre está disponible. Para usar funciones matemáticas en este módulo, debe importar el módulo import math.
Proporciona acceso a las funciones de la biblioteca C básica. Por ejemplo,
# Cálculo de raíz cuadrada import math math.sqrt(4
Este módulo no admite el tipo de datos complex. ElMódulo CMATHEs una correspondencia compleja.
Esta es una lista de todas las funciones y propiedades definidas en el módulo math, y se explica brevemente su función.
Función | Descripción |
---|---|
ceil(x) | Devuelve el entero más pequeño o igual que x |
copysign(x, y) | Devuelve x con el signo de y |
fabs(x) | Devuelve el valor absoluto de x |
factorial(x) | Devuelve el factorial de x |
floor(x) | Devuelve el entero mayor o igual que x |
fmod(x, y) | Devuelve el residuo cuando x se divide por y |
frexp(x) | Devuelve el cociente y el exponente de x como par (m, e) |
fsum(iterable) | Devuelve el valor flotante exacto y el exponente de la secuencia iteradora |
isfinite(x) | Si x no es infinito ni NaN (no es un número), devuelve True |
isinf(x) | If x is positive or negative infinity, return True |
isnan(x) | If x is NaN, return True |
ldexp(x, i) | Return x *(2 ** i) |
modf(x) | Return the fractional and integer parts of x |
trunc(x) | Return the truncated integer value of x |
exp(x) | Return e ** x |
expm1(x) | Return e ** x-1 |
log(x[, base]) | Return the logarithm of x to the base (default is e) |
log1p(x) | Return1 + The natural logarithm of x |
log2(x) | Return the logarithm of x with base2Logarithm to the base |
log10(x) | Return the logarithm of x with base10Logarithm to the base |
pow(x, y) | Return x to the power y |
sqrt(x) | Return the square root of x |
acos(x) | Return the arccosine of x |
asin(x) | Return the arcsine of x |
atan(x) | Return the arctangent of x |
atan2(y, x) | Return atan(y / x) |
cos(x) | Return the cosine of x |
hypot(x, y) | Return the Euclidean norm sqrt(x * x + y * y) |
sin(x) | Return the sine of x |
tan(x) | Return the tangent of x |
degrees(x) | Convert the angle x from radians to degrees |
radians(x) | Convert the angle x from degrees to radians |
acosh(x) | Return the inverse hyperbolic cosine value at x |
asinh(x) | Return the inverse hyperbolic sine value at x |
atanh(x) | Return the inverse hyperbolic tangent value at x |
cosh(x) | Return the hyperbolic cosine value at x |
sinh(x) | Return the hyperbolic cosine value at x |
tanh(x) | Return the hyperbolic tangent at x |
erf(x) | Return the error function at x |
erfc(x) | Return the complementary error function at x |
gamma(x) | Return the Gamma function at x |
lgamma(x) | Return the natural logarithm of the absolute value of the Gamma function at x |
pi | Mathematical constant, the ratio of the circumference of a circle to its diameter(3.14159 ...) |
e | Mathematical constant e(2.71828 ...) |
Access this page to learn about Python 3All defined inMathematical functions.