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
Copy file name to clipboardExpand all lines: lectures/linear_equations.md
+28-1Lines changed: 28 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -13,6 +13,9 @@ kernelspec:
13
13
14
14
# Linear Equations and Matrix Algebra
15
15
16
+
```{index} single: Linear Equations and Matrix Algebra
17
+
```
18
+
16
19
## Overview
17
20
18
21
Many problems in economics and finance require solving linear equations.
@@ -124,7 +127,10 @@ basics of vectors and matrices, in both theory and computation.
124
127
125
128
126
129
127
-
## Vectors
130
+
## {index}`Vectors <single: Vectors>`
131
+
132
+
```{index} single: Linear Algebra; Vectors
133
+
```
128
134
129
135
A **vector** of length $n$ is just a sequence (or array, or tuple) of $n$ numbers, which we write as $x = (x_1, \ldots, x_n)$ or $x = \begin{bmatrix}x_1, \ldots, x_n\end{bmatrix}$.
130
136
@@ -169,6 +175,9 @@ plt.show()
169
175
170
176
### Vector operations
171
177
178
+
```{index} single: Vectors; Operations
179
+
```
180
+
172
181
Sometimes we want to modify vectors.
173
182
174
183
The two most common operators on vectors are addition and scalar
@@ -352,6 +361,12 @@ x + y # Add (element-by-element)
352
361
353
362
### Inner product and norm
354
363
364
+
```{index} single: Vectors; Inner Product
365
+
```
366
+
367
+
```{index} single: Vectors; Norm
368
+
```
369
+
355
370
The **inner product** of vectors $x,y \in \mathbb R^n$ is defined as
356
371
357
372
$$
@@ -398,6 +413,9 @@ np.linalg.norm(x) # Norm of x, method two
398
413
399
414
## Matrix operations
400
415
416
+
```{index} single: Matrix; Operations
417
+
```
418
+
401
419
When we discussed linear price systems, we mentioned using matrix algebra.
402
420
403
421
Matrix algebra is similar to algebra for numbers.
@@ -599,6 +617,9 @@ It is a useful exercise to check the following:
599
617
600
618
### Matrices in NumPy
601
619
620
+
```{index} single: Matrix; Numpy
621
+
```
622
+
602
623
NumPy arrays are also used as matrices, and have fast, efficient functions and methods for all the standard matrix operations.
603
624
604
625
You can create them manually from tuples of tuples (or lists of lists) as follows
@@ -839,6 +860,9 @@ the following questions
839
860
840
861
## Solving systems of equations
841
862
863
+
```{index} single: Matrix; Solving Systems of Equations
864
+
```
865
+
842
866
Recall again the system of equations {eq}`la_se`, which we write here again as
843
867
844
868
```{math}
@@ -997,6 +1021,9 @@ This is the solution to $Ax = b$ --- the solution we are looking for.
997
1021
998
1022
### Linear equations with NumPy
999
1023
1024
+
```{index} single: Linear Algebra; SciPy
1025
+
```
1026
+
1000
1027
In the two good example we obtained the matrix equation,
0 commit comments