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