<jupyter_start><jupyter_text>Vector Norm<jupyter_code>import numpy as np
from scipy import signal
from scipy.spatial import distance
A = np.array([1+1j, 2+2j, 3+3j, 4+4j, 5+5j])
B = np.array([6-6j, 7-7j, 8-8j, 9-9j, 10-10j])
C = np.array([2,3,5,7,11])
Z = np.array([0,0,0,0,0])

D = np.array([A,B])<jupyter_output><empty_output><jupyter_text>For every complex inner product space V(-,-), we can define a norm or length which is a function defined as   \begin{align}  | |: V -> E  \end{align}defined as  \begin{align}  |V| = |\sqrt{V . V}|\end{align}<jupyter_code>[
np.linalg.norm(A) == np.abs(np.sqrt(np.dot(A,A))),
np.linalg.norm(B) == np.abs(np.sqrt(np.dot(B,B))),
np.linalg.norm(C) == np.abs(np.sqrt(np.dot(C,C)))
]
[
    np.linalg.norm(A),    
    np.linalg.norm(B),    
    np.linalg.norm(C),
]<jupyter_output><empty_output><jupyter_text>Vector Distance For every complex inner product space V(-,-), we can define a distance function \begin{align}      d(,) : V x V -> E\end{align}where\begin{align}      d(V1,V2) : |V1 - V2| = \sqrt{V1-V2, V1-V2}\end{align}<jupyter_code>distance.euclidean(A, B)
np.linalg.norm(A-B) == distance.euclidean(A, B)
np.round(  distance.euclidean(A, B),                 10) == \
np.round(  np.abs(np.sqrt(np.dot(A,A)-np.dot(B,B))), 10)<jupyter_output><empty_output><jupyter_text>Distance is symmetric: d(V, W) = d(W, V)<jupyter_code>distance.euclidean(A, B) == distance.euclidean(B, A)<jupyter_output><empty_output><jupyter_text>Distance satisfies the triangle inequality: d(U, V) ≤ d(U, W) + d(W, V)<jupyter_code>distance.euclidean(A, C), distance.euclidean(A, B) + distance.euclidean(B, C)
distance.euclidean(A, C) <= distance.euclidean(A, B) +  distance.euclidean(B, C)<jupyter_output><empty_output><jupyter_text>Distance is nondegenerate: d(V, W) > 0 if V ≠ W and d(V, V) = 0.<jupyter_code>distance.euclidean(Z,Z)
distance.euclidean(A,Z), distance.euclidean(A,Z) > 0<jupyter_output><empty_output><jupyter_text>Orthogonal Vectors The dot product of orthogonal vectors is zero<jupyter_code>X = np.array([1,0])
Y = np.array([0,1])
np.dot(X,Y)<jupyter_output><empty_output><jupyter_text>Kronecker Delta δj,k is called the Kronecker delta function.δj,k =    1 (if i == j);    0 (if i != j);<jupyter_code>M = np.matrix([[1,2,3],[4,5,6],[7,8,9]]); X
{ "shape": M.shape, "size": M.size }
def kronecker_delta(matrix):
    output = np.copy(matrix)
    for i in range(0, matrix.shape[0]):
        for j in range(0, matrix.shape[1]):
            output[i,j] = output[i,j] if i == j else 0
    return output
kronecker_delta(M)<jupyter_output><empty_output><jupyter_text>It is equlivant to element wise multiplication by the identity matrx<jupyter_code>np.multiply(M, np.identity(3))
kronecker_delta(M) == np.multiply(M, np.identity(M.shape[0]))<jupyter_output><empty_output><jupyter_text>NOTE: np.kron is the Kronecker (tensor) product function, and not the Kronecker DELTA<jupyter_code>np.kron(M,M)<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.18083305113443957, 'fraction_numerical': 0.023704707077548254, 'mean_word_length': 5.285106382978723, 'pattern_counts': {'":': 2, '<': 42, '<?xml version=': 0, '>': 45, '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': '14771', 'license': 'MIT', 'n_tokens_mistral': 1315, 'n_tokens_neox': 1238, 'n_words': 237, 'path': 'juypter/notebooks/linear-algebra/5_vector_norm.ipynb', 'repo_name': 'JamesMcGuigan/ecosystem-research', 'size': '2953'}