Package sage :: Package modules :: Module free_module :: Class FreeModule_submodule_with_basis_pid
[hide private]
[frames] | no frames]

Class FreeModule_submodule_with_basis_pid

source code

                         object --+                                
                                  |                                
   structure.sage_object.SageObject --+                            
                                      |                            
                structure.parent.Parent --+                        
                                          |                        
       structure.parent_base.ParentWithBase --+                    
                                              |                    
           structure.parent_gens.ParentWithGens --+                
                                                  |                
structure.parent_gens.ParentWithAdditiveAbelianGens --+            
                                                      |            
                                          module.Module --+        
                                                          |        
                                         FreeModule_generic --+    
                                                              |    
                                         FreeModule_generic_pid --+
                                                                  |
                                                                 FreeModule_submodule_with_basis_pid
Known Subclasses:
FreeModule_submodule_with_basis_field, FreeModule_submodule_pid


An $R$-submodule of $K^n$ with distinguished basis, where $K$ is
the fraction field of a principal ideal domain $R$.



Instance Methods [hide private]
 
__init__(self, ambient, basis, check=True, echelonize=False, inner_product_matrix=['4ti2-20061025', 'R-2.6.0', 'atlas-3.7.37', 'atlas-3.8.1', 'a..., echelonized_basis=['4ti2-20061025', 'R-2.6.0', 'atlas-3.7.37', 'atlas-3.8.1', 'a..., already_echelonized=False)
Create a free module with basis over a PID.
source code
 
__hash__(self)
hash(x)
source code
 
construction(self)
Returns the functorial construction of self, namely, the subspace of the ambient module spanned by the given basis.
source code
 
echelonized_basis_matrix(self)
Return basis matrix for self in row echelon form.
source code
 
_echelonized_basis(self, ambient, basis) source code
 
__cmp__(self, other)
Compare self and other.
source code
 
_denominator(self, B) source code
 
_repr_(self) source code
 
_latex_(self)
Return latex representation of this free module.
source code
 
ambient_module(self)
Return the ambient module related to the $R$-module self, which was used when creating this module, and is of the form $R^n$.
source code
 
echelon_coordinates(self, v, check=True)
Write $v$ in terms of the echelonized basis for self.
source code
 
user_to_echelon_matrix(self)
Return matrix that transforms a vector written with respect to the user basis of self to one written with respect to the echelon basis.
source code
 
echelon_to_user_matrix(self)
Return matrix that transforms the echelon basis to the user basis of self.
source code
 
_user_to_rref_matrix(self) source code
 
_rref_to_user_matrix(self) source code
 
_echelon_to_rref_matrix(self) source code
 
_rref_to_echelon_matrix(self) source code
 
vector_space(self, base_field=['4ti2-20061025', 'R-2.6.0', 'atlas-3.7.37', 'atlas-3.8.1', 'a...)
Return the vector spaces associated to this free module via tensor product with the fraction field of the base ring.
source code
 
ambient_vector_space(self)
Return the ambient vector space in which this free module is embedded.
source code
 
basis(self)
Return the user basis for this free module.
source code
 
change_ring(self, R)
Return the free module over R obtained by coercing each element of self into a vector over the fraction field of R, then taking the resulting R-module.
source code
 
coordinate_vector(self, v, check=True)
Write $v$ in terms of the user basis for self.
source code
 
echelonized_basis(self)
Return the basis for self in echelon form.
source code
 
echelon_coordinate_vector(self, v, check=True)
Write $v$ in terms of the user basis for self.
source code
 
has_user_basis(self)
Return \code{True} if the basis of this free module is specified by the user, as opposed to being the default echelon form.
source code
 
linear_combination_of_basis(self, v)
Return the linear combination of the basis for self obtained from the coordinates of v.
source code

Inherited from FreeModule_generic_pid: __add__, __radd__, base_field, basis_matrix, denominator, index_in, index_in_saturation, intersection, is_submodule, saturation, scale, span, span_of_basis, submodule, submodule_with_basis, vector_space_span, vector_space_span_of_basis, zero_submodule

Inherited from FreeModule_generic: __call__, __contains__, __iter__, __len__, _magma_init_, base_extend, category, coordinate_module, coordinates, degree, dense_module, dimension, direct_sum, discriminant, element_class, free_module, gen, gram_matrix, inner_product_matrix, is_ambient, is_dense, is_finite, is_full, is_sparse, matrix, ngens, nonembedded_free_module, random_element, rank, sparse_module, uses_ambient_inner_product, zero_vector

Inherited from module.Module: __new__, endomorphism_ring, is_atomic_repr

Inherited from structure.parent_gens.ParentWithAdditiveAbelianGens: generator_orders

Inherited from structure.parent_gens.ParentWithGens: __getitem__, __getslice__, __getstate__, __setstate__, _is_valid_homomorphism_, gens, gens_dict, hom, inject_variables, injvar, latex_name, latex_variable_names, list, objgen, objgens, variable_name, variable_names

Inherited from structure.parent_base.ParentWithBase: Hom, base, base_extend_canonical, base_extend_canonical_sym, base_extend_recursive, base_ring

Inherited from structure.parent.Parent: _coerce_, coerce_map_from, coerce_map_from_impl, get_action, get_action_impl, has_coerce_map_from, has_coerce_map_from_impl, init_coerce

Inherited from structure.sage_object.SageObject: __repr__, _axiom_, _axiom_init_, _gap_, _gap_init_, _gp_, _gp_init_, _interface_, _interface_init_, _interface_is_cached_, _kash_, _kash_init_, _macaulay2_, _macaulay2_init_, _magma_, _maple_, _maple_init_, _mathematica_, _mathematica_init_, _maxima_, _maxima_init_, _octave_, _octave_init_, _pari_, _pari_init_, _r_init_, _sage_, _singular_, _singular_init_, db, dump, dumps, plot, rename, reset_name, save, version

Inherited from object: __delattr__, __getattribute__, __reduce__, __reduce_ex__, __setattr__, __str__

Properties [hide private]

Inherited from structure.parent.Parent (private): _has_coerce_map_from

Inherited from object: __class__

Method Details [hide private]

__init__(self, ambient, basis, check=True, echelonize=False, inner_product_matrix=['4ti2-20061025', 'R-2.6.0', 'atlas-3.7.37', 'atlas-3.8.1', 'a..., echelonized_basis=['4ti2-20061025', 'R-2.6.0', 'atlas-3.7.37', 'atlas-3.8.1', 'a..., already_echelonized=False)
(Constructor)

source code 

Create a free module with basis over a PID.

EXAMPLES:
    sage: M = ZZ^3
    sage: W = M.span_of_basis([[1,2,3],[4,5,6]]); W
    Free module of degree 3 and rank 2 over Integer Ring
    User basis matrix:
    [1 2 3]
    [4 5 6]

Overrides: FreeModule_generic_pid.__init__

__hash__(self)
(Hashing function)

source code 
hash(x)

Overrides: FreeModule_generic.__hash__

construction(self)

source code 

Returns the functorial construction of self, namely, the
subspace of the ambient module spanned by the given basis. 

EXAMPLE: 
    sage: M = ZZ^3
    sage: W = M.span_of_basis([[1,2,3],[4,5,6]]); W
    Free module of degree 3 and rank 2 over Integer Ring
    User basis matrix:
    [1 2 3]
    [4 5 6]
    sage: c, V = W.construction()
    sage: c(V) == W
    True

Overrides: FreeModule_generic.construction

echelonized_basis_matrix(self)

source code 

Return basis matrix for self in row echelon form.

EXAMPLES:
    sage: V = FreeModule(ZZ, 3).span_of_basis([[1,2,3],[4,5,6]])
    sage: V.basis_matrix()
    [1 2 3]
    [4 5 6]
    sage: V.echelonized_basis_matrix()
    [1 2 3]
    [0 3 6]

Overrides: FreeModule_generic.echelonized_basis_matrix

__cmp__(self, other)
(Comparison operator)

source code 

Compare self and other.

Modules are ordered by their ambient spaces, then by
dimension, then in order by their echelon matrices.

NOTE: Use the \code{is_submodule} to determine if one module
is a submodule of another.

EXAMPLES:
First we compare two equal vector spaces.
    sage: V = span(QQ, [[1,2,3], [5,6,7], [8,9,10]])
    sage: W = span(QQ, [[5,6,7], [8,9,10]])
    sage: V == W
    True
    
Next we compare a one dimensional space to the two dimensional space
defined above. 
    sage: M = span(QQ, [[5,6,7]])
    sage: V == M
    False
    sage: M < V
    True
    sage: V < M
    False

We compare a $\Z$-module to the one-dimensional space above.
    sage: V = span(ZZ, [[5,6,7]]).scale(1/11);  V
    Free module of degree 3 and rank 1 over Integer Ring
    Echelon basis matrix:
    [5/11 6/11 7/11]
    sage: V < M
    True
    sage: M < V
    False

Overrides: FreeModule_generic.__cmp__

_latex_(self)

source code 

Return latex representation of this free module.

EXAMPLES:
    sage: A = ZZ^3
    sage: M = A.span_of_basis([[1,2,3],[4,5,6]])
    sage: M._latex_()
    '\\mbox{\\rm RowSpan}_{\\mathbf{Z}}\\left(\\begin{array}{rrr}\n1 & 2 & 3 \\\\\n4 & 5 & 6\n\\end{array}\\right)'

ambient_module(self)

source code 

Return the ambient module related to the $R$-module self, which 
was used when creating this module, and is of the form $R^n$.   Note 
that self need not be contained in the ambient module, though self
will be contained in the ambient vector space. 

EXAMPLES: 
    sage: A = ZZ^3
    sage: M = A.span_of_basis([[1,2,'3/7'],[4,5,6]])
    sage: M
    Free module of degree 3 and rank 2 over Integer Ring
    User basis matrix:
    [  1   2 3/7]
    [  4   5   6]
    sage: M.ambient_module()
    Ambient free module of rank 3 over the principal ideal domain Integer Ring
    sage: M.is_submodule(M.ambient_module())
    False

Overrides: FreeModule_generic.ambient_module

echelon_coordinates(self, v, check=True)

source code 

Write $v$ in terms of the echelonized basis for self.

INPUT:
    v -- vector
    check -- bool (default: True); if True, also verify that v is really in self.
OUTPUT:
    list

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 \code{ArithmeticError} exception.

EXAMPLES:
    sage: A = ZZ^3
    sage: M = A.span_of_basis([[1,2,'3/7'],[4,5,6]])
    sage: M.coordinates([8,10,12])
    [0, 2]
    sage: M.echelon_coordinates([8,10,12])
    [8, -2]
    sage: B = M.echelonized_basis(); B
    [
    (1, 2, 3/7),
    (0, 3, -30/7)
    ]
    sage: 8*B[0] - 2*B[1]
    (8, 10, 12)

We do an example with a sparse vector space:
    sage: V = VectorSpace(QQ,5, sparse=True)
    sage: W = V.subspace_with_basis([[0,1,2,0,0], [0,-1,0,0,-1/2]])
    sage: W.echelonized_basis()
    [
    (0, 1, 0, 0, 1/2),
    (0, 0, 1, 0, -1/4)
    ]
    sage: W.echelon_coordinates([0,0,2,0,-1/2])
    [0, 2]

user_to_echelon_matrix(self)

source code 

Return matrix that transforms a vector written with respect to the user basis 
of self to one written with respect to the echelon basis.  The matrix acts
from the right, as is usual in SAGE. 

EXAMPLES: 
    sage: A = ZZ^3
    sage: M = A.span_of_basis([[1,2,3],[4,5,6]])
    sage: M.echelonized_basis()
    [
    (1, 2, 3),
    (0, 3, 6)
    ]
    sage: M.user_to_echelon_matrix()
    [ 1  0]
    [ 4 -1]
    
The vector $v=(5,7,9)$ in $M$ is $(1,1)$ with respect to the user basis.
Multiplying the above matrix on the right by this vector yields $(5,-1)$,
which has components the coordinates of $v$ with respect to the echelon basis.
    sage: v0,v1 = M.basis(); v = v0+v1
    sage: e0,e1 = M.echelonized_basis()
    sage: v
    (5, 7, 9)
    sage: 5*e0 + (-1)*e1
    (5, 7, 9)

echelon_to_user_matrix(self)

source code 

Return matrix that transforms the echelon basis to the user basis of self.
This is a matrix $A$ such that if $v$ is a vector written with respect to the echelon
basis for self then $vA$ is that vector written with respect to the user
basis of self.

EXAMPLES:
    sage: V = QQ^3
    sage: W = V.span_of_basis([[1,2,3],[4,5,6]])
    sage: W.echelonized_basis()
    [
    (1, 0, -1),
    (0, 1, 2)
    ]
    sage: A = W.echelon_to_user_matrix(); A
    [-5/3  2/3]
    [ 4/3 -1/3]
    
The vector $(1,1,1)$ has coordinates $v=(1,1)$ with respect to the echelonized
basis for self.  Multiplying $vA$ we find the coordinates of this vector with
respect to the user basis. 
    sage: v = vector(QQ, [1,1]); v
    (1, 1)
    sage: v * A
    (-1/3, 1/3)
    sage: u0, u1 = W.basis()
    sage: (-u0 + u1)/3
    (1, 1, 1)

vector_space(self, base_field=['4ti2-20061025', 'R-2.6.0', 'atlas-3.7.37', 'atlas-3.8.1', 'a...)

source code 

Return the vector spaces associated to this free module via tensor product
with the fraction field of the base ring.

EXAMPLES:
    sage: A = ZZ^3; A
    Ambient free module of rank 3 over the principal ideal domain Integer Ring
    sage: A.vector_space()
    Vector space of dimension 3 over Rational Field
    sage: M = A.span_of_basis([['1/3',2,'3/7'],[4,5,6]]); M
    Free module of degree 3 and rank 2 over Integer Ring
    User basis matrix:
    [1/3   2 3/7]
    [  4   5   6]
    sage: M.vector_space()
    Vector space of degree 3 and dimension 2 over Rational Field
    User basis matrix:
    [1/3   2 3/7]
    [  4   5   6]

ambient_vector_space(self)

source code 

Return the ambient vector space in which this free module is embedded.

EXAMPLES:
    sage: V = ZZ^3
    sage: M = V.span_of_basis([[1,2,'1/5']])
    sage: M
    Free module of degree 3 and rank 1 over Integer Ring
    User basis matrix:
    [  1   2 1/5]
    sage: M.ambient_vector_space()
    Vector space of dimension 3 over Rational Field

basis(self)

source code 

Return the user basis for this free module.

EXAMPLES:
    sage: V = ZZ^3
    sage: V.basis()
    [
    (1, 0, 0),
    (0, 1, 0),
    (0, 0, 1)
    ]
    sage: M = V.span_of_basis([['1/8',2,1]])
    sage: M.basis()
    [
    (1/8, 2, 1)
    ]

Overrides: FreeModule_generic.basis

change_ring(self, R)

source code 

Return the free module over R obtained by coercing each
element of self into a vector over the fraction field of R,
then taking the resulting R-module.  Raises a TypeError
if coercion is not possible. 

INPUT:
    R -- a principal ideal domain

EXAMPLES:
    sage: V = QQ^3
    sage: W = V.subspace([[2,'1/2', 1]])
    sage: W.change_ring(GF(7))
    Vector space of degree 3 and dimension 1 over Finite Field of size 7
    Basis matrix:
    [1 2 4]

coordinate_vector(self, v, check=True)

source code 

Write $v$ in terms of the user basis for self.

INPUT:
    v -- vector
    check -- bool (default: True); if True, also verify that v is really in self.
OUTPUT:
    list

Returns a vector 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.

EXAMPLES:
    sage: V = ZZ^3
    sage: M = V.span_of_basis([['1/8',2,1]])
    sage: M.coordinate_vector([1,16,8])
    (8)

Overrides: FreeModule_generic.coordinate_vector

echelonized_basis(self)

source code 

Return the basis for self in echelon form.

EXAMPLES:
    sage: V = ZZ^3
    sage: M = V.span_of_basis([['1/2',3,1], [0,'1/6',0]])
    sage: M.basis()
    [
    (1/2, 3, 1),
    (0, 1/6, 0)
    ]
    sage: B = M.echelonized_basis(); B
    [
    (1/2, 0, 1),
    (0, 1/6, 0)
    ]
    sage: V.span(B) == M
    True

echelon_coordinate_vector(self, v, check=True)

source code 

Write $v$ in terms of the user basis for self.

INPUT:
    v -- vector
    check -- bool (default: True); if True, also verify that v is really in self.

Returns a vector c such that if B is the echelonized basis for self, then 
        sum c[i] B[i] = v
If v is not in self, raises an ArithmeticError exception.

EXAMPLES: 
    sage: V = ZZ^3
    sage: M = V.span_of_basis([['1/2',3,1], [0,'1/6',0]])
    sage: B = M.echelonized_basis(); B
    [
    (1/2, 0, 1),
    (0, 1/6, 0)
    ]
    sage: M.echelon_coordinate_vector(['1/2', 3, 1])
    (1, 18)

has_user_basis(self)

source code 

Return \code{True} if the basis of this free module is specified by the user,
as opposed to being the default echelon form.

EXAMPLES:
    sage: V = ZZ^3; V.has_user_basis()
    False
    sage: M = V.span_of_basis([[1,3,1]]); M.has_user_basis()
    True
    sage: M = V.span([[1,3,1]]); M.has_user_basis()
    False

Overrides: FreeModule_generic.has_user_basis

linear_combination_of_basis(self, v)

source code 

Return the linear combination of the basis for self
obtained from the coordinates of v.

EXAMPLES:
    sage: V = span(ZZ, [[1,2,3], [4,5,6]]); V
    Free module of degree 3 and rank 2 over Integer Ring
    Echelon basis matrix:
    [1 2 3]
    [0 3 6]
    sage: V.linear_combination_of_basis([1,1])
    (1, 5, 9)