Linear Algebra - Vector

1 - About

A vector is a list of number used to represent a function

When the letters are in bold in a formula, it signifies that they're vectors,

To represent the below function:

<math> \begin{array}{rrr} 0 & \mapsto & 8 \\ 1 & \mapsto & 7 \\ 2 & \mapsto & −1 \\ 3 & \mapsto & 2 \\ \end{array} </math>

where:

  • {0,1,2,3} is the domain
  • {8, 7, −1, 2} is the image of the domain.

we use the following dictionary 4-vector:

<math>\{0:8, 1:7,2:−1, 3:2\}</math>

that can be simplified as this list of number:

<math>[8, 7,−1,2]</math>

Technically, a vector is:

  • a function from some domain D to a field
  • a function <math>v : D \mapsto C</math>, where D and C are the domain and co-domain, and C is a field.

3 - Data Structure

3.1 - Dictionary

Python’s dictionaries can represent such vectors, e.g.

{0:8, 1:7, 2:-1, 3:2}

The following convention is often adopted: entries with value zero may be omitted from the dictionary.

3.2 - Class

A class Vec with two instance variables (fields):

  • f, the function, represented by a dictionary, and
  • D, the domain of the function, represented by a set.

3.3 - List

A list L must be viewed as a function where the domain is the index of the value ie {0, 1, 2, . . . , len(L)}.

Example: <math>[8,7,-1,2]</math>

4 - Example of n-vectors

  • A 4-vector over <math>\mathbb{R}</math>:

<math>[8, 7,−1,2]</math>

  • A 3-vector over <math>\mathbb{R}</math>:

<math>[8, 7,−1]</math>

5 - Operations

6 - Application

Used to represent

6.1 - Document

In information retrieval, a document is represented (bag of words model) by a function <math>f : WORDS \mapsto \mathbb{R}</math> specifying, for each word, how many times it appears in the document.

For any single document, most words in the word dictionary are of course not represented. They should be mapped to zero but a convenient convention for representing vectors by dictionaries allow to omit pairs when the value is zero.

Example representing a WORDS-vector over bbR: “The rain in Spain falls mainly on the plain” would be represented by the dictionary

{’on’: 1, ’Spain’: 1,in’: 1, ’plain’: 1, ’the’: 2, ’mainly’: 1, ’rain’: 1, ’falls’: 1}

6.2 - Binary string

(for cryptography/information theory)

6.3 - Collection of attributes

  • Senate voting record
  • demographic record of a consumer
  • characteristics of cancer cells

6.4 - State of a system

  • Population distribution in the world
  • number of copies of a virus in a computer network
  • state of a pseudo-random generator
  • state of Lights Out

6.5 - Probability distribution

Mathematics - Probability distribution function e.g. {1:1/6, 2:1/6, 3:1/6, 4:1/6, 5:1/6, 6:1/6}

6.6 - Image

{(0,0): 0, (0,1): 0, (0,2): 0, (0,3): 0,
(1,0): 32, (1,1): 32, (1,2): 32, (1,3): 32,
(2,0): 64, (2,1): 64, (2,2): 64, (2,3): 64,
(3,0): 96, (3,1): 96, (3,2): 96, (3,3): 96,
(4,0): 128, (4,1): 128, (4,2): 128, (4,3): 128,
(5,0): 160, (5,1): 160, (5,2): 160, (5,3): 160,
(6,0): 192, (6,1): 192, (6,2): 192, (6,3): 192,
(7,0): 224, (7,1): 224, (7,2): 224, (7,3): 224 }

6.7 - Point

  • Can interpret the 2-vector [x, y] as a point in the plane.
  • Can interpret 3-vectors as points in space, and so on.

7 - Type

7.1 - Zero

The D-vector whose entries are all zero is the zero vector, written 0_D or just 0.

To test if a vector v should be considered a zero vector, you can see if the square of its norm is very small, e.g. less than <math>10^{-20}</math>

7.2 - Sparse

A vector most of whose values are zero is called a sparse vector.

If no more than k of the entries are non-zero, we say the vector is k-sparse. A k-sparse vector can be represented using space proportional to k. For instance, when we represent a corpus of documents by WORD-vectors, the storage required is proportional to the total number of words in all documents.

Most signals acquired via physical sensors (images, sound, …) are not exactly sparse.

7.3 - Orthonormal

Vectors that are mutually orthogonal and have norm 1 are orthonormal

8 - Set of vector

Set of all 4-vectors over bbR is written bbR^4. See set

Example of gf2 Set: GF(2)^5 is the set of 5-element bit sequences, e.g. [0,0,0,0,0], [0,0,0,0,1], …

9 - Representation

n-vectors over bbR can be visualized as arrows in bbR^n

The 2-vector [3, 1.5] can be represented by an arrow
with its tail at the origin and its head at (3, 1.5)
or, equivalently, by an arrow whose tail is at (-2,-1)
and whose head is at (1,0.5)

10 - Mathematicians

Mathematicians
William Rowan Hamilton
William Rowan Hamilton, the inventor of the theory of quaternions.
The quaternions are a number system that extends the complex numbers.
i^2 = j^2 = k^2 = ijk = -1
Josiah Willard Gibbs
Developed vector analysis as an alternative to quaternions.

11 - Documentation / Reference

linear_algebra/vector.txt · Last modified: 2018/11/21 20:10 by gerardnico