8000 DOC: Adjust constants.rst · numpy/numpy@04dd24d · GitHub
[go: up one dir, main page]

Skip to content

Commit 04dd24d

Browse files
committed
DOC: Adjust constants.rst
1 parent 7a98ba4 commit 04dd24d

File tree

1 file changed

+12
-14
lines changed

1 file changed

+12
-14
lines changed

doc/source/reference/constants.rst

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -60,14 +60,12 @@ NumPy includes several constants:
6060
Also that positive infinity is not equivalent to negative infinity. But
6161
infinity is equivalent to positive infinity.
6262

63-
`Inf`, `Infinity`, `PINF` and `infty` are aliases for `inf`.
64-
6563
.. rubric:: Examples
6664

6765
>>> np.inf
6866
inf
6967
>>> np.array([1]) / 0.
70-
array([ Inf])
68+
array([inf])
7169

7270

7371
.. data:: nan
@@ -97,9 +95,9 @@ NumPy includes several constants:
9795
>>> np.nan
9896
nan
9997
>>> np.log(-1)
100-
nan
98+
np.float64(nan)
10199
>>> np.log([-1, 1, 2])
102-
array([ NaN, 0. , 0.69314718])
100+
array([ nan, 0. , 0.69314718])
103101

104102

105103
.. data:: newaxis
@@ -108,41 +106,41 @@ NumPy includes several constants:
108106

109107
.. rubric:: Examples
110108

111-
>>> newaxis is None
109+
>>> np.newaxis is None
112110
True
113111
>>> x = np.arange(3)
114112
>>> x
115113
array([0, 1, 2])
116-
>>> x[:, newaxis]
114+
>>> x[:, np.newaxis]
117115
array([[0],
118116
[1],
119117
[2]])
120-
>>> x[:, newaxis, newaxis]
118+
>>> x[:, np.newaxis, np.newaxis]
121119
array([[[0]],
122120
[[1]],
123121
[[2]]])
124-
>>> x[:, newaxis] * x
122+
>>> x[:, np.newaxis] * x
125123
array([[0, 0, 0],
126124
[0, 1, 2],
127125
[0, 2, 4]])
128126

129127
Outer product, same as ``outer(x, y)``:
130128

131129
>>> y = np.arange(3, 6)
132-
>>> x[:, newaxis] * y
130+
>>> x[:, np.newaxis] * y
133131
array([[ 0, 0, 0],
134132
[ 3, 4, 5],
135133
[ 6, 8, 10]])
136134

137-
``x[newaxis, :]`` is equivalent to ``x[newaxis]`` and ``x[None]``:
135+
``x[np.newaxis, :]`` is equivalent to ``x[np.newaxis]`` and ``x[None]``:
138136

139-
>>> x[newaxis, :].shape
137+
>>> x[np.newaxis, :].shape
140138
(1, 3)
141-
>>> x[newaxis].shape
139+
>>> x[np.newaxis].shape
142140
(1, 3)
143141
>>> x[None].shape
144142
(1, 3)
145-
>>> x[:, newaxis].shape
143+
>>> x[:, np.newaxis].shape
146144
(3, 1)
147145

148146

0 commit comments

Comments
 (0)
0