Definition VSCV. Vector Space of Column Vectors.
The vector space is the set of all column vectors (Definition CV) of size with entries from the set of complex numbers,
QQ
.VectorSpace()
constructor, which requires the name of the number system for the entries and the number of entries in each vector. We can display some information about the vector space, and with tab-completion you can see what functions are available. We will not do too much with these methods immediately, but instead learn about them as we progress through the theory.xxxxxxxxxx
V = VectorSpace(QQ, 8)
V
TAB
key while in the next cell to see the range of methods you can use on a vector space.xxxxxxxxxx
V.
xxxxxxxxxx
w = V.random_element()
w # random
QQ
.xxxxxxxxxx
U = CC^5
U
xxxxxxxxxx
W = QQ^3
W
xxxxxxxxxx
X = VectorSpace(QQ, 3)
W = QQ^3
X == W
+
, and scalar vector multiplication, *
. Notice that Sage is not confused by an ambiguity due to multiple meanings for the symbols +
and *
β for example, Sage knows that 3 + 12
is different than the vector additions below.xxxxxxxxxx
x = vector(QQ, [1, 2, 3])
y = vector(QQ, [10, 20, 30])
5*x
xxxxxxxxxx
x + y
xxxxxxxxxx
3*x + 4*y
xxxxxxxxxx
-y
xxxxxxxxxx
w = (-4/3)*x - (1/10)*y
w
x
.xxxxxxxxxx
x = vector([1, 2, 3])
u = 3*x
u
xxxxxxxxxx
v = (1/3)*x
v
xxxxxxxxxx
y = vector(QQ, [4, 5, 6])
w = 8*y
w
xxxxxxxxxx
z = x + y
z
x
we never specified if 1, 2, 3
are integers, rationals, reals, complexes, or β¦? Let us dig a little deeper and examine the parents of the five vectors involved.xxxxxxxxxx
x.parent()
xxxxxxxxxx
u.parent()
xxxxxxxxxx
v.parent()
xxxxxxxxxx
y.parent()
xxxxxxxxxx
w.parent()
xxxxxxxxxx
z.parent()
x
and u
belong to something called an βambient free module,β whatever that is. What is important here is that the parent of x
uses the integers as its number system. How about u
, v
, y
, w
, z
? All but the first has a parent that uses the rationals for its number system.u
is the result of scalar multiplication by an integer, so the computation and result can all be accommodated within the integers as the number system.v
involves scalar multiplication by a scalar that is not an integer, and which could be construed as a rational number. So the result needs to have a parent whose number system is the rationals.y
is created explicitly as a vector whose entries are rational numbers.w
is created only with products of integers, the fact that y
has entries considered as rational numbers, so too does the result.z
is the result of adding a vector of integers to a vector of rationals. This is the best example of coercion β Sage promotes x
to a vector of rationals and therefore returns a result that is a vector of rationals. Notice that there is no ambiguity and no argument about how to promote x
, and the same would be true for any vector full of integers.xxxxxxxxxx
t = vector([10, 20, 30])
t.parent()
xxxxxxxxxx
V = QQ^3
t_rational = V(t)
t_rational
xxxxxxxxxx
t_rational.parent()
xxxxxxxxxx
W = CC^3
t_complex = W(t)
t_complex
xxxxxxxxxx
t_complex.parent()
xxxxxxxxxx
u = vector(CC, [5*I, 4-I])
u
xxxxxxxxxx
V = QQ^2
V(u)
QQ
and you should not have any difficulties.