Skip to content

Commit 0a37d67

Browse files
Noddhugovk
authored andcommitted
Doc: Add a single table as summary to math documentation (pythonGH-125810)
* Summary for math module with separate tables * Forgot remainder description * Single table * data instead of func * Add arguments in the table * Fix inconsistencies in pow documentation * Remove full stops from the table Co-authored-by: Hugo van Kemenade <[email protected]> * Fix math.pow link * Fix spacing --------- Co-authored-by: Hugo van Kemenade <[email protected]>
1 parent d28b276 commit 0a37d67

File tree

1 file changed

+89
-3
lines changed

1 file changed

+89
-3
lines changed

Doc/library/math.rst

Lines changed: 89 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,92 @@ The following functions are provided by this module. Except when explicitly
2626
noted otherwise, all return values are floats.
2727

2828

29+
==================================================== ============================================
30+
**Number-theoretic and representation functions**
31+
--------------------------------------------------------------------------------------------------
32+
:func:`ceil(x) <ceil>` Ceiling of *x*, the smallest integer greater than or equal to *x*
33+
:func:`comb(n, k) <comb>` Number of ways to choose *k* items from *n* items without repetition and without order
34+
:func:`copysign(x, y) <copysign>` Magnitude (absolute value) of *x* with the sign of *y*
35+
:func:`fabs(x) <fabs>` Absolute value of *x*
36+
:func:`factorial(n) <factorial>` *n* factorial
37+
:func:`floor (x) <floor>` Floor of *x*, the largest integer less than or equal to *x*
38+
:func:`fma(x, y, z) <fma>` Fused multiply-add operation: ``(x * y) + z``
39+
:func:`fmod(x, y) <fmod>` Remainder of division ``x / y``
40+
:func:`frexp(x) <frexp>` Mantissa and exponent of *x*
41+
:func:`fsum(iterable) <fsum>` Sum of values in the input *iterable*
42+
:func:`gcd(*integers) <gcd>` Greatest common divisor of the integer arguments
43+
:func:`isclose(a, b, rel_tol, abs_tol) <isclose>` Check if the values *a* and *b* are close to each other
44+
:func:`isfinite(x) <isfinite>` Check if *x* is neither an infinity nor a NaN
45+
:func:`isinf(x) <isinf>` Check if *x* is a positive or negative infinity
46+
:func:`isnan(x) <isnan>` Check if *x* is a NaN (not a number)
47+
:func:`isqrt(n) <isqrt>` Integer square root of a nonnegative integer *n*
48+
:func:`lcm(*integers) <lcm>` Least common multiple of the integer arguments
49+
:func:`ldexp(x, i) <ldexp>` ``x * (2**i)``, inverse of function :func:`frexp`
50+
:func:`modf(x) <modf>` Fractional and integer parts of *x*
51+
:func:`nextafter(x, y, steps) <nextafter>` Floating-point value *steps* steps after *x* towards *y*
52+
:func:`perm(n, k) <perm>` Number of ways to choose *k* items from *n* items without repetition and with order
53+
:func:`prod(iterable, start) <prod>` Product of elements in the input *iterable* with a *start* value
54+
:func:`remainder(x, y) <remainder>` Remainder of *x* with respect to *y*
55+
:func:`sumprod(p, q) <sumprod>` Sum of products from two iterables *p* and *q*
56+
:func:`trunc(x) <trunc>` Integer part of *x*
57+
:func:`ulp(x) <ulp>` Value of the least significant bit of *x*
58+
59+
**Power and logarithmic functions**
60+
--------------------------------------------------------------------------------------------------
61+
:func:`cbrt(x) <cbrt>` Cube root of *x*
62+
:func:`exp(x) <exp>` *e* raised to the power *x*
63+
:func:`exp2(x) <exp2>` *2* raised to the power *x*
64+
:func:`expm1(x) <expm1>` *e* raised to the power *x*, minus 1
65+
:func:`log(x, base) <log>` Logarithm of *x* to the given base (*e* by default)
66+
:func:`log1p(x) <log1p>` Natural logarithm of *1+x* (base *e*)
67+
:func:`log2(x) <log2>` Base-2 logarithm of *x*
68+
:func:`log10(x) <log10>` Base-10 logarithm of *x*
69+
:func:`pow(x, y) <math.pow>` *x* raised to the power *y*
70+
:func:`sqrt(x) <sqrt>` Square root of *x*
71+
72+
**Trigonometric functions**
73+
--------------------------------------------------------------------------------------------------
74+
:func:`acos(x) <acos>` Arc cosine of *x*
75+
:func:`asin(x) <asin>` Arc sine of *x*
76+
:func:`atan(x) <atan>` Arc tangent of *x*
77+
:func:`atan2(y, x) <atan2>` ``atan(y / x)``
78+
:func:`cos(x) <cos>` Cosine of *x*
79+
:func:`dist(p, q) <dist>` Euclidean distance between two points *p* and *q* given as an iterable of coordinates
80+
:func:`hypot(*coordinates) <hypot>` Euclidean norm of an iterable of coordinates
81+
:func:`sin(x) <sin>` Sine of *x*
82+
:func:`tan(x) <tan>` Tangent of *x*
83+
84+
**Angular conversion**
85+
--------------------------------------------------------------------------------------------------
86+
:func:`degrees(x) <degrees>` Convert angle *x* from radians to degrees
87+
:func:`radians(x) <radians>` Convert angle *x* from degrees to radians
88+
89+
**Hyperbolic functions**
90+
--------------------------------------------------------------------------------------------------
91+
:func:`acosh(x) <acosh>` Inverse hyperbolic cosine of *x*
92+
:func:`asinh(x) <asinh>` Inverse hyperbolic sine of *x*
93+
:func:`atanh(x) <atanh>` Inverse hyperbolic tangent of *x*
94+
:func:`cosh(x) <cosh>` Hyperbolic cosine of *x*
95+
:func:`sinh(x) <sinh>` Hyperbolic sine of *x*
96+
:func:`tanh(x) <tanh>` Hyperbolic tangent of *x*
97+
98+
**Special functions**
99+
--------------------------------------------------------------------------------------------------
100+
:func:`erf(x) <erf>` `Error function <https://en.wikipedia.org/wiki/Error_function>`_ at *x*
101+
:func:`erfc(x) <erfc>` `Complementary error function <https://en.wikipedia.org/wiki/Error_function>`_ at *x*
102+
:func:`gamma(x) <gamma>` `Gamma function <https://en.wikipedia.org/wiki/Gamma_function>`_ at *x*
103+
:func:`lgamma(x) <lgamma>` Natural logarithm of the absolute value of the `Gamma function <https://en.wikipedia.org/wiki/Gamma_function>`_ at *x*
104+
105+
**Constants**
106+
--------------------------------------------------------------------------------------------------
107+
:data:`pi` *π* = 3.141592...
108+
:data:`e` *e* = 2.718281...
109+
:data:`tau` *τ* = 2\ *π* = 6.283185...
110+
:data:`inf` Positive infinity
111+
:data:`nan` "Not a number" (NaN)
112+
==================================================== ============================================
113+
114+
29115
Number-theoretic and representation functions
30116
---------------------------------------------
31117

@@ -447,11 +533,11 @@ Power and logarithmic functions
447533

448534
.. function:: pow(x, y)
449535

450-
Return ``x`` raised to the power ``y``. Exceptional cases follow
536+
Return *x* raised to the power *y*. Exceptional cases follow
451537
the IEEE 754 standard as far as possible. In particular,
452538
``pow(1.0, x)`` and ``pow(x, 0.0)`` always return ``1.0``, even
453-
when ``x`` is a zero or a NaN. If both ``x`` and ``y`` are finite,
454-
``x`` is negative, and ``y`` is not an integer then ``pow(x, y)``
539+
when *x* is a zero or a NaN. If both *x* and *y* are finite,
540+
*x* is negative, and *y* is not an integer then ``pow(x, y)``
455541
is undefined, and raises :exc:`ValueError`.
456542

457543
Unlike the built-in ``**`` operator, :func:`math.pow` converts both

0 commit comments

Comments
 (0)