In GAP, a basis of a free left F-module V of dimension n (see Dimension), say, is a list of vectors B = [ v1, v2, ¼, vn ] in V such that V is generated as a left F-module by these vectors. In particular, as each basis is a list (see Chapter Lists), it has a length (see Length), and the i-th vector of B can be accessed as B[i].
gap> V:= Rationals^3; ( Rationals^3 ) gap> B:= Basis( V ); CanonicalBasis( ( Rationals^3 ) ) gap> Length( B ); 3 gap> B[1]; [ 1, 0, 0 ]
The operations described below make sense only for bases of finite dimensional vector spaces. (In practice this means that the vector spaces must be low dimensional, that is, the dimension should not exceed a few hundred.)
Besides the basic operations for lists
(see Basic Operations for Lists),
the basic operations for bases are BasisVectors (see BasisVectors),
Coefficients (see Coefficients),
LinearCombination (see LinearCombination),
and UnderlyingLeftModule (see UnderlyingLeftModule).
These and other operations for arbitrary bases are described
in Operations for Vector Space Bases.
For special kinds of bases, further operations are defined (see Operations for Special Kinds of Bases).
GAP supports the following three kinds of bases.
Relative bases delegate the work to other bases of the same free left module, via basechange matrices (see RelativeBasis).
Bases handled by nice bases delegate the work to bases of isomorphic left modules over the same left acting domain (see Vector Spaces Handled By Nice Bases). Examples of these
Finally, of course there must be bases in GAP that really do the work.
For example, in the case of a Gaussian row or matrix space V
(see Row and Matrix Spaces),
Basis( V ) is a semi-echelonized basis (see IsSemiEchelonized)
that uses Gaussian elimination; such a basis is of the third kind.
Basis( V, vectors ) is either semi-echelonized or a relative basis.
Other examples of bases of the third kind are canonical bases of finite
fields and of abelian number fields.
Bases handled by nice bases are described in Vector Spaces Handled By Nice Bases. Examples are non-Gaussian row and matrix spaces, and subspaces of finite fields and abelian number fields that are themselves not fields.
IsBasis( obj ) C
A basis of a free left module is an object that knows how to compute coefficients w.r.t. its basis vectors. A basis is an immutable list, the i-th entry being the i-th basis vector.
(See Mutable Bases for mutable bases.)
gap> V:= GF(2)^2;; gap> B:= Basis( V );; gap> IsBasis( B ); true gap> IsBasis( [ [ 1, 0 ], [ 0, 1 ] ] ); false
Basis( V ) A
Basis( V, vectors ) O
BasisNC( V, vectors ) O
Called with a free left F-module V as the only argument,
Basis returns an F-basis of V whose vectors are not further
specified.
If additionally a list vectors of vectors in V is given
that forms an F-basis of V then Basis returns this basis;
if vectors is not linearly independent over F or does not generate
V as a free left F-module then fail is returned.
BasisNC does the same as Basis for two arguments,
except that it does not check whether vectors form a basis.
If no basis vectors are prescribed then Basis need not compute
basis vectors; in this case, the vectors are computed in the first call
to BasisVectors.
gap> V:= VectorSpace( Rationals, [ [ 1, 2, 7 ], [ 1/2, 1/3, 5 ] ] );; gap> B:= Basis( V ); SemiEchelonBasis( <vector space over Rationals, with 2 generators>,... ) gap> BasisVectors( B ); [ [ 1, 2, 7 ], [ 0, 1, -9/4 ] ] gap> B:= Basis( V, [ [ 1, 2, 7 ], [ 3, 2, 30 ] ] ); Basis( <vector space over Rationals, with 2 generators>, [ [ 1, 2, 7 ], [ 3, 2, 30 ] ] ) gap> Basis( V, [ [ 1, 2, 3 ] ] ); fail
CanonicalBasis( V ) A
If the vector space V supports a canonical basis then
CanonicalBasis returns this basis, otherwise fail is returned.
The defining property of a canonical basis is that its vectors are uniquely determined by the vector space. If canonical bases exist for two vector spaces over the same left acting domain (see LeftActingDomain) then the equality of these vector spaces can be decided by comparing the canonical bases.
The exact meaning of a canonical basis depends on the type of V. Canonical bases are defined for example for Gaussian row and matrix spaces (see Row and Matrix Spaces).
gap> vecs:= [ [ 1, 2, 3 ], [ 1, 1, 1 ], [ 1, 1, 1 ] ];; gap> V:= VectorSpace( Rationals, vecs );; gap> B:= CanonicalBasis( V ); CanonicalBasis(<vector space over Rationals, with 3 generators>) gap> BasisVectors( B ); [ [ 1, 0, -1 ], [ 0, 1, 2 ] ]
[Top] [Previous] [Up] [Next] [Index]
GAP 4 manual