Skip to content

Commit 32aa412

Browse files
committed
Proof reading NumPy
1 parent da65422 commit 32aa412

8 files changed

+16
-16
lines changed

docs/mooc/numerical-computing/broadcasting.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ different number of dimensions. Also, if one of the dimensions is 1, the array
168168
is "copied" in that dimension to match the other array.
169169

170170
Examples of how the dimensions of arrays are matched when broadcasting
171-
**succesfully**:
171+
**successfully**:
172172

173173
~~~
174174
a: 8 x 3
@@ -197,7 +197,7 @@ Examples of **failed** broadcasting due to mismatch(es) in the dimensions:
197197
b: 5 x 1 x 3 # mismatch in the third from last dimension
198198
~~~
199199

200-
It is very easy to make wrong assumptions intuitively, so instead careful
200+
It is very easy to make wrong assumptions intuitively, so careful
201201
consideration is always needed when broadcasting.
202202

203203

docs/mooc/numerical-computing/creating-and-accessing.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ number of elements remains the same.
1717

1818
### From existing data
1919

20-
NumPy arrays can be created in several different ways. The simplest ways is
20+
NumPy arrays can be created in several different ways. The simplest way is
2121
to use the **array** constructor and provide the data directly as an
2222
argument. For example, in order to generate a one-dimensional array containing
2323
the numbers 1,2,3,4 one can use:
@@ -36,7 +36,7 @@ number (e.g. [1, 2, 3.1, 4]) then the array created would have used floating
3636
point type for all elements.
3737

3838
The first argument of `array()` is the data for the array. It can be a single
39-
list (or tuple), or a nested list of uniformly sized lists that mimicks a
39+
list (or tuple), or a nested list of uniformly sized lists that mimics a
4040
multi-dimensional array.
4141

4242
The second argument of `array()` is the datatype to be used for the array. It
@@ -208,7 +208,7 @@ Simple assignment creates a new reference to an array, just like for any other
208208
Python object. Thus, if you modify the array using the new reference, the
209209
changes are visible also via any old reference to the same array.
210210

211-
To make a true copy of an array, one should use the *copy()* method:
211+
To make a true copy of an array, one should use the `copy()` method:
212212

213213
~~~python
214214
a = np.arange(10)
@@ -222,7 +222,7 @@ modifications to the elements in the view are directly reflected in the
222222
original array. In fact, no real copy is made and as such any manipulation
223223
will just change the original array.
224224

225-
Once again, to make a true copy, one should use the *copy()* method:
225+
Once again, to make a true copy, one should use the `copy()` method:
226226

227227
~~~python
228228
a = np.arange(10)

docs/mooc/numerical-computing/file-io.md

+4-3
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,10 @@ load and store data in a human-readable format.
1515
Comments and column delimiters are handled automatically, so usually one can
1616
read any data file in a column layout into a NumPy array.
1717

18-
Assume we the following measurement data in a called `xy-coordinates.dat`. As
19-
you can see it also contains an invalid data point that is commented out as
20-
well as one data point with an undefined value (`nan`).
18+
Assume we have the following measurement data in a file called
19+
`xy-coordinates.dat`. As you can see it also contains an invalid data
20+
point that is commented out as well as one data point with an
21+
undefined value (`nan`).
2122

2223
~~~
2324
# x y

docs/mooc/numerical-computing/linear-algebra.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ polynomial functionality.
99

1010
# Linear algebra
1111

12-
NumPy includes in-built linear algebra routines that can be quite handy. For
12+
NumPy includes linear algebra routines that can be quite handy. For
1313
example, NumPy can calculate matrix and vector products efficiently (`dot`,
1414
`vdot`), solve eigenproblems (`linalg.eig`, `linalg.eigvals`), solve linear
1515
systems (`linalg.solve`), and do matrix inversion (`linalg.inv`).

docs/mooc/numerical-computing/numexpr.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ poly = numexpr.evaluate("((.25*x + .75)*x - 1.5)*x - 2")
3131

3232
The expression is enclosed in quotes and will be evaluated using a single
3333
C-loop. Speed-ups in comparison to NumPy are typically between 0.95 and 4.
34-
Works best on arrays that do not fit in CPU cache.
34+
Performance improves normaly most with arrays that do not fit in CPU cache.
3535

3636
Supported operators and functions include e.g.:
3737

docs/mooc/numerical-computing/simple-operations.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ print(a * a)
3030

3131
NumPy provides also a wide range of elementary mathematical functions (sin,
3232
cos, exp, sqrt, log, ...) that work with arrays (as well as single values). In
33-
many ways it can be used as a drop-in replacement for the `math` module.
33+
many ways NumPy can be used as a drop-in replacement for the `math` module.
3434

3535
~~~python
3636
import numpy, math

docs/mooc/numerical-computing/temporary-arrays.md

+2-3
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,7 @@ c = (numpy.sin(a) + numpy.cos(b)) + 2.0 * a - 4.5 * b
5252

5353
Sometimes it is hard to see how many temporary arrays are needed, but if one
5454
wants to conserve memory (when working with very, very large arrays), it is
55-
usually a good idea to do apply operations on an existing array one by one
56-
instead.
55+
usually a good idea to apply operations on an existing array one by one:
5756

5857
~~~python
5958
c = 2.0 * a
@@ -65,7 +64,7 @@ c += np.cos(b)
6564
### Broadcasting and temporary arrays
6665

6766
Broadcasting approaches can also lead to unexpected temporary arrays. For
68-
example, let use consider the calculation of the pairwise distance of **M**
67+
example, let us consider the calculation of the pairwise distance of **M**
6968
points in three dimensions.
7069

7170
Input data is a M x 3 array and output is a M x M array containing the

docs/mooc/numerical-computing/vectorised-operations.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ loops.
1111

1212
For loops in Python are slow. If one needs to apply a mathematical operation
1313
on multiple (consecutive) elements of an array, it is always better to use a
14-
vectorised operation if at all possible.
14+
vectorised operation if possible.
1515

1616
In practice, a vectorised operation means reframing the code in a manner that
1717
completely avoids a loop and instead uses e.g. slicing to apply the operation

0 commit comments

Comments
 (0)