Elements of finitely generated free graded left modules#

For an overview, see the free graded modules documentation.

AUTHORS:

  • Robert R. Bruner, Michael J. Catanzaro (2012): Initial version.

  • Sverre Lunoee–Nielsen and Koen van Woerden (2019-11-29): Updated the original software to Sage version 8.9.

  • Sverre Lunoee–Nielsen (2020-07-01): Refactored the code and added new documentation and tests.

class sage.modules.fp_graded.free_element.FreeGradedModuleElement[source]#

Bases: IndexedFreeModuleElement

Create a module element of a finitely generated free graded left module over a connected graded algebra.

EXAMPLES:

sage: from sage.modules.fp_graded.free_module import FreeGradedModule
sage: M = FreeGradedModule(SteenrodAlgebra(2), (0, 1))

sage: M([0, 0])
0

sage: M([1, 0])
g[0]

sage: M([0, 1])
g[1]

sage: M([Sq(1), 1])
Sq(1)*g[0] + g[1]
>>> from sage.all import *
>>> from sage.modules.fp_graded.free_module import FreeGradedModule
>>> M = FreeGradedModule(SteenrodAlgebra(Integer(2)), (Integer(0), Integer(1)))

>>> M([Integer(0), Integer(0)])
0

>>> M([Integer(1), Integer(0)])
g[0]

>>> M([Integer(0), Integer(1)])
g[1]

>>> M([Sq(Integer(1)), Integer(1)])
Sq(1)*g[0] + g[1]
degree()[source]#

The degree of self.

OUTPUT:

The integer degree of this element, or raise an error if this is the zero element.

EXAMPLES:

sage: from sage.modules.fp_graded.free_module import *
sage: A = SteenrodAlgebra(2)
sage: M = FreeGradedModule(A, (0,1))
sage: x = M.an_element(7); x
Sq(0,0,1)*g[0] + Sq(3,1)*g[1]
sage: x.degree()
7
>>> from sage.all import *
>>> from sage.modules.fp_graded.free_module import *
>>> A = SteenrodAlgebra(Integer(2))
>>> M = FreeGradedModule(A, (Integer(0),Integer(1)))
>>> x = M.an_element(Integer(7)); x
Sq(0,0,1)*g[0] + Sq(3,1)*g[1]
>>> x.degree()
7

The zero element has no degree:

sage: (x-x).degree()
Traceback (most recent call last):
...
ValueError: the zero element does not have a well-defined degree
>>> from sage.all import *
>>> (x-x).degree()
Traceback (most recent call last):
...
ValueError: the zero element does not have a well-defined degree

Neither do non-homogeneous elements:

sage: y = M.an_element(4)
sage: (x+y).degree()
Traceback (most recent call last):
...
ValueError: this is a nonhomogeneous element, no well-defined degree
>>> from sage.all import *
>>> y = M.an_element(Integer(4))
>>> (x+y).degree()
Traceback (most recent call last):
...
ValueError: this is a nonhomogeneous element, no well-defined degree
dense_coefficient_list(order=None)[source]#

Return a list of all coefficients of self.

INPUT:

  • order – (optional) an ordering of the basis indexing set

Note that this includes all of the coefficients, not just the nonzero ones. By default they appear in the same order as the module generators.

EXAMPLES:

sage: from sage.modules.fp_graded.free_module import FreeGradedModule
sage: A = SteenrodAlgebra()
sage: M.<Y,Z> = FreeGradedModule(SteenrodAlgebra(2), (0, 1))
sage: x = M.an_element(7); x
Sq(0,0,1)*Y + Sq(3,1)*Z
sage: x.dense_coefficient_list()
[Sq(0,0,1), Sq(3,1)]
>>> from sage.all import *
>>> from sage.modules.fp_graded.free_module import FreeGradedModule
>>> A = SteenrodAlgebra()
>>> M = FreeGradedModule(SteenrodAlgebra(Integer(2)), (Integer(0), Integer(1)), names=('Y', 'Z',)); (Y, Z,) = M._first_ngens(2)
>>> x = M.an_element(Integer(7)); x
Sq(0,0,1)*Y + Sq(3,1)*Z
>>> x.dense_coefficient_list()
[Sq(0,0,1), Sq(3,1)]
lift_to_free()[source]#

Return self.

It is provided for compatibility with the method of the same name for sage.modules.fp_graded.module.FPModule.

EXAMPLES:

sage: from sage.modules.fp_graded.free_module import FreeGradedModule
sage: A = SteenrodAlgebra(2)
sage: M = FreeGradedModule(A, (0,1))
sage: x = M.an_element()
sage: x.lift_to_free() == x
True
sage: x.lift_to_free() is x
True
>>> from sage.all import *
>>> from sage.modules.fp_graded.free_module import FreeGradedModule
>>> A = SteenrodAlgebra(Integer(2))
>>> M = FreeGradedModule(A, (Integer(0),Integer(1)))
>>> x = M.an_element()
>>> x.lift_to_free() == x
True
>>> x.lift_to_free() is x
True
vector_presentation()[source]#

A coordinate vector representing self when it is a non-zero homogeneous element.

These are coordinates with respect to the basis chosen by basis_elements(). When the element is zero, it has no well defined degree, and this function returns None.

OUTPUT:

A vector of elements in the ground ring of the algebra for this module when this element is non-zero. Otherwise, the value None.

EXAMPLES:

sage: A2 = SteenrodAlgebra(2, profile=(3,2,1))
sage: M = A2.free_graded_module((0,1))
sage: x = M.an_element(7)
sage: v = x.vector_presentation(); v
(1, 0, 0, 0, 0, 1, 0)
sage: type(v)
<class 'sage.modules.vector_mod2_dense.Vector_mod2_dense'>
sage: M.gen(0).vector_presentation()
(1)
sage: M.gen(1).vector_presentation()
(0, 1)

sage: V = M.vector_presentation(7)
sage: v in V
True

sage: M.element_from_coordinates(v, 7) == x
True
>>> from sage.all import *
>>> A2 = SteenrodAlgebra(Integer(2), profile=(Integer(3),Integer(2),Integer(1)))
>>> M = A2.free_graded_module((Integer(0),Integer(1)))
>>> x = M.an_element(Integer(7))
>>> v = x.vector_presentation(); v
(1, 0, 0, 0, 0, 1, 0)
>>> type(v)
<class 'sage.modules.vector_mod2_dense.Vector_mod2_dense'>
>>> M.gen(Integer(0)).vector_presentation()
(1)
>>> M.gen(Integer(1)).vector_presentation()
(0, 1)

>>> V = M.vector_presentation(Integer(7))
>>> v in V
True

>>> M.element_from_coordinates(v, Integer(7)) == x
True

We can use the basis for the module elements in the degree of \(x\), together with the coefficients \(v\) to recreate the element \(x\):

sage: basis = M.basis_elements(7)
sage: x_ = sum( [c*b for (c,b) in zip(v, basis)] ); x_
Sq(0,0,1)*g[0] + Sq(3,1)*g[1]
sage: x__ = M.linear_combination(zip(basis, v)); x__
Sq(0,0,1)*g[0] + Sq(3,1)*g[1]
sage: x == x_ == x__
True
>>> from sage.all import *
>>> basis = M.basis_elements(Integer(7))
>>> x_ = sum( [c*b for (c,b) in zip(v, basis)] ); x_
Sq(0,0,1)*g[0] + Sq(3,1)*g[1]
>>> x__ = M.linear_combination(zip(basis, v)); x__
Sq(0,0,1)*g[0] + Sq(3,1)*g[1]
>>> x == x_ == x__
True

This is not defined for elements that are not homogeneous:

sage: sum(M.basis()).vector_presentation()
Traceback (most recent call last):
...
ValueError: this is a nonhomogeneous element, no well-defined degree
>>> from sage.all import *
>>> sum(M.basis()).vector_presentation()
Traceback (most recent call last):
...
ValueError: this is a nonhomogeneous element, no well-defined degree