Skip to main content

Posts

Showing posts with the label vector arithmetic

Vectors and Vector Arithmetic,dot product,vector norm

Vectors are a foundational element of linear algebra. Vectors are used throughout the fi eld of machine learning in the description of algorithms and processes such as the target variable (y) when training an algorithm A vector is a tuple of one or more values called scalars.Vectors are often represented using a lowercase character such as v; for example: v = (v1; v2; v3) Where v1, v2, v3 are scalar values, often real values. Vectors are also shown using a vertical representation or a column; for example: v =v1       v2       v3 Defining a Vector We can represent a vector in Python as a NumPy array. A NumPy array can be created from a list of numbers. For example, below we defi ne a vector with the length of 3 and the integer values 1,2,3. from numpy import array # define vector v = array([1, 2, 3]) print(v) [1 2 3] Vector Arithmetic Vector Addition Two vectors of equal length can be added together to create a new third vector # vector addition from numpy impor