Linear Algebra
Table of Contents
%%html
<center><iframe src="https://www.youtube.com/embed/ZD-o6sdhNsQ?rel=0"
width="560" height="315" frameborder="0" allowfullscreen></iframe></center>
Won’t worry here about how to compute inverse, but it’s very siminp.linargr to the standard method for solving linear equations
We will use a numpy
to compute
import numpy as np
A = np.array([[4, -5],
[-2, 3]])
print(A)
b = np.array([[-13], [9]])
print(b)
A = np.asmatrix(A)
b = np.asmatrix(b)
x = A.I*b
print(x)
np.linalg.inv(A).dot(b)
import numpy as np
A = np.array([[4, -5],[-2, 3]])
print(A)
b = np.array([[-13],[9]])
print(b)
$A^{-1} b$
x = np.linalg.inv(A).dot(b)
print(x)
A = np.asmatrix(A)
b = np.asmatrix(b)
x = A.I*b
print(x)
$$
y=
\begin{bmatrix}
y_{1} \\
y_{2} \\
\vdots \\
y_{m}
\end{bmatrix}
\qquad A = \begin{bmatrix}
a_{11}&a_{12}&\cdots&a_{1n} \\
a_{21}&a_{22}&\cdots&a_{2n} \\
\vdots&\vdots&\ddots&\vdots\\
a_{m1}&a_{m2}&\cdots&a_{mn} \\
\end{bmatrix}
\qquad x=
\begin{bmatrix}
x_{1} \\
x_{2} \\
\vdots \\
x_{n}
\end{bmatrix}
$$
\begin{array}{l}
\quad & \quad & \quad & \quad & \quad & \quad & \quad & \quad & \quad & \large AX = B
\end{array}
\begin{array}{l}
\quad & \quad & \quad & \quad & \quad & \quad & \quad & \quad & \quad & \large AX = B
\end{array}
x = np.array([[1],
[1]])
y = np.array([[2],
[3]])
print(x.T.dot(y))
x = np.asmatrix(x)
y = np.asmatrix(y)
print(x.T*y)
x = np.array([[4],
[-3]])
np.linalg.norm(x, 2)
np.linalg.norm(x, 1)
Two vectors $x, y \in \mathbb{R}^n$ are orthogonal if
$$x^Ty = 0$$
They are orthonormal if, in addition,
$$\lVert x \rVert _{2} = \lVert y \rVert _{2} = 1 $$
x = np.matrix([[1],[2]])
y = np.matrix([[2],[-1]])
print(y)
z = x.T*y
print(z[0,0])
%%javascript
$.getScript('https://kmahelona.github.io/ipython_notebook_goodies/ipython_notebook_toc.js')