Alterna · learning material

01.1. Vector and its coordinates

You can ask the arrow in two numbers on the plane: how many to the right and to the top. The four numbers of the model are the same order, but you can't see it on the whole plane.

What this material covers

Content and key concepts

We can read coordinates and add numbers.
You can ask the arrow in two numbers on the plane: how many to the right and to the top. The four numbers of the model are the same order, but you can't see it on the whole plane.
Two sets of numbers: [3.4] and [2.0].
Координаты и расчёт геометрического примера приведены в тексте. Для изменения пространственного рисунка включитеJavaScript.
Coordinates describe the object, but do not exhaust it.
In the language model, the current becomes the ID first, but the ID remains the address: arithmetic over string numbers does not have to have meaningful meaning. To add up the images, change their scale and measure the consistency of directions, an object with pre-defined operations is needed. This is a vector. This chapter deals with the physical space.
R
n
\mathbb R^n
R
n
where each vector, after choosing the base, is recorded in an orderly set of
n
n
n
numbers.
Recording
x
=
[
3
,
4
]
T
x=[3,4]^T
x
=
[
3
,
4
]
T
You can read in two compatible ways. Algebraically these coordinates are in the order chosen. Geometrically on the plane, this is a directional segment with 3 on the first axle and 4 on the second.
(
0
,
0
)
(0,0)
(
0
,
0
)
in
(
3
,
4
)
(3,4)
(
3
,
4
)
And the shooter from
(
1
,
−
1
)
(1,-1)
(
1
,
−
1
)
in
(
4
,
3
)
(4,3)
(
4
,
3
)
One free vector is represented: both have a "end minus start" difference equals
[
3
,
4
]
T
[3,4]^T
[
3
,
4
]
T
.
The selection of the beginning of the coordinates refers to the drawing and not to the freest vector. The choice of the base line, on the contrary, determines the numbers by which the vector is recorded. Therefore, the phrase "vector is equal to a pair of numbers" is allowed only after the fixation of the basics and the order of coordinates.
Operations are being coordinated
For
x
,
y
∈
R
n
x,y\in\mathbb R^n
x
,
y
∈
R
n
and
α
∈
R
\alpha\in\mathbb R
α
∈
R
:
(
x
+
y
)
i
=
x
i
+
y
i
,
(
α
x
)
i
=
α
x
i
,
i
=
1
,
…
,
n
.
(x+y)_i=x_i+y_i,
\qquad
(\alpha x)_i=\alpha x_i,
\qquad i=1,\ldots,n.
(
x
+
y
)
i
​
=
x
i
​
+
y
i
​
,
(
αx
)
i
​
=
α
x
i
​
,
i
=
1
,
…
,
n
.
Prix
x
=
[
3
,
4
]
T
x=[3,4]^T
x
=
[
3
,
4
]
T
,
y
=
[
1
,
0
]
T
y=[1,0]^T
y
=
[
1
,
0
]
T
received
x
+
y
=
[
4
,
4
]
T
,
x
−
y
=
[
2
,
4
]
T
,
−
x
=
[
−
3
,
−
4
]
T
.
x+y=[4,4]^T,
\qquad x-y=[2,4]^T,
\qquad -x=[-3,-4]^T.
x
+
y
=
[
4
,
4
]
T
,
x
−
y
=
[
2
,
4
]
T
,
−
x
=
[
−
3
,
−
4
]
T
.
The sum geometry follows the same formula.
y
y
y
so that it starts at the end
x
x
x
her new ending will end up in
(
3
+
1
,
4
+
0
)
=
(
4
,
4
)
(3+1,4+0)=(4,4)
(
3
+
1
,
4
+
0
)
=
(
4
,
4
)
It's the rule of the triangle, the parallellograms have the same result, because the bearing of the arrow doesn't change its rotation.
Multiplies to positive
α
\alpha
α
Saves direction and changes length to
∣
α
∣
|\alpha|
∣
α
∣
one. Negative
α
\alpha
α
I'm sure he's looking for a new direction.
α
=
0
\alpha=0
α
=
0
It's a zero vector. It has coordinates and it's an neutral addition element, but the zero arrow direction cannot be attributed.
Shape is part of the contract.
The addition is defined for elements of one space only:
[
3
,
4
]
+
[
1
,
0
]
[3,4]+[1,0]
[
3
,
4
]
+
[
1
,
0
]
Right, ah.
[
3
,
4
]
+
[
1
,
0
,
2
]
[3,4]+[1,0,2]
[
3
,
4
]
+
[
1
,
0
,
2
]
No additional rule defined.
shape [4096]
means one axle and 4096 component, not 4096 geometric axes of the interface. A two-dimensional drawing shows the principle, but the formula remains the same at the same time.
n
=
4096
n=4096
n
=
4096
.
The order of the component is also part of the meaning.
[
рост
,
масса
]
[\text{рост}, \text{масса}]
[
growth
,
Mass
]
change to
[
масса
,
рост
]
[\text{масса}, \text{рост}]
[
Mass
,
growth
]
you also have to reset all of the following transactions. Otherwise, the numerical form will remain and the calculated function will change. You can't add token ID and embedding just because both are represented by numbers: they have different roles and usually different Shapes.
Injectors for which implementation is checked
For any compatible vectors, properties shall be fulfilled
x
+
y
=
y
+
x
,
(
x
+
y
)
+
z
=
x
+
(
y
+
z
)
,
x
+
0
=
x
,
1
x
=
x
.
x+y=y+x,
\qquad (x+y)+z=x+(y+z),
\qquad x+0=x,
\qquad 1x=x.
x
+
y
=
y
+
x
,
(
x
+
y
)
+
z
=
x
+
(
y
+
z
)
,
x
+
0
=
x
,
1
x
=
x
.
They allow you to test the code without trusting one example. Another useful test: change only
y
2
y_2
y
2
​
has to change only the second coordinate
x
+
y
x+y
x
+
y
If the first one has changed, the indices are confused.
Intrusion of two
n
n
n
- The vectors require.
n
n
n
the sum, so its arithmetic value rises as
O
(
n
)
O(n)
O
(
n
)
The number Payload of a dense float32 vector is
4
n
4n
4
n
Byte, but this is not the size of an entire object in Python or a browser tab: the container, metadata and time values are considered separately.
x, y = [3, 4], [1, 0]
summed = [a + b for a, b in zip(x, y)]
scaled = [-1 * a for a in x]
assert summed == [4, 4]
assert scaled == [-3, -4]
The code repeats the operations just taken care of.
Completely checked Python-example Chapter
Available with a separate file; the short piece shown does not replace its implementation.
We didn't put all the numbers in one or change their order.
Where do the coordinates come from? How does this question continue?
Python examples of Chapter 01
Academic base

Textbook contents map