# Math

Some essential math

## Vectors

Represented by a matrix `r` as:

\begin{equation*}
r = \begin{bmatrix} i \\ j \end{bmatrix}
\end{equation*}

The vector above has 2 components `i` and `j`. 

### Vector Operations


#### Scalar Multiplication

\begin{equation*} 
A \times r = A \begin{bmatrix} r_i \\ r_j \end{bmatrix} = \begin{bmatrix} A \times r_i \\ A \times r_j \end{bmatrix}
\end{equation*} 


**NOTE:** Reversing direction of Vector
Is the same as $-1 \times \vec{\mathbf{r}} $

#### Addition to 2 vectors


```         
            x
   x       /
    \     / r
   s \   /
   
 r + s = 
       x
       | \ s
  r+s  |   X 
       |  /
       | / r
       |/


```

\begin{equation} 
r = \begin{bmatrix} r_i \\ r_j \end{bmatrix}
s = \begin{bmatrix} s_i \\ s_j \end{bmatrix} 
\end{equation}

`r + s`  will be 

\begin{equation} 
r + s = \begin{bmatrix} r_i + s_i \\ r_j + s_j \end{bmatrix}
\end{equation}

which would be 
\begin{equation*}
\mathbf{V}_1 \times \mathbf{V}_2 =  \begin{vmatrix}
\mathbf{i} & \mathbf{j} & \mathbf{k} \\
\frac{\partial X}{\partial u} &  \frac{\partial Y}{\partial u} & 0 \\
\frac{\partial X}{\partial v} &  \frac{\partial Y}{\partial v} & 0
\end{vmatrix}
\end{equation*}




```python
%matplotlib inline

import numpy as np
import matplotlib.pyplot as plt

fig, ax = plt.subplots()
x = np.linspace(0,1)
ax.plot(x, x, 'o')

ax.annotate('default line', xy=(0.15,0.1), xytext=(0.6,0.1),
            arrowprops={'arrowstyle': '-'}, va='center')
ax.annotate('dashed line', xy=(0.25,0.2), xytext=(0.6,0.2),
            arrowprops={'arrowstyle': '-', 'ls': 'dashed'}, va='center')
ax.annotate('default arrow', xy=(0.35,0.3), xytext=(0.6,0.3),
            arrowprops={'arrowstyle': '->'}, va='center')
ax.annotate('thick blue arrow', xy=(0.45,0.4), xytext=(0.6,0.4),
            arrowprops={'arrowstyle': '->', 'lw': 4, 'color': 'blue'},
            va='center')
ax.annotate('double-headed arrow', xy=(0.45,0.5), xytext=(0.01,0.5),
            arrowprops={'arrowstyle': '<->'}, va='center')
ax.annotate('arrow with closed head', xy=(0.55,0.6), xytext=(0.1,0.6),
            arrowprops={'arrowstyle': '-|>'}, va='center')
ax.annotate('a really thick red arrow\nwith not much space', xy=(0.65,0.7),
            xytext=(0.1,0.7), va='center', multialignment='right',
            arrowprops={'arrowstyle': '-|>', 'lw': 8, 'ec': 'r'})
ax.annotate('a really thick red arrow\nwith space between\nthe tail and the'
            'label', xy=(0.85,0.9), xytext=(0.1,0.9), va='center',
            multialignment='right',
            arrowprops={'arrowstyle': '-|>', 'lw': 8, 'ec': 'r', 'shrinkA': 10})

plt.show()

```



2757340a0361fa489572eda0ed95c8d581093ffd
ipynb
Jupyter Notebook
machine-learning/math/LinearAlgebra.ipynb
sthaha/notes
1866ba8e8d916d23d3d4f19413e27136421d6e39
MIT
2020-12-11T21:29:03.000Z
2021-05-13T04:45:08.000Z
machine-learning/math/LinearAlgebra.ipynb
sthaha/notes
1866ba8e8d916d23d3d4f19413e27136421d6e39
MIT
2020-12-09T13:07:30.000Z
2020-12-09T13:07:30.000Z
machine-learning/math/LinearAlgebra.ipynb
sthaha/notes
1866ba8e8d916d23d3d4f19413e27136421d6e39
MIT
Qwen/Qwen-72B
1. YES
2. YES