From 51c9e75e2daedb5eb71ce396850eba64edb6aa59 Mon Sep 17 00:00:00 2001 From: Joseph Martinot-Lagarde Date: Sun, 20 Oct 2024 19:18:13 +0200 Subject: [PATCH 1/9] Summary for math module with separate tables --- Doc/library/math.rst | 113 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 113 insertions(+) diff --git a/Doc/library/math.rst b/Doc/library/math.rst index dd2ba419b5bd12..ea09ba447dbad7 100644 --- a/Doc/library/math.rst +++ b/Doc/library/math.rst @@ -26,6 +26,119 @@ The following functions are provided by this module. Except when explicitly noted otherwise, all return values are floats. +Summary +------- + +Number-theoretic and representation functions ++++++++++++++++++++++++++++++++++++++++++++++ +======================= =============================================================== +:func:`ceil` Ceiling of *x*, the smallest integer greater than or equal to *x*. +:func:`comb` Number of ways to choose *k* items from *n* items without repetition and without order. +:func:`copysign` Magnitude (absolute value) of *x* with the sign of *y*. +:func:`fabs` Absolute value. +:func:`factorial` *n* factorial. +:func:`floor` Floor of *x*, the largest integer less than or equal to *x*. +:func:`fma` Fused multiply-add operation. +:func:`fmod` XXX. +:func:`frexp` Mantissa and exponent. +:func:`fsum` Accurate floating-point sum of values. +:func:`gcd` Greatest common divisor. +:func:`isclose` Check if the values *a* and *b* are close to each other. +:func:`isfinite` Check if *x* is neither an infinity nor a NaN. +:func:`isinf` Check if if *x* is a positive or negative infinity. +:func:`isnan` Check if if *x* is a NaN (not a number). +:func:`isqrt` Integer square root of a nonnegative integer. +:func:`lcm` Least common multiple. +:func:`ldexp` inverse of function :func:`frexp`. +:func:`modf` Fractional and integer parts. +:func:`nextafter` Floating-point value *steps* steps after *x* towards *y*. +:func:`perm` Number of ways to choose *k* items from *n* items without repetition and with order. +:func:`prod` Product of all the elements. +:func:`remainder` Remainder of *x* with respect to *y*. +:func:`sumprod` Sum of products from two iterables. +:func:`trunc` Integer part. +:func:`ulp` Value of the least significant bit. +======================= =============================================================== + + +Power and logarithmic functions ++++++++++++++++++++++++++++++++ + +======================= =============================================================== +:func:`cbrt` Cube root. +:func:`exp` *e* raised to the power *x*. +:func:`exp2` *2* raised to the power *x*. +:func:`expm1` *e* raised to the power *x*, minus 1. +:func:`log` Logarithm of *x* to the given base (*e* by default). +:func:`log1p` Natural logarithm of *1+x* (base *e*). +:func:`log2` Base-2 logarithm. +:func:`log10` Base-10 logarithm. +:func:`pow` ``x`` raised to the power ``y``. +:func:`sqrt` Square root. +======================= =============================================================== + + +Trigonometric functions ++++++++++++++++++++++++ + +======================= =============================================================== +:func:`acos` Arc cosine. +:func:`asin` Arc sine. +:func:`atan` Arc tangent. +:func:`atan2` ``atan(y / x)``. +:func:`cos` Cosine. +:func:`dist` Euclidean distance. +:func:`hypot` Euclidean norm. +:func:`sin` Sine. +:func:`tan` Tangent. +======================= =============================================================== + + +Angular conversion +++++++++++++++++++ + +======================= =============================================================== +:func:`degrees` Convert angle from radians to degrees. +:func:`radians` Convert angle from degrees to radians. +======================= =============================================================== + + +Hyperbolic functions +++++++++++++++++++++ + +======================= =============================================================== +:func:`acosh` Inverse hyperbolic cosine. +:func:`asinh` Inverse hyperbolic sine. +:func:`atanh` Inverse hyperbolic tangent. +:func:`cosh` Hyperbolic cosine. +:func:`sinh` Hyperbolic sine. +:func:`tanh` Hyperbolic tangent. +======================= =============================================================== + + +Special functions ++++++++++++++++++ + +======================= =============================================================== +:func:`erf` `Error function `_. +:func:`erfc` `Complementary error function `_. +:func:`gamma` `Gamma function `_. +:func:`lgamma` Natural logarithm of the absolute value of the `Gamma function `_. +======================= =============================================================== + + +Constants ++++++++++ + +======================= =============================================================== +:data:`pi` *π* = 3.141592... +:func:`e` *e* = 2.718281... +:func:`tau` *τ* = 2\ *π* = 6.283185.... +:func:`inf` Positive infinity. +:func:`nan` "Not a number" (NaN). +======================= =============================================================== + + Number-theoretic and representation functions --------------------------------------------- From 5cf795a59824a0b5553b8e99161f38f097b4b512 Mon Sep 17 00:00:00 2001 From: Joseph Martinot-Lagarde Date: Sun, 20 Oct 2024 19:20:35 +0200 Subject: [PATCH 2/9] Forgot remainder description --- Doc/library/math.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Doc/library/math.rst b/Doc/library/math.rst index ea09ba447dbad7..33eb8449022eff 100644 --- a/Doc/library/math.rst +++ b/Doc/library/math.rst @@ -39,7 +39,7 @@ Number-theoretic and representation functions :func:`factorial` *n* factorial. :func:`floor` Floor of *x*, the largest integer less than or equal to *x*. :func:`fma` Fused multiply-add operation. -:func:`fmod` XXX. +:func:`fmod` Remainder of division. :func:`frexp` Mantissa and exponent. :func:`fsum` Accurate floating-point sum of values. :func:`gcd` Greatest common divisor. From d06e257991447ebf9f538b5cd53f6d50fce0ada4 Mon Sep 17 00:00:00 2001 From: Joseph Martinot-Lagarde Date: Mon, 21 Oct 2024 22:02:25 +0200 Subject: [PATCH 3/9] Single table --- Doc/library/math.rst | 55 +++++++++++--------------------------------- 1 file changed, 14 insertions(+), 41 deletions(-) diff --git a/Doc/library/math.rst b/Doc/library/math.rst index 33eb8449022eff..2c50218d113406 100644 --- a/Doc/library/math.rst +++ b/Doc/library/math.rst @@ -26,12 +26,9 @@ The following functions are provided by this module. Except when explicitly noted otherwise, all return values are floats. -Summary -------- - -Number-theoretic and representation functions -+++++++++++++++++++++++++++++++++++++++++++++ ======================= =============================================================== +**Number-theoretic and representation functions** +---------------------------------------------------------------------------------------- :func:`ceil` Ceiling of *x*, the smallest integer greater than or equal to *x*. :func:`comb` Number of ways to choose *k* items from *n* items without repetition and without order. :func:`copysign` Magnitude (absolute value) of *x* with the sign of *y*. @@ -58,13 +55,9 @@ Number-theoretic and representation functions :func:`sumprod` Sum of products from two iterables. :func:`trunc` Integer part. :func:`ulp` Value of the least significant bit. -======================= =============================================================== - -Power and logarithmic functions -+++++++++++++++++++++++++++++++ - -======================= =============================================================== +**Power and logarithmic functions** +---------------------------------------------------------------------------------------- :func:`cbrt` Cube root. :func:`exp` *e* raised to the power *x*. :func:`exp2` *2* raised to the power *x*. @@ -75,13 +68,9 @@ Power and logarithmic functions :func:`log10` Base-10 logarithm. :func:`pow` ``x`` raised to the power ``y``. :func:`sqrt` Square root. -======================= =============================================================== - -Trigonometric functions -+++++++++++++++++++++++ - -======================= =============================================================== +**Trigonometric functions** +---------------------------------------------------------------------------------------- :func:`acos` Arc cosine. :func:`asin` Arc sine. :func:`atan` Arc tangent. @@ -91,46 +80,30 @@ Trigonometric functions :func:`hypot` Euclidean norm. :func:`sin` Sine. :func:`tan` Tangent. -======================= =============================================================== - - -Angular conversion -++++++++++++++++++ -======================= =============================================================== +**Angular conversion** +---------------------------------------------------------------------------------------- :func:`degrees` Convert angle from radians to degrees. :func:`radians` Convert angle from degrees to radians. -======================= =============================================================== - - -Hyperbolic functions -++++++++++++++++++++ -======================= =============================================================== +**Hyperbolic functions** +---------------------------------------------------------------------------------------- :func:`acosh` Inverse hyperbolic cosine. :func:`asinh` Inverse hyperbolic sine. :func:`atanh` Inverse hyperbolic tangent. :func:`cosh` Hyperbolic cosine. :func:`sinh` Hyperbolic sine. :func:`tanh` Hyperbolic tangent. -======================= =============================================================== - -Special functions -+++++++++++++++++ - -======================= =============================================================== +**Special functions** +---------------------------------------------------------------------------------------- :func:`erf` `Error function `_. :func:`erfc` `Complementary error function `_. :func:`gamma` `Gamma function `_. :func:`lgamma` Natural logarithm of the absolute value of the `Gamma function `_. -======================= =============================================================== - -Constants -+++++++++ - -======================= =============================================================== +**Constants** +---------------------------------------------------------------------------------------- :data:`pi` *π* = 3.141592... :func:`e` *e* = 2.718281... :func:`tau` *τ* = 2\ *π* = 6.283185.... From f817b9ee13c0afced93f3b5b1e439c2cfc76a92f Mon Sep 17 00:00:00 2001 From: Joseph Martinot-Lagarde Date: Mon, 21 Oct 2024 23:47:36 +0200 Subject: [PATCH 4/9] data instead of func --- Doc/library/math.rst | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Doc/library/math.rst b/Doc/library/math.rst index 2c50218d113406..bd66687a373296 100644 --- a/Doc/library/math.rst +++ b/Doc/library/math.rst @@ -105,10 +105,10 @@ noted otherwise, all return values are floats. **Constants** ---------------------------------------------------------------------------------------- :data:`pi` *π* = 3.141592... -:func:`e` *e* = 2.718281... -:func:`tau` *τ* = 2\ *π* = 6.283185.... -:func:`inf` Positive infinity. -:func:`nan` "Not a number" (NaN). +:data:`e` *e* = 2.718281... +:data:`tau` *τ* = 2\ *π* = 6.283185.... +:data:`inf` Positive infinity. +:data:`nan` "Not a number" (NaN). ======================= =============================================================== From fb37008ff7f651d3beeee8fb7a606826c7a7ae15 Mon Sep 17 00:00:00 2001 From: Joseph Martinot-Lagarde Date: Wed, 23 Oct 2024 00:11:44 +0200 Subject: [PATCH 5/9] Add arguments in the table --- Doc/library/math.rst | 142 +++++++++++++++++++++---------------------- 1 file changed, 71 insertions(+), 71 deletions(-) diff --git a/Doc/library/math.rst b/Doc/library/math.rst index bd66687a373296..c3dedc4dda5056 100644 --- a/Doc/library/math.rst +++ b/Doc/library/math.rst @@ -26,90 +26,90 @@ The following functions are provided by this module. Except when explicitly noted otherwise, all return values are floats. -======================= =============================================================== +==================================================== ============================================ **Number-theoretic and representation functions** ----------------------------------------------------------------------------------------- -:func:`ceil` Ceiling of *x*, the smallest integer greater than or equal to *x*. -:func:`comb` Number of ways to choose *k* items from *n* items without repetition and without order. -:func:`copysign` Magnitude (absolute value) of *x* with the sign of *y*. -:func:`fabs` Absolute value. -:func:`factorial` *n* factorial. -:func:`floor` Floor of *x*, the largest integer less than or equal to *x*. -:func:`fma` Fused multiply-add operation. -:func:`fmod` Remainder of division. -:func:`frexp` Mantissa and exponent. -:func:`fsum` Accurate floating-point sum of values. -:func:`gcd` Greatest common divisor. -:func:`isclose` Check if the values *a* and *b* are close to each other. -:func:`isfinite` Check if *x* is neither an infinity nor a NaN. -:func:`isinf` Check if if *x* is a positive or negative infinity. -:func:`isnan` Check if if *x* is a NaN (not a number). -:func:`isqrt` Integer square root of a nonnegative integer. -:func:`lcm` Least common multiple. -:func:`ldexp` inverse of function :func:`frexp`. -:func:`modf` Fractional and integer parts. -:func:`nextafter` Floating-point value *steps* steps after *x* towards *y*. -:func:`perm` Number of ways to choose *k* items from *n* items without repetition and with order. -:func:`prod` Product of all the elements. -:func:`remainder` Remainder of *x* with respect to *y*. -:func:`sumprod` Sum of products from two iterables. -:func:`trunc` Integer part. -:func:`ulp` Value of the least significant bit. +-------------------------------------------------------------------------------------------------- +:func:`ceil(x) ` Ceiling of *x*, the smallest integer greater than or equal to *x*. +:func:`comb(n, k) ` Number of ways to choose *k* items from *n* items without repetition and without order. +:func:`copysign(x, y) ` Magnitude (absolute value) of *x* with the sign of *y*. +:func:`fabs(x) ` Absolute value of *x*. +:func:`factorial(n) ` *n* factorial. +:func:`floor (x) ` Floor of *x*, the largest integer less than or equal to *x*. +:func:`fma(x, y, z) ` Fused multiply-add operation: ``(x * y) + z``. +:func:`fmod(x, y) ` Remainder of division ``x / y``. +:func:`frexp(x) ` Mantissa and exponent of *x*. +:func:`fsum(iterable) ` Sum of values in the input *iterable*. +:func:`gcd(*integers) ` Greatest common divisor of the integer arguments. +:func:`isclose(a, b, rel_tol, abs_tol) ` Check if the values *a* and *b* are close to each other. +:func:`isfinite(x) ` Check if *x* is neither an infinity nor a NaN. +:func:`isinf(x) ` Check if *x* is a positive or negative infinity. +:func:`isnan(x) ` Check if *x* is a NaN (not a number). +:func:`isqrt(n) ` Integer square root of a nonnegative integer *n*. +:func:`lcm(*integers) ` Least common multiple of the integer arguments. +:func:`ldexp(x, i) ` ``x * (2**i)``, inverse of function :func:`frexp`. +:func:`modf(x) ` Fractional and integer parts of *x*. +:func:`nextafter(x, y, steps) ` Floating-point value *steps* steps after *x* towards *y*. +:func:`perm(n, k) ` Number of ways to choose *k* items from *n* items without repetition and with order. +:func:`prod(iterable, start) ` Product of elements in the input *iterable* with a *start* value. +:func:`remainder(x, y) ` Remainder of *x* with respect to *y*. +:func:`sumprod(p, q) ` Sum of products from two iterables *p* and *q*. +:func:`trunc(x) ` Integer part of *x*. +:func:`ulp(x) ` Value of the least significant bit of *x*. **Power and logarithmic functions** ----------------------------------------------------------------------------------------- -:func:`cbrt` Cube root. -:func:`exp` *e* raised to the power *x*. -:func:`exp2` *2* raised to the power *x*. -:func:`expm1` *e* raised to the power *x*, minus 1. -:func:`log` Logarithm of *x* to the given base (*e* by default). -:func:`log1p` Natural logarithm of *1+x* (base *e*). -:func:`log2` Base-2 logarithm. -:func:`log10` Base-10 logarithm. -:func:`pow` ``x`` raised to the power ``y``. -:func:`sqrt` Square root. +-------------------------------------------------------------------------------------------------- +:func:`cbrt(x) ` Cube root of *x*. +:func:`exp(x) ` *e* raised to the power *x*. +:func:`exp2(x) ` *2* raised to the power *x*. +:func:`expm1(x) ` *e* raised to the power *x*, minus 1. +:func:`log(x, base) ` Logarithm of *x* to the given base (*e* by default). +:func:`log1p(x) ` Natural logarithm of *1+x* (base *e*). +:func:`log2(x) ` Base-2 logarithm of *x*. +:func:`log10(x) ` Base-10 logarithm of *x*. +:func:`pow(x, y) ` *x* raised to the power *y*. +:func:`sqrt(x) ` Square root of *x*. **Trigonometric functions** ----------------------------------------------------------------------------------------- -:func:`acos` Arc cosine. -:func:`asin` Arc sine. -:func:`atan` Arc tangent. -:func:`atan2` ``atan(y / x)``. -:func:`cos` Cosine. -:func:`dist` Euclidean distance. -:func:`hypot` Euclidean norm. -:func:`sin` Sine. -:func:`tan` Tangent. +-------------------------------------------------------------------------------------------------- +:func:`acos(x) ` Arc cosine of *x*. +:func:`asin(x) ` Arc sine of *x*. +:func:`atan(x) ` Arc tangent of *x*. +:func:`atan2(y, x) ` ``atan(y / x)``. +:func:`cos(x) ` Cosine of *x*. +:func:`dist(p, q) ` Euclidean distance between two points *p* and *q* given as an iterable of coordinates. +:func:`hypot(*coordinates) ` Euclidean norm of an iterable of coordinates. +:func:`sin(x) ` Sine of *x*. +:func:`tan(x) ` Tangent of *x*. **Angular conversion** ----------------------------------------------------------------------------------------- -:func:`degrees` Convert angle from radians to degrees. -:func:`radians` Convert angle from degrees to radians. +-------------------------------------------------------------------------------------------------- +:func:`degrees(x) ` Convert angle *x* from radians to degrees. +:func:`radians(x) ` Convert angle *x* from degrees to radians. **Hyperbolic functions** ----------------------------------------------------------------------------------------- -:func:`acosh` Inverse hyperbolic cosine. -:func:`asinh` Inverse hyperbolic sine. -:func:`atanh` Inverse hyperbolic tangent. -:func:`cosh` Hyperbolic cosine. -:func:`sinh` Hyperbolic sine. -:func:`tanh` Hyperbolic tangent. +-------------------------------------------------------------------------------------------------- +:func:`acosh(x) ` Inverse hyperbolic cosine of *x*. +:func:`asinh(x) ` Inverse hyperbolic sine of *x*. +:func:`atanh(x) ` Inverse hyperbolic tangent of *x*. +:func:`cosh(x) ` Hyperbolic cosine of *x*. +:func:`sinh(x) ` Hyperbolic sine of *x*. +:func:`tanh(x) ` Hyperbolic tangent of *x*. **Special functions** ----------------------------------------------------------------------------------------- -:func:`erf` `Error function `_. -:func:`erfc` `Complementary error function `_. -:func:`gamma` `Gamma function `_. -:func:`lgamma` Natural logarithm of the absolute value of the `Gamma function `_. +-------------------------------------------------------------------------------------------------- +:func:`erf(x) ` `Error function `_ at *x*. +:func:`erfc(x) ` `Complementary error function `_ at *x*. +:func:`gamma(x) ` `Gamma function `_ at *x*. +:func:`lgamma(x) ` Natural logarithm of the absolute value of the `Gamma function `_ at *x*. **Constants** ----------------------------------------------------------------------------------------- -:data:`pi` *π* = 3.141592... -:data:`e` *e* = 2.718281... -:data:`tau` *τ* = 2\ *π* = 6.283185.... -:data:`inf` Positive infinity. -:data:`nan` "Not a number" (NaN). -======================= =============================================================== +-------------------------------------------------------------------------------------------------- +:data:`pi` *π* = 3.141592... +:data:`e` *e* = 2.718281... +:data:`tau` *τ* = 2\ *π* = 6.283185.... +:data:`inf` Positive infinity. +:data:`nan` "Not a number" (NaN). +==================================================== ============================================ Number-theoretic and representation functions From 8197fedd6ecbf87889026e2d6248e9be8d4cb7d9 Mon Sep 17 00:00:00 2001 From: Joseph Martinot-Lagarde Date: Wed, 23 Oct 2024 00:12:19 +0200 Subject: [PATCH 6/9] Fix inconsistencies in pow documentation --- Doc/library/math.rst | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Doc/library/math.rst b/Doc/library/math.rst index c3dedc4dda5056..ce0116b0aa9e45 100644 --- a/Doc/library/math.rst +++ b/Doc/library/math.rst @@ -533,11 +533,11 @@ Power and logarithmic functions .. function:: pow(x, y) - Return ``x`` raised to the power ``y``. Exceptional cases follow + Return *x* raised to the power *y*. Exceptional cases follow the IEEE 754 standard as far as possible. In particular, ``pow(1.0, x)`` and ``pow(x, 0.0)`` always return ``1.0``, even - when ``x`` is a zero or a NaN. If both ``x`` and ``y`` are finite, - ``x`` is negative, and ``y`` is not an integer then ``pow(x, y)`` + when *x* is a zero or a NaN. If both *x* and *y* are finite, + *x* is negative, and *y* is not an integer then ``pow(x, y)`` is undefined, and raises :exc:`ValueError`. Unlike the built-in ``**`` operator, :func:`math.pow` converts both From 63ce52c70ab7297af45cbee51505692152a4c72a Mon Sep 17 00:00:00 2001 From: Joseph Martinot-Lagarde Date: Thu, 24 Oct 2024 01:08:57 +0200 Subject: [PATCH 7/9] Remove full stops from the table Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com> --- Doc/library/math.rst | 120 +++++++++++++++++++++---------------------- 1 file changed, 60 insertions(+), 60 deletions(-) diff --git a/Doc/library/math.rst b/Doc/library/math.rst index ce0116b0aa9e45..be625ef6d189c5 100644 --- a/Doc/library/math.rst +++ b/Doc/library/math.rst @@ -29,86 +29,86 @@ noted otherwise, all return values are floats. ==================================================== ============================================ **Number-theoretic and representation functions** -------------------------------------------------------------------------------------------------- -:func:`ceil(x) ` Ceiling of *x*, the smallest integer greater than or equal to *x*. -:func:`comb(n, k) ` Number of ways to choose *k* items from *n* items without repetition and without order. -:func:`copysign(x, y) ` Magnitude (absolute value) of *x* with the sign of *y*. -:func:`fabs(x) ` Absolute value of *x*. -:func:`factorial(n) ` *n* factorial. -:func:`floor (x) ` Floor of *x*, the largest integer less than or equal to *x*. -:func:`fma(x, y, z) ` Fused multiply-add operation: ``(x * y) + z``. -:func:`fmod(x, y) ` Remainder of division ``x / y``. -:func:`frexp(x) ` Mantissa and exponent of *x*. -:func:`fsum(iterable) ` Sum of values in the input *iterable*. -:func:`gcd(*integers) ` Greatest common divisor of the integer arguments. -:func:`isclose(a, b, rel_tol, abs_tol) ` Check if the values *a* and *b* are close to each other. -:func:`isfinite(x) ` Check if *x* is neither an infinity nor a NaN. -:func:`isinf(x) ` Check if *x* is a positive or negative infinity. -:func:`isnan(x) ` Check if *x* is a NaN (not a number). -:func:`isqrt(n) ` Integer square root of a nonnegative integer *n*. -:func:`lcm(*integers) ` Least common multiple of the integer arguments. -:func:`ldexp(x, i) ` ``x * (2**i)``, inverse of function :func:`frexp`. -:func:`modf(x) ` Fractional and integer parts of *x*. -:func:`nextafter(x, y, steps) ` Floating-point value *steps* steps after *x* towards *y*. -:func:`perm(n, k) ` Number of ways to choose *k* items from *n* items without repetition and with order. -:func:`prod(iterable, start) ` Product of elements in the input *iterable* with a *start* value. -:func:`remainder(x, y) ` Remainder of *x* with respect to *y*. -:func:`sumprod(p, q) ` Sum of products from two iterables *p* and *q*. -:func:`trunc(x) ` Integer part of *x*. -:func:`ulp(x) ` Value of the least significant bit of *x*. +:func:`ceil(x) ` Ceiling of *x*, the smallest integer greater than or equal to *x* +:func:`comb(n, k) ` Number of ways to choose *k* items from *n* items without repetition and without order +:func:`copysign(x, y) ` Magnitude (absolute value) of *x* with the sign of *y* +:func:`fabs(x) ` Absolute value of *x* +:func:`factorial(n) ` *n* factorial +:func:`floor (x) ` Floor of *x*, the largest integer less than or equal to *x* +:func:`fma(x, y, z) ` Fused multiply-add operation: ``(x * y) + z`` +:func:`fmod(x, y) ` Remainder of division ``x / y`` +:func:`frexp(x) ` Mantissa and exponent of *x* +:func:`fsum(iterable) ` Sum of values in the input *iterable* +:func:`gcd(*integers) ` Greatest common divisor of the integer arguments +:func:`isclose(a, b, rel_tol, abs_tol) ` Check if the values *a* and *b* are close to each other +:func:`isfinite(x) ` Check if *x* is neither an infinity nor a NaN +:func:`isinf(x) ` Check if *x* is a positive or negative infinity +:func:`isnan(x) ` Check if *x* is a NaN (not a number) +:func:`isqrt(n) ` Integer square root of a nonnegative integer *n* +:func:`lcm(*integers) ` Least common multiple of the integer arguments +:func:`ldexp(x, i) ` ``x * (2**i)``, inverse of function :func:`frexp` +:func:`modf(x) ` Fractional and integer parts of *x* +:func:`nextafter(x, y, steps) ` Floating-point value *steps* steps after *x* towards *y* +:func:`perm(n, k) ` Number of ways to choose *k* items from *n* items without repetition and with order +:func:`prod(iterable, start) ` Product of elements in the input *iterable* with a *start* value +:func:`remainder(x, y) ` Remainder of *x* with respect to *y* +:func:`sumprod(p, q) ` Sum of products from two iterables *p* and *q* +:func:`trunc(x) ` Integer part of *x* +:func:`ulp(x) ` Value of the least significant bit of *x* **Power and logarithmic functions** -------------------------------------------------------------------------------------------------- -:func:`cbrt(x) ` Cube root of *x*. -:func:`exp(x) ` *e* raised to the power *x*. -:func:`exp2(x) ` *2* raised to the power *x*. -:func:`expm1(x) ` *e* raised to the power *x*, minus 1. -:func:`log(x, base) ` Logarithm of *x* to the given base (*e* by default). -:func:`log1p(x) ` Natural logarithm of *1+x* (base *e*). -:func:`log2(x) ` Base-2 logarithm of *x*. -:func:`log10(x) ` Base-10 logarithm of *x*. -:func:`pow(x, y) ` *x* raised to the power *y*. -:func:`sqrt(x) ` Square root of *x*. +:func:`cbrt(x) ` Cube root of *x* +:func:`exp(x) ` *e* raised to the power *x* +:func:`exp2(x) ` *2* raised to the power *x* +:func:`expm1(x) ` *e* raised to the power *x*, minus 1 +:func:`log(x, base) ` Logarithm of *x* to the given base (*e* by default) +:func:`log1p(x) ` Natural logarithm of *1+x* (base *e*) +:func:`log2(x) ` Base-2 logarithm of *x* +:func:`log10(x) ` Base-10 logarithm of *x* +:func:`pow(x, y) ` *x* raised to the power *y* +:func:`sqrt(x) ` Square root of *x* **Trigonometric functions** -------------------------------------------------------------------------------------------------- -:func:`acos(x) ` Arc cosine of *x*. -:func:`asin(x) ` Arc sine of *x*. -:func:`atan(x) ` Arc tangent of *x*. -:func:`atan2(y, x) ` ``atan(y / x)``. -:func:`cos(x) ` Cosine of *x*. -:func:`dist(p, q) ` Euclidean distance between two points *p* and *q* given as an iterable of coordinates. -:func:`hypot(*coordinates) ` Euclidean norm of an iterable of coordinates. -:func:`sin(x) ` Sine of *x*. -:func:`tan(x) ` Tangent of *x*. +:func:`acos(x) ` Arc cosine of *x* +:func:`asin(x) ` Arc sine of *x* +:func:`atan(x) ` Arc tangent of *x* +:func:`atan2(y, x) ` ``atan(y / x)`` +:func:`cos(x) ` Cosine of *x* +:func:`dist(p, q) ` Euclidean distance between two points *p* and *q* given as an iterable of coordinates +:func:`hypot(*coordinates) ` Euclidean norm of an iterable of coordinates +:func:`sin(x) ` Sine of *x* +:func:`tan(x) ` Tangent of *x* **Angular conversion** -------------------------------------------------------------------------------------------------- -:func:`degrees(x) ` Convert angle *x* from radians to degrees. -:func:`radians(x) ` Convert angle *x* from degrees to radians. +:func:`degrees(x) ` Convert angle *x* from radians to degrees +:func:`radians(x) ` Convert angle *x* from degrees to radians **Hyperbolic functions** -------------------------------------------------------------------------------------------------- -:func:`acosh(x) ` Inverse hyperbolic cosine of *x*. -:func:`asinh(x) ` Inverse hyperbolic sine of *x*. -:func:`atanh(x) ` Inverse hyperbolic tangent of *x*. -:func:`cosh(x) ` Hyperbolic cosine of *x*. -:func:`sinh(x) ` Hyperbolic sine of *x*. -:func:`tanh(x) ` Hyperbolic tangent of *x*. +:func:`acosh(x) ` Inverse hyperbolic cosine of *x* +:func:`asinh(x) ` Inverse hyperbolic sine of *x* +:func:`atanh(x) ` Inverse hyperbolic tangent of *x* +:func:`cosh(x) ` Hyperbolic cosine of *x* +:func:`sinh(x) ` Hyperbolic sine of *x* +:func:`tanh(x) ` Hyperbolic tangent of *x* **Special functions** -------------------------------------------------------------------------------------------------- -:func:`erf(x) ` `Error function `_ at *x*. -:func:`erfc(x) ` `Complementary error function `_ at *x*. -:func:`gamma(x) ` `Gamma function `_ at *x*. -:func:`lgamma(x) ` Natural logarithm of the absolute value of the `Gamma function `_ at *x*. +:func:`erf(x) ` `Error function `_ at *x* +:func:`erfc(x) ` `Complementary error function `_ at *x* +:func:`gamma(x) ` `Gamma function `_ at *x* +:func:`lgamma(x) ` Natural logarithm of the absolute value of the `Gamma function `_ at *x* **Constants** -------------------------------------------------------------------------------------------------- :data:`pi` *π* = 3.141592... :data:`e` *e* = 2.718281... -:data:`tau` *τ* = 2\ *π* = 6.283185.... -:data:`inf` Positive infinity. -:data:`nan` "Not a number" (NaN). +:data:`tau` *τ* = 2\ *π* = 6.283185... +:data:`inf` Positive infinity +:data:`nan` "Not a number" (NaN) ==================================================== ============================================ From c4a84244ae310eb0562086f4b56ab9b0571a034f Mon Sep 17 00:00:00 2001 From: Joseph Martinot-Lagarde Date: Thu, 24 Oct 2024 20:49:48 +0200 Subject: [PATCH 8/9] Fix math.pow link --- Doc/library/math.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Doc/library/math.rst b/Doc/library/math.rst index be625ef6d189c5..d7f723aaebe55b 100644 --- a/Doc/library/math.rst +++ b/Doc/library/math.rst @@ -66,7 +66,7 @@ noted otherwise, all return values are floats. :func:`log1p(x) ` Natural logarithm of *1+x* (base *e*) :func:`log2(x) ` Base-2 logarithm of *x* :func:`log10(x) ` Base-10 logarithm of *x* -:func:`pow(x, y) ` *x* raised to the power *y* +:func:`pow(x, y) ` *x* raised to the power *y* :func:`sqrt(x) ` Square root of *x* **Trigonometric functions** From eed482aac06ecb0dd9e2a040496295508ff23fcb Mon Sep 17 00:00:00 2001 From: Joseph Martinot-Lagarde Date: Thu, 24 Oct 2024 20:51:59 +0200 Subject: [PATCH 9/9] Fix spacing --- Doc/library/math.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Doc/library/math.rst b/Doc/library/math.rst index d7f723aaebe55b..6be61c99274eb7 100644 --- a/Doc/library/math.rst +++ b/Doc/library/math.rst @@ -66,7 +66,7 @@ noted otherwise, all return values are floats. :func:`log1p(x) ` Natural logarithm of *1+x* (base *e*) :func:`log2(x) ` Base-2 logarithm of *x* :func:`log10(x) ` Base-10 logarithm of *x* -:func:`pow(x, y) ` *x* raised to the power *y* +:func:`pow(x, y) ` *x* raised to the power *y* :func:`sqrt(x) ` Square root of *x* **Trigonometric functions**