base_field, degree, [sparse=False]) |
Create the space of all vectors of given degree over base_field.
INPUT: base_field -- a field degree -- int >= 0, the degree of the vector space (number of components of vectors). sparse -- whether or not matrices are given a sparse representation (default to False)
coordinates,
random,
random_element,
subspace,
subspace_with_basis
These methods are defined as follows:
v) |
Write v in terms of the basis for self.
Returns a list c such that if B is the basis for self, then sum c[i] B[i] = v If v is not in self, raises an ArithmeticError exception.
[X=True], [prob=1.0], [coerce=[-2, -1, 1, 2]]) |
Returns a random element of self.
[X=True], [prob=1.0], [coerce=[-2, -1, 1, 2]]) |
Returns a random element of self.
gens) |
Create a subspace of self.
INPUT: gens -- a list of vector in self OUTPUT: VectorSpace -- the subspace spanned by the vectors in the list gens. The basis for the subspace is always put in reduced row echelon form.
sage: import sage.rings.rings as rings sage: V = VectorSpace(rings.RationalField(), 3) sage: B = V.basis() sage: W = V.subspace([B[0]+B[1], 2*B[1]-B[2]]) sage: W Vector space of degree 3, dimension 2 over Rational Field Basis matrix: [ 1 0 1/2] [ 0 1 -1/2]
basis) |
Create a subspace of self with given basis.
INPUT: basis -- a list of linearly independent vectors OUTPUT: VectorSpace_subspace_with_basis -- the subspace with given basis. The basis for the subspace is always put in reduced row echelon form.
sage: import sage.rings.rings as rings sage: V = VectorSpace(rings.RationalField(), 3) sage: B = V.basis() sage: W = V.subspace_with_basis([B[0]+B[1], 2*B[1]-B[2]]) sage: W Vector space of degree 3, dimension 2 over Rational Field User basis matrix: [ 1 1 0] [ 0 2 -1]
See About this document... for information on suggesting changes.