8.1.1.7 FreeModule_generic_pid Objects

class FreeModule_generic_pid
Base class for all free modules over a PID
FreeModule_generic_pid( base_ring, rank, degree, [sparse=None], [inner_product_matrix=False])

Instances of class FreeModule_generic_pid have the following methods (in addition to inherited methods and special methods):

base_field,$  $ basis_matrix,$  $ intersection,$  $ is_submodule,$  $ is_vector,$  $ submodule,$  $ submodule_with_basis,$  $ subspace,$  $ subspace_with_basis,$  $ zero_submodule

Further documentation:

basis_matrix( )

Return the matrix whose rows are the basis for this free module.

is_submodule( other)

True if this module is a submodule of other.

submodule( gens, [check=True])

Create the R-submodule of the ambient vector space with given generators, where R is the base ring of self.

INPUT:
    gens -- a list of vector in self
    check -- whether or not to verify that each gen is in
             the ambient vector space
    
OUTPUT:
    FreeModule -- the submodule spanned by the vectors in the list gens.
    The basis for the subspace is always put in reduced row echelon form.

We create a submodule of $ \mathbf{Z}^3$ :

sage: M = FreeModule(IntegerRing(), 3)
sage: B = M.basis()
sage: W = M.submodule([B[0]+B[1], 2*B[1]-B[2]])
sage: W
Free module of degree 3 and rank 2 over Integer Ring
Echelon basis matrix:
[ 1  1  0]
[ 0  2 -1]

submodule_with_basis( basis, [check=True])

Create the R-submodule of the ambient vector space with given basis, where R is the base ring of self.

INPUT:
    basis -- a list of linearly independent vectors
    check -- whether or not to verify that each gen is in
             the ambient vector space

OUTPUT:
    FreeModule -- the R-submodule with given basis

First we create a submodule of $ \mathbf{Z}^3$ :

sage: M = FreeModule(IntegerRing(), 3)
sage: B = M.basis()
sage: W = M.submodule_with_basis([B[0]+B[1], 2*B[1]-B[2]])
sage: W
Free module of degree 3 and rank 2 over Integer Ring
User basis matrix:
[ 1  1  0]
[ 0  2 -1]

subspace( gens, [check=True])

Create the vector subspace of the ambient vector space with given generators.

INPUT:
    gens -- a list of vector in self
    check -- whether or not to verify that each gen is in
             the ambient vector space
    
OUTPUT:
    a vector subspace

sage: V = VectorSpace(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 and dimension 2 over Rational Field
Basis matrix:
[   1    0  1/2]
[   0    1 -1/2]

sage: x = PolynomialRing(RationalField()).gen()
sage: K = NumberField(x**2 + 1, 'a'); a = K.gen()
sage: V = VectorSpace(K, 3)
sage: V.subspace([2*V.gen(0) + 3*V.gen(2)])
Vector space of degree 3 and dimension 1 over Number Field in a with
defining polynomial x^2 + 1
Basis matrix:
[  1   0 3/2]

subspace_with_basis( basis, [check=True])

Create the vector subspace of the ambient vector space with given basis.

INPUT:
    basis -- a list of linearly independent vectors
    check -- whether or not to verify that each gen is in
             the ambient vector space

OUTPUT:
    a vector subspace with user-specified basis

sage: V = VectorSpace(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 and dimension 2 over Rational Field
User basis matrix:
[ 1  1  0]
[ 0  2 -1]

Instances of class FreeModule_generic_pid also have the following special methods:

__add__,$  $ __mul__,$  $ __rmul__

Further documentation:

__add__( other)

Return the sum of self and other, where both self and other must be submodules of the ambient vector space.

We add two vector spaces:

sage: V  = VectorSpace(RationalField(), 3)
sage: W  = V.subspace([V([1,1,0])])
sage: W2 = V.subspace([V([1,-1,0])])
sage: W + W2
Vector space of degree 3 and dimension 2 over Rational Field
Basis matrix:
[1 0 0]
[0 1 0]

We add two free $ \mathbf{Z}$ -modules.

sage: M = FreeModule(IntegerRing(), 3)
sage: W = M.submodule([M([1,0,2])])
sage: W2 = M.submodule([M([2,0,-4])])
sage: W + W2
Free module of degree 3 and rank 2 over Integer Ring
Echelon basis matrix:
[1 0 2]
[0 0 8]

We can also add free $ \mathbf{Z}$ -modules embedded non-integrally into an ambient space.

sage: V = VectorSpace(RationalField(), 3)
sage: W = M.submodule([Q('1/2')*V.gen(0) - Q('1/3')*V.gen(1)])
sage: W2 = M.submodule([Q('1/3')*V.gen(0) + V.gen(1)])
sage: W + W2
Free module of degree 3 and rank 2 over Integer Ring
Echelon basis matrix:
[ 1/6  7/3    0]
[   0 11/3    0]

__mul__( other)

Return the product of this module by the number other, which is the module spanned by other times each basis vector.

sage: M = FreeModule(IntegerRing(), 3)
sage: 2*M
Free module of degree 3 and rank 3 over Integer Ring
Echelon basis matrix:
[2 0 0]
[0 2 0]
[0 0 2]

sage: a = RationalField()('1/3')
sage: a*M
Free module of degree 3 and rank 3 over Integer Ring
Echelon basis matrix:
[1/3   0   0]
[  0 1/3   0]
[  0   0 1/3]

See About this document... for information on suggesting changes.