<jupyter_start><jupyter_text>Linear Algebra for ChELaboratory 6: Matrix Operations Discussion<jupyter_code>import numpy as np
import matplotlib.pyplot as plt
%matplotlib inline<jupyter_output><empty_output><jupyter_text>Transposition $$A=\begin{bmatrix} 4 & 8 & -2 \\ 6 & -3 & 5 \\ 9 & 3 & 7\end{bmatrix}\\$$ $$A^T=\begin{bmatrix} 4 & 6 & 9 \\ 8 & -3 & 3 \\ -2 & 5 & 7\end{bmatrix}\\$$ np.transpose() or using the T method<jupyter_code>G = np.array([
    [1,7,8],
    [3,9,0],
    [4,6,7]
])
GT1 = np.transpose(G)
GT1
GT2 = G.T
GT2
np.array_equiv(GT1, GT2)
R = np.array([
    [1,7,8,5],
    [3,9,0,4]
])
R.shape
np.transpose(R).shape
R.T.shape<jupyter_output><empty_output><jupyter_text>Dot Product/Inner Product<jupyter_code>A = np.array([
    [4,-2,4],
    [3,9,1],
    [-1,2,8]
])
C = np.array([
    [2,7,0],
    [3,-9,8],
    [4,-5,1]
])
np.array_equiv(A, C)
np.dot(A, C)
A.dot(C)
A @ C
np.matmul(A,C)<jupyter_output><empty_output><jupyter_text>Rule 1: The inner dimensions of the two matrices in question must be the same.<jupyter_code>E = np.array([
    [4,-2,8],
    [1,0,9],
    [-5,1,2],
    [3,9,6]
])
F = np.array([
    [2,7,5],
    [1,3,0],
    [5,8,-2],
    [3,-9,1]
])
G = np.array([
    [1,7],
    [3,9],
    [2,4]
])
print(E.shape)
print(F.shape)
print(G.shape)
E @ G
F @ G
E @ F
E @ F.T<jupyter_output><empty_output><jupyter_text>Rule 2: Dot Product has special properties<jupyter_code>A = np.array([
    [4,2],
    [5,-1],
    [7,4],
    [2,9]
])
B = np.array([
    [4,1],
    [8,2],
    [-5,2],
    [1,3]
])
C = np.array([
    [1,3],
    [0,-1],
    [6,5],
    [1,4]
])<jupyter_output><empty_output><jupyter_text>Determinant<jupyter_code>I = np.array([
    [4,2],
    [9,5]
])
np.linalg.det(I)
S = np.array([
    [2,5,-6],
    [4,7,9],
    [-1,8,3]
])
np.linalg.det(S)<jupyter_output><empty_output><jupyter_text>do 4X4 Inverse<jupyter_code>B = np.array([
    [3,4],
    [-1, 7]
])

np.array(B @ np.linalg.inv(B), dtype=int)
W = np.array([
              [3, 2, 5, 4],
              [4, 8, -2, 6],
              [4, 8, -2, -2],
              [9, -7, 3, 1]
])
T = np.linalg.inv(W)
T
W @ T<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.2296157450796626, 'fraction_numerical': 0.07075913776944705, 'mean_word_length': 2.9318600368324126, 'pattern_counts': {'":': 0, '<': 29, '<?xml version=': 0, '>': 29, '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': '7', 'dir': 'jupyter-structured-clean-dedup', 'id': '453299', 'license': 'Apache-2.0', 'n_tokens_mistral': 1083, 'n_tokens_neox': 1046, 'n_words': 188, 'path': 'Assignment6.ipynb', 'repo_name': 'graceeeem/Linear-Algebra_ChE_2nd-Sem-2021-2022', 'size': '2134'}