You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -407,7 +406,7 @@ np.sum(x*y) # Inner product of x and y
407
406
```
408
407
409
408
```{code-cell} ipython3
410
-
x @ y # Another way to compute the inner product
409
+
x @ y # Another way to compute the inner product
411
410
```
412
411
413
412
```{code-cell} ipython3
@@ -596,9 +595,9 @@ AB =
596
595
\end{bmatrix}
597
596
$$
598
597
599
-
There are many tutorials to help you further visualize this operation, such as
598
+
There are many tutorials to help you further visualize this operation, such as
600
599
601
-
*[this one](http://www.mathsisfun.com/algebra/matrix-multiplying.html), or
600
+
*[this one](http://www.mathsisfun.com/algebra/matrix-multiplying.html), or
602
601
* the discussion on the [Wikipedia page](https://en.wikipedia.org/wiki/Matrix_multiplication).
603
602
604
603
@@ -609,7 +608,7 @@ Unlike number products, $A B$ and $B A$ are not generally the same thing.
609
608
ONe important special case is the [identity matrix](https://en.wikipedia.org/wiki/Identity_matrix), which has ones on the principal diagonal and zero elsewhere:
610
609
611
610
$$
612
-
I =
611
+
I =
613
612
\begin{bmatrix}
614
613
1 & \cdots & 0 \\
615
614
\vdots & \ddots & \vdots \\
@@ -692,16 +691,16 @@ First we rewrite {eq}`two_eq_demand` as
692
691
:label: two_eq_demand_mat
693
692
q^d = D p + h
694
693
\quad \text{where} \quad
695
-
q^d =
694
+
q^d =
696
695
\begin{bmatrix}
697
696
q_0^d \\
698
697
q_1^d
699
698
\end{bmatrix}
700
699
\quad
701
-
D =
700
+
D =
702
701
\begin{bmatrix}
703
702
-10 & - 5 \\
704
-
- 1 & - 10
703
+
- 1 & - 10
705
704
\end{bmatrix}
706
705
\quad \text{and} \quad
707
706
h =
@@ -717,18 +716,18 @@ We rewrite {eq}`two_eq_supply` as
717
716
718
717
```{math}
719
718
:label: two_eq_supply_mat
720
-
q^s = C p
719
+
q^s = C p
721
720
\quad \text{where} \quad
722
-
q^s =
721
+
q^s =
723
722
\begin{bmatrix}
724
723
q_0^s \\
725
724
q_1^s
726
725
\end{bmatrix}
727
726
\quad \text{and} \quad
728
-
C =
727
+
C =
729
728
\begin{bmatrix}
730
729
10 & 5 \\
731
-
5 & 10
730
+
5 & 10
732
731
\end{bmatrix}
733
732
```
734
733
@@ -738,7 +737,7 @@ $$
738
737
C p = D p + h
739
738
$$
740
739
741
-
We can rearrange the terms to get
740
+
We can rearrange the terms to get
742
741
743
742
$$
744
743
(C - D) p = h
@@ -789,13 +788,13 @@ To find an equilibrium, we solve $Dp + h = Cp + e$, or
789
788
790
789
```{math}
791
790
:label: n_eq_sys_la
792
-
(D- C)p = e - h
791
+
(D- C)p = e - h
793
792
```
794
793
795
794
The solution is
796
795
797
-
$$
798
-
p = (D- C)^{-1}(e - h)
796
+
$$
797
+
p = (D- C)^{-1}(e - h)
799
798
$$
800
799
801
800
@@ -813,7 +812,7 @@ A more general version of the problem described above looks as follows.
813
812
\end{matrix}
814
813
```
815
814
816
-
The objective here is to solve for the "unknowns" $x_1, \ldots, x_n$
815
+
The objective here is to solve for the "unknowns" $x_1, \ldots, x_n$
817
816
818
817
We take as given the coefficients $a_{11}, \ldots, a_{nn}$ and constants $b_1, \ldots, b_n$.
819
818
@@ -831,7 +830,7 @@ In matrix form, the system {eq}`la_se` becomes
831
830
:label: la_gf
832
831
A x = b
833
832
\quad \text{where} \quad
834
-
A =
833
+
A =
835
834
\begin{bmatrix}
836
835
a_{11} & \cdots & a_{1n} \\
837
836
\vdots & \vdots & \vdots \\
@@ -846,10 +845,10 @@ In matrix form, the system {eq}`la_se` becomes
846
845
\end{bmatrix}
847
846
```
848
847
849
-
For example, {eq}`n_eq_sys_la` has this form with
848
+
For example, {eq}`n_eq_sys_la` has this form with
850
849
851
-
$$
852
-
A = D - C,
850
+
$$
851
+
A = D - C,
853
852
\quad
854
853
b = e - h
855
854
\quad \text{and} \quad
@@ -924,7 +923,7 @@ We can rewrite this system in matrix form as
924
923
A =
925
924
\begin{bmatrix}
926
925
1 & 3 \\
927
-
2 & 6
926
+
2 & 6
928
927
\end{bmatrix}
929
928
\quad \text{and} \quad
930
929
b =
@@ -965,7 +964,7 @@ Any vector $v = (x,y)$ such that $x = 2y - 4$ will solve the above system.
965
964
966
965
Since we can find infinite such vectors this system has infinitely many solutions.
967
966
968
-
This is because the rows of the corresponding matrix
967
+
This is because the rows of the corresponding matrix
969
968
970
969
```{math}
971
970
:label: many_solns
@@ -1177,7 +1176,7 @@ A =
1177
1176
p_2
1178
1177
\end{bmatrix}
1179
1178
\quad \text{and} \quad
1180
-
b =
1179
+
b =
1181
1180
\begin{bmatrix}
1182
1181
100 \\
1183
1182
75 \\
@@ -1235,7 +1234,7 @@ When faced with an inconsistent system we try to find the best "approximate" sol
1235
1234
1236
1235
There are various methods to do this, one such method is the **method of least squares.**
1237
1236
1238
-
Suppose we have an inconsistent system
1237
+
Suppose we have an inconsistent system
1239
1238
1240
1239
```{math}
1241
1240
:label: inconsistent
@@ -1249,11 +1248,11 @@ is less than the distance from $Ax$ to $b$.
1249
1248
That is,
1250
1249
1251
1250
$$
1252
-
\|A\hat{x} - b\| \leq \|Ax - b\|
1251
+
\|A\hat{x} - b\| \leq \|Ax - b\|
1253
1252
$$
1254
1253
1255
1254
It can be shown that, for the system of equations $Ax = b$, the least squares
1256
-
solution $\hat{x}$ is
1255
+
solution $\hat{x}$ is
1257
1256
1258
1257
```{math}
1259
1258
:label: least_squares
@@ -1367,5 +1366,3 @@ plt.show()
1367
1366
The documentation of the `numpy.linalg` submodule can be found [here](https://numpy.org/devdocs/reference/routines.linalg.html).
1368
1367
1369
1368
More advanced topics in linear algebra can be found [here](https://python.quantecon.org/linear_algebra.html#id5).
0 commit comments