Skip to content

Commit 8684eb7

Browse files
committedJan 28, 2022
fix typos
1 parent 98e0934 commit 8684eb7

File tree

5 files changed

+7
-8
lines changed

5 files changed

+7
-8
lines changed
 

‎Python/Module3_IntroducingNumpy/Broadcasting.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -296,7 +296,7 @@ Generate a random array of 10,000 2D points using `np.random.rand`. Compute the
296296
### Inserting Size-1 Dimensions into An Array
297297
As conveyed by the broadcasting rules, dimensions of size-1 are special in that they can be broadcasted to any size. Here we will learn about introducing size-1 dimensions into an array, for the purpose of tailoring its shape for broadcasting.
298298

299-
You can introduce size-1 dimensions to an array without changing the overall size (i.e. total number of entries in an array. Thus we are free to add size-1 dimensions to an array via the `reshape` function. Let's reshape a shape-(3,) array into a shape-(1, 3, 1, 1) array:
299+
You can introduce size-1 dimensions to an array without changing the overall size (i.e. total number of entries in an array). Thus we are free to add size-1 dimensions to an array via the `reshape` function. Let's reshape a shape-(3,) array into a shape-(1, 3, 1, 1) array:
300300
```python
301301
>>> import numpy as np
302302

@@ -528,7 +528,7 @@ array([[ 3.678 , 8.4524, 10.3057, 7.3711, 6.2152, 5.5548],
528528

529529
<!-- #region -->
530530
### Pairwise Distances Using Broadcasting (Unoptimized)
531-
Now, let's use of vectorization to perform this distance computation. It must be established immediately that the method that we about to develop here is memory-inefficient. We will address this issue in detail at the end of this subsection.
531+
Now, let's make use of vectorization to perform this distance computation. It must be established immediately that the method that we are about to develop here is memory-inefficient. We will address this issue in detail at the end of this subsection.
532532

533533
We start off our vectorized computation by shrewdly inserting size-1 dimensions into `x` and `y`, so that we can perform $M \times N$ subtractions between their pairs of length-$D$ rows. *This creates a shape-*$(M, N, D)$ *array*.
534534

@@ -652,7 +652,7 @@ In terms of pure mathematics, `x_y_sqrd - x_y_prod` must be a strictly non-negat
652652
\sum_{i=0}^{D-1}{(x_{i} - y_{i})^2}
653653
\end{equation}
654654

655-
That being said, are working with floating-point numbers, which do not always behave exactly like rational numbers when we do arithmetic with them.
655+
That being said, we are working with floating-point numbers, which do not always behave exactly like rational numbers when we do arithmetic with them.
656656
Indeed, we saw earlier that the [quirks of floating-point arithmetic](https://www.pythonlikeyoumeanit.com/Module2_EssentialsOfPython/Basic_Objects.html#Understanding-Numerical-Precision) can lead to surprising results.
657657
Here, the strange behavior is that `x_y_sqrd - x_y_prod` **can produce negative numbers**!
658658

‎Python/Module4_OOP/Applications_of_OOP.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ Let's create a shopping list class, where an instance of this class stores a lis
3030
- mark items on the list as "purchased"
3131
- remove items, purchased or not, from the list
3232
- list the name of the items to-be purchased (in alphabetical order)
33-
- list the name of the items have been purchased (in alphabetical order)
33+
- list the name of the items that have been purchased (in alphabetical order)
3434

3535
We do not want redundant items to be included on our shopping list - if someone enters "apples" twice, we should only list it once. Thus we will make use of [sets](http://www.pythonlikeyoumeanit.com/Module2_EssentialsOfPython/DataStructures_III_Sets_and_More.html#The-%E2%80%9CSet%E2%80%9D-Data-Structure), which store unique elements, to store the items on our list.
3636

‎Python/Module4_OOP/ClassDefinition.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ jupyter:
2222
<!-- #region -->
2323
# Defining a New Class of Object
2424

25-
This section will introduce the basic syntax for defining a new class (a.k.a. type) of Python object. Recall that the phrase `def` is used to denote the definition of a function. Similarly, `class` is used to denote the beginning of a class definition. The body of the class definition, which is the indented region below a `class` statement, is used to define the class' various **attributes**.
25+
This section will introduce the basic syntax for defining a new class (a.k.a. type) of Python object. Recall that the statement `def` is used to denote the definition of a function. Similarly, `class` is used to denote the beginning of a class definition. The body of the class definition, which is the indented region below a `class` statement, is used to define the class' various **attributes**.
2626

2727
The following defines a new class of object, named `MyGuy`, specifying four attributes `x`, `y`, `z`, and `f`
2828

‎Python/Module4_OOP/Inheritance.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,8 @@ Having defined our subclass, we can leverage the other methods of `Rectangle` as
5959
# create a square of side-length 2
6060
>>> my_square = Square(2)
6161

62-
# using the inherited `get_area` method
63-
>>> my_square.get_area()
62+
# using the inherited `compute_area` method
63+
>>> my_square.compute_area()
6464
4
6565

6666
# a square is a rectangle with equal height/width

‎Python/Module4_OOP/Methods.md

-1
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,6 @@ True
191191
# even when `class_func` is called from an instance
192192
>>> inst = Dummy()
193193
>>> inst.class_func()
194-
>>> inst.class_func()
195194
__main__.Dummy
196195
```
197196
<!-- #endregion -->

0 commit comments

Comments
 (0)
Failed to load comments.