8.1.1.5 FreeModule_generic Objects

class FreeModule_generic
Base class for all free modules.
FreeModule_generic( base_ring, rank, degree, [sparse=None], [inner_product_matrix=False])

Create the free module of given rank over the given base_ring.

INPUT:
    base_ring -- a commutative ring
    rank -- a non-negative integer

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

ambient_module,$  $ base_ring,$  $ basis,$  $ basis_matrix,$  $ category,$  $ coordinate_vector,$  $ coordinates,$  $ degree,$  $ dimension,$  $ discriminant,$  $ free_module,$  $ gen,$  $ inner_product_is_dot_product,$  $ inner_product_matrix,$  $ is_dense,$  $ is_finite,$  $ is_full,$  $ is_sparse,$  $ matrix,$  $ ngens,$  $ nonembedded_free_module,$  $ random_element,$  $ rank,$  $ set_inner_product_matrix,$  $ zero_vector

Further documentation:

ambient_module( )

Return the ambient module associated to this module.

base_ring( )

Return the base ring of this module.

basis( )

Return the basis of this module.

basis_matrix( )

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

category( )

Return the category to which this free module belongs.

coordinate_vector( v)

Return the a vector whose cofficients give v as a linear combination of the basis for self.

sage: M = FreeModule(IntegerRing(), 2); M0,M1=M.gens()
sage: W = M.submodule([M0 + M1, M0 - 2*M1])
sage: W.coordinate_vector(2*M0 - M1)
(2, -1)

coordinates( 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.

sage: M = FreeModule(IntegerRing(), 2); M0,M1=M.gens()
sage: W = M.submodule([M0 + M1, M0 - 2*M1])
sage: W.coordinates(2*M0-M1)
[2, -1]

degree( )

Return the degree of this free module. This is the dimension of the ambient vector space in which it is embedded.

sage: M = FreeModule(IntegerRing(), 10)
sage: W = M.submodule([M.gen(0), 2*M.gen(3) - M.gen(0), M.gen(0) + M.gen(3)])
sage: W.degree()
10
sage: W.rank()
2

dimension( )

Return the dimension of this free module.

sage: M = FreeModule(FiniteField(19), 100)
sage: W = M.submodule([M.gen(50)])
sage: W.dimension()
1

discriminant( )

Return the discriminant of this free module.

is_full( )

True if the rank equals the degree.

matrix( )

Return the basis matrix of this module, which is the matrix whose rows are a basis for this module.

sage: M = FreeModule(IntegerRing(), 2)
sage: M.matrix()
[1 0]
[0 1]
sage: M.submodule([M.gen(0) + M.gen(1), M.gen(0) - 2*M.gen(1)]).matrix()
[1 1]
[0 3]

random_element( [bound=1.0], [prob=0])

Returns a random element of self.

rank( )

Return the rank of this free module.

set_inner_product_matrix( A)

Set the inner product matrix of self to A.

Instances of class FreeModule_generic also have the following special methods:

__call__,$  $ __cmp__,$  $ __contains__,$  $ __len__

Further documentation:

__contains__( v)

We create the module $ \mathbf{Z}^3$ , and the submodule generated by one vector $ (1,1,0)$ , and check whether certain elements are in the submodule.

sage: R = FreeModule(IntegerRing(), 3)
sage: V = R.submodule([R.gen(0) + R.gen(1)])
sage: R.gen(0) + R.gen(1) in V
True
sage: R.gen(0) + 2*R.gen(1) in V
False

sage: Q = RationalField()
sage: w = Q('1/2')*(R.gen(0) + R.gen(1))
sage: w
(1/2, 1/2, 0)
sage: w.parent()
Vector space of dimension 3 over Rational Field
sage: w in V
False
sage: V.coordinates(w)
[1/2]

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