<jupyter_start><jupyter_text>Scalars For example, $n \in \mathbb{N}$ or $s \in \mathbb{R}$<jupyter_code>n = 3
s = 4.67<jupyter_output><empty_output><jupyter_text>Vectors$\boldsymbol{x} = \begin{bmatrix}x_{1} \\ x_{2} \\ \vdots \\ x_{n}\end{bmatrix}$<jupyter_code>x = np.array([[2],
              [3],
              [5],
              [7],
              [11],
              [13]])
print(x)
print("\nshape:",x.shape)<jupyter_output>[[ 2]
 [ 3]
 [ 5]
 [ 7]
 [11]
 [13]]

shape: (6, 1)<jupyter_text>$x_{i} = x_{i,j}$<jupyter_code>print(x[5][0])<jupyter_output>13<jupyter_text>Transpose$x^\top = [x_{1}, x_{2}, ..., x_{3}]$<jupyter_code>print(x.T)
print("\nshape:",x.T.shape)<jupyter_output>[[ 2  3  5  7 11 13]]

shape: (1, 6)<jupyter_text>Matrices$\boldsymbol{A} \in \mathbb{R}^{m \times n}$For example, $\boldsymbol{A} \in \mathbb{R}^{2 \times 3}$$\boldsymbol{A} = \begin{bmatrix}A_{1,1} & A_{1,2} & A_{1,3} \\ A_{2,1} & A_{2,2} & A_{2,3}\end{bmatrix}$<jupyter_code>A = np.array([[2,3,5],
              [7,11,13]])
print(A)
print("\nshape:",A.shape)<jupyter_output>[[ 2  3  5]
 [ 7 11 13]]

shape: (2, 3)<jupyter_text>$A_{i,j}$<jupyter_code>print(A[1][2])
A = np.matrix('2 3 5; 7 11 13')
print(A)
print("\nshape:",A.shape)
print(A.item(1,2))<jupyter_output>13<jupyter_text>Transpose$(\boldsymbol{A}^\top)_{i,j} = A_{j,i}$$\boldsymbol{A} \implies \boldsymbol{A}^\top = \begin{bmatrix}A_{1,1} & A_{2,1} \\ A_{1,2} & A_{2,2} \\ A_{1,3} & A_{2,3}\end{bmatrix} = \begin{bmatrix}A^\top_{1,1} & A^\top_{1,2} \\ A^\top_{2,1} & A^\top_{2,2} \\ A^\top_{3,1} & A^\top_{3,2}\end{bmatrix}$<jupyter_code>print(A.T)
print("\nshape:",A.T.shape)<jupyter_output>[[ 2  7]
 [ 3 11]
 [ 5 13]]

shape: (3, 2)<jupyter_text>Tensors$\textsf{A} \in \mathbb{R}^{m \times n \times o}$For example, $\textsf{A} \in \mathbb{R}^{2 \times 3 \times 2}$<jupyter_code>A = np.array([2,3,5,7,11,13,2,4,6,8,10,12]).reshape(2,3,2)
print(A)
print("\nshape:",A.shape)
A = np.array([[[2, 3],
               [5, 7],
               [11, 13]],
              [[2, 4],
               [6, 8],
               [10, 12]]])
print(A)
print("\nshape:",A.shape)<jupyter_output>[[[ 2  3]
  [ 5  7]
  [11 13]]

 [[ 2  4]
  [ 6  8]
  [10 12]]]

shape: (2, 3, 2)<jupyter_text>$\textsf{A}_{i,j,k}$<jupyter_code>print(A[0][2][1])<jupyter_output>13<jupyter_text>Matrix Addition$\boldsymbol{C} = \boldsymbol{A} + \boldsymbol{B}$, where $C_{i,j} = A_{i,j} + B_{i,j}$<jupyter_code>A = np.matrix('2 3 5; 7 11 13')
B = np.matrix('2 4 6; 8 10 12')
C = A + B
print(C)
print("\nshape:",C.shape)<jupyter_output>[[ 4  7 11]
 [15 21 25]]

shape: (2, 3)
{'fraction_non_alphanumeric': 0.2620341614906832, 'fraction_numerical': 0.08190993788819875, 'mean_word_length': 3.798882681564246, 'pattern_counts': {'":': 0, '<': 32, '<?xml version=': 0, '>': 32, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '10', 'dir': 'jupyter-structured-clean-dedup', 'id': '133899', 'license': 'MIT', 'n_tokens_mistral': 1341, 'n_tokens_neox': 1214, 'n_words': 194, 'path': 'notebooks/LinearAlgebra.ipynb', 'repo_name': 'austinjalexander/math', 'size': '2576'}