Chapter: Vector
What is a Vector?
A vector is a fundamental mathematical concept in linear algebra and geometry. It represents a quantity that has both magnitude (length) and direction. Vectors are often used to describe physical quantities such as displacement, velocity, and force.
Example:
Imagine you are navigating through a two-dimensional space, and you want to represent your movement from the origin (0,0) to a point (3,4). You can express this movement as a vector v:
$$v = [3, 4]$$
In this vector, the number 3 represents the horizontal displacement, and the number 4 represents the vertical displacement. The magnitude of the vector, often denoted as ||v||, is calculated using the Pythagorean theorem:
$$||v|| = √(3² + 4²) = √(9 + 16) = √25 = 5$$
So, the vector v has a magnitude of 5 and points in a direction from the origin to the point (3,4). Vectors play a crucial role in various mathematical and physical applications, including deep learning, where they are used to represent features, weights, and data points in high-dimensional spaces.
>>> import numpy as np
>>> x = np.array([1,2,3])
>>> print(x)
[123]
>>> print(x.reshape((3,1)))
[[1] [2] [3]]