diff options
author | Eric Wieser <wieser.eric@gmail.com> | 2019-06-01 14:44:59 -0700 |
---|---|---|
committer | Eric Wieser <wieser.eric@gmail.com> | 2019-06-01 14:54:00 -0700 |
commit | a4539cc2dd5c6183784bdb11d107e3742c0b661f (patch) | |
tree | ef19caecf20d101b8df0c0c4dd6744563caa43e6 /numpy/doc/constants.py | |
parent | 392866d1c8dce0abb8cb327a42f8e134f5d2a05e (diff) | |
download | numpy-a4539cc2dd5c6183784bdb11d107e3742c0b661f.tar.gz |
DOC: Reorder the constants to have the most useful first
Previously the constants at the top of the page said words to the effect of "use the one at the bottom of this page instead".
Let's just show users those ones first to start with.
This commit only re-orders these constants, it does not change any of the descriptions, despite the diff appearing to show that
Diffstat (limited to 'numpy/doc/constants.py')
-rw-r--r-- | numpy/doc/constants.py | 307 |
1 files changed, 154 insertions, 153 deletions
diff --git a/numpy/doc/constants.py b/numpy/doc/constants.py index 21c7a3c67..72793e44d 100644 --- a/numpy/doc/constants.py +++ b/numpy/doc/constants.py @@ -22,53 +22,51 @@ constants = [] def add_newdoc(module, name, doc): constants.append((name, doc)) -add_newdoc('numpy', 'Inf', +add_newdoc('numpy', 'pi', """ - IEEE 754 floating point representation of (positive) infinity. - - Use `inf` because `Inf`, `Infinity`, `PINF` and `infty` are aliases for - `inf`. For more details, see `inf`. + ``pi = 3.1415926535897932384626433...`` - See Also - -------- - inf + References + ---------- + https://en.wikipedia.org/wiki/Pi """) -add_newdoc('numpy', 'Infinity', +add_newdoc('numpy', 'e', """ - IEEE 754 floating point representation of (positive) infinity. + Euler's constant, base of natural logarithms, Napier's constant. - Use `inf` because `Inf`, `Infinity`, `PINF` and `infty` are aliases for - `inf`. For more details, see `inf`. + ``e = 2.71828182845904523536028747135266249775724709369995...`` See Also -------- - inf + exp : Exponential function + log : Natural logarithm + + References + ---------- + https://en.wikipedia.org/wiki/E_%28mathematical_constant%29 """) -add_newdoc('numpy', 'NAN', +add_newdoc('numpy', 'euler_gamma', """ - IEEE 754 floating point representation of Not a Number (NaN). - - `NaN` and `NAN` are equivalent definitions of `nan`. Please use - `nan` instead of `NAN`. + ``γ = 0.5772156649015328606065120900824024310421...`` - See Also - -------- - nan + References + ---------- + https://en.wikipedia.org/wiki/Euler-Mascheroni_constant """) -add_newdoc('numpy', 'NINF', +add_newdoc('numpy', 'inf', """ - IEEE 754 floating point representation of negative infinity. + IEEE 754 floating point representation of (positive) infinity. Returns ------- y : float - A floating point representation of negative infinity. + A floating point representation of positive infinity. See Also -------- @@ -90,12 +88,96 @@ add_newdoc('numpy', 'NINF', Also that positive infinity is not equivalent to negative infinity. But infinity is equivalent to positive infinity. + `Inf`, `Infinity`, `PINF` and `infty` are aliases for `inf`. + Examples -------- - >>> np.NINF - -inf - >>> np.log(0) - -inf + >>> np.inf + inf + >>> np.array([1]) / 0. + array([ Inf]) + + """) + +add_newdoc('numpy', 'nan', + """ + IEEE 754 floating point representation of Not a Number (NaN). + + Returns + ------- + y : A floating point representation of Not a Number. + + See Also + -------- + isnan : Shows which elements are Not a Number. + + isfinite : Shows which elements are finite (not one of + Not a Number, positive infinity and negative infinity) + + Notes + ----- + NumPy uses the IEEE Standard for Binary Floating-Point for Arithmetic + (IEEE 754). This means that Not a Number is not equivalent to infinity. + + `NaN` and `NAN` are aliases of `nan`. + + Examples + -------- + >>> np.nan + nan + >>> np.log(-1) + nan + >>> np.log([-1, 1, 2]) + array([ NaN, 0. , 0.69314718]) + + """) + +add_newdoc('numpy', 'newaxis', + """ + A convenient alias for None, useful for indexing arrays. + + See Also + -------- + `numpy.doc.indexing` + + Examples + -------- + >>> newaxis is None + True + >>> x = np.arange(3) + >>> x + array([0, 1, 2]) + >>> x[:, newaxis] + array([[0], + [1], + [2]]) + >>> x[:, newaxis, newaxis] + array([[[0]], + [[1]], + [[2]]]) + >>> x[:, newaxis] * x + array([[0, 0, 0], + [0, 1, 2], + [0, 2, 4]]) + + Outer product, same as ``outer(x, y)``: + + >>> y = np.arange(3, 6) + >>> x[:, newaxis] * y + array([[ 0, 0, 0], + [ 3, 4, 5], + [ 6, 8, 10]]) + + ``x[newaxis, :]`` is equivalent to ``x[newaxis]`` and ``x[None]``: + + >>> x[newaxis, :].shape + (1, 3) + >>> x[newaxis].shape + (1, 3) + >>> x[None].shape + (1, 3) + >>> x[:, newaxis].shape + (3, 1) """) @@ -144,32 +226,6 @@ add_newdoc('numpy', 'NZERO', """) -add_newdoc('numpy', 'NaN', - """ - IEEE 754 floating point representation of Not a Number (NaN). - - `NaN` and `NAN` are equivalent definitions of `nan`. Please use - `nan` instead of `NaN`. - - See Also - -------- - nan - - """) - -add_newdoc('numpy', 'PINF', - """ - IEEE 754 floating point representation of (positive) infinity. - - Use `inf` because `Inf`, `Infinity`, `PINF` and `infty` are aliases for - `inf`. For more details, see `inf`. - - See Also - -------- - inf - - """) - add_newdoc('numpy', 'PZERO', """ IEEE 754 floating point representation of positive zero. @@ -215,31 +271,40 @@ add_newdoc('numpy', 'PZERO', """) -add_newdoc('numpy', 'e', +add_newdoc('numpy', 'NAN', """ - Euler's constant, base of natural logarithms, Napier's constant. + IEEE 754 floating point representation of Not a Number (NaN). - ``e = 2.71828182845904523536028747135266249775724709369995...`` + `NaN` and `NAN` are equivalent definitions of `nan`. Please use + `nan` instead of `NAN`. See Also -------- - exp : Exponential function - log : Natural logarithm + nan - References - ---------- - https://en.wikipedia.org/wiki/E_%28mathematical_constant%29 + """) + +add_newdoc('numpy', 'NaN', + """ + IEEE 754 floating point representation of Not a Number (NaN). + + `NaN` and `NAN` are equivalent definitions of `nan`. Please use + `nan` instead of `NaN`. + + See Also + -------- + nan """) -add_newdoc('numpy', 'inf', +add_newdoc('numpy', 'NINF', """ - IEEE 754 floating point representation of (positive) infinity. + IEEE 754 floating point representation of negative infinity. Returns ------- y : float - A floating point representation of positive infinity. + A floating point representation of negative infinity. See Also -------- @@ -261,18 +326,16 @@ add_newdoc('numpy', 'inf', Also that positive infinity is not equivalent to negative infinity. But infinity is equivalent to positive infinity. - `Inf`, `Infinity`, `PINF` and `infty` are aliases for `inf`. - Examples -------- - >>> np.inf - inf - >>> np.array([1]) / 0. - array([ Inf]) + >>> np.NINF + -inf + >>> np.log(0) + -inf """) -add_newdoc('numpy', 'infty', +add_newdoc('numpy', 'PINF', """ IEEE 754 floating point representation of (positive) infinity. @@ -285,108 +348,46 @@ add_newdoc('numpy', 'infty', """) -add_newdoc('numpy', 'nan', +add_newdoc('numpy', 'infty', """ - IEEE 754 floating point representation of Not a Number (NaN). + IEEE 754 floating point representation of (positive) infinity. - Returns - ------- - y : A floating point representation of Not a Number. + Use `inf` because `Inf`, `Infinity`, `PINF` and `infty` are aliases for + `inf`. For more details, see `inf`. See Also -------- - isnan : Shows which elements are Not a Number. - - isfinite : Shows which elements are finite (not one of - Not a Number, positive infinity and negative infinity) - - Notes - ----- - NumPy uses the IEEE Standard for Binary Floating-Point for Arithmetic - (IEEE 754). This means that Not a Number is not equivalent to infinity. - - `NaN` and `NAN` are aliases of `nan`. - - Examples - -------- - >>> np.nan - nan - >>> np.log(-1) - nan - >>> np.log([-1, 1, 2]) - array([ NaN, 0. , 0.69314718]) + inf """) -add_newdoc('numpy', 'newaxis', +add_newdoc('numpy', 'Inf', """ - A convenient alias for None, useful for indexing arrays. + IEEE 754 floating point representation of (positive) infinity. - See Also - -------- - `numpy.doc.indexing` + Use `inf` because `Inf`, `Infinity`, `PINF` and `infty` are aliases for + `inf`. For more details, see `inf`. - Examples + See Also -------- - >>> newaxis is None - True - >>> x = np.arange(3) - >>> x - array([0, 1, 2]) - >>> x[:, newaxis] - array([[0], - [1], - [2]]) - >>> x[:, newaxis, newaxis] - array([[[0]], - [[1]], - [[2]]]) - >>> x[:, newaxis] * x - array([[0, 0, 0], - [0, 1, 2], - [0, 2, 4]]) - - Outer product, same as ``outer(x, y)``: - - >>> y = np.arange(3, 6) - >>> x[:, newaxis] * y - array([[ 0, 0, 0], - [ 3, 4, 5], - [ 6, 8, 10]]) - - ``x[newaxis, :]`` is equivalent to ``x[newaxis]`` and ``x[None]``: - - >>> x[newaxis, :].shape - (1, 3) - >>> x[newaxis].shape - (1, 3) - >>> x[None].shape - (1, 3) - >>> x[:, newaxis].shape - (3, 1) + inf """) -add_newdoc('numpy', 'pi', +add_newdoc('numpy', 'Infinity', """ - ``pi = 3.1415926535897932384626433...`` - - References - ---------- - https://en.wikipedia.org/wiki/Pi - - """) + IEEE 754 floating point representation of (positive) infinity. -add_newdoc('numpy', 'euler_gamma', - """ - ``γ = 0.5772156649015328606065120900824024310421...`` + Use `inf` because `Inf`, `Infinity`, `PINF` and `infty` are aliases for + `inf`. For more details, see `inf`. - References - ---------- - https://en.wikipedia.org/wiki/Euler-Mascheroni_constant + See Also + -------- + inf """) + if __doc__: constants_str = [] constants.sort() |