Elements of finitely presented graded modules - Modules

Skip to content
Back to top
View this page
Edit this page

# Elements of finitely presented graded modules

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.element.FPElement

  Bases: `IndexedFreeModuleElement`

  A module element of a finitely presented graded module over a connected graded algebra.

  degree()

    The degree of `self`.

    OUTPUT: the integer degree of `self` or raise an error if the zero element

    EXAMPLES:

    Sage

        sage: from sage.modules.fp_graded.module import FPModule
        sage: M = FPModule(SteenrodAlgebra(2), [0,1], [[Sq(4), Sq(3)]])
        sage: x = M.an_element(7)

        sage: x
        Sq(0,0,1)*g[0] + Sq(3,1)*g[1]
        sage: x.degree()
        7

    Python

        >>> from sage.all import *
        >>> from sage.modules.fp_graded.module import FPModule
        >>> M = FPModule(SteenrodAlgebra(Integer(2)), [Integer(0),Integer(1)], [[Sq(Integer(4)), Sq(Integer(3))]])
        >>> 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

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

    [Python]

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

  dense_coefficient_list(order=None)

    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

        sage: from sage.modules.fp_graded.module import FPModule
        sage: A = SteenrodAlgebra()
        sage: M = FPModule(SteenrodAlgebra(2), [0,1], [[Sq(4), Sq(3)]])
        sage: x = M([Sq(1), 1])
        sage: x.dense_coefficient_list()
        [Sq(1), 1]
        sage: y = Sq(2) * M.generator(1)
        sage: y.dense_coefficient_list()
        [0, Sq(2)]

    Python

        >>> from sage.all import *
        >>> from sage.modules.fp_graded.module import FPModule
        >>> A = SteenrodAlgebra()
        >>> M = FPModule(SteenrodAlgebra(Integer(2)), [Integer(0),Integer(1)], [[Sq(Integer(4)), Sq(Integer(3))]])
        >>> x = M([Sq(Integer(1)), Integer(1)])
        >>> x.dense_coefficient_list()
        [Sq(1), 1]
        >>> y = Sq(Integer(2)) * M.generator(Integer(1))
        >>> y.dense_coefficient_list()
        [0, Sq(2)]

  lift_to_free()

    Return the lift of `self` to the free module `F`, where `self` is in a quotient of `F`.

    EXAMPLES:

    Sage

        sage: from sage.modules.fp_graded.module import FPModule
        sage: M = FPModule(SteenrodAlgebra(2), [0,1], [[Sq(4), Sq(3)]])
        sage: x = M([Sq(1), 1])
        sage: x
        Sq(1)*g[0] + g[1]
        sage: x.parent()
        Finitely presented left module on 2 generators and 1 relation over mod 2 Steenrod algebra, milnor basis
        sage: x.lift_to_free()
        Sq(1)*g[0] + g[1]
        sage: x.lift_to_free().parent()
        Free graded left module on 2 generators over mod 2 Steenrod algebra, milnor basis

    Python

        >>> from sage.all import *
        >>> from sage.modules.fp_graded.module import FPModule
        >>> M = FPModule(SteenrodAlgebra(Integer(2)), [Integer(0),Integer(1)], [[Sq(Integer(4)), Sq(Integer(3))]])
        >>> x = M([Sq(Integer(1)), Integer(1)])
        >>> x
        Sq(1)*g[0] + g[1]
        >>> x.parent()
        Finitely presented left module on 2 generators and 1 relation over mod 2 Steenrod algebra, milnor basis
        >>> x.lift_to_free()
        Sq(1)*g[0] + g[1]
        >>> x.lift_to_free().parent()
        Free graded left module on 2 generators over mod 2 Steenrod algebra, milnor basis

  normalize()

    A normalized form of `self`.

    OUTPUT:

    An instance representing the same module element as `self` in normalized form.

    EXAMPLES:

    Sage

        sage: from sage.modules.fp_graded.module import FPModule
        sage: M.<a0,b2,c4> = FPModule(SteenrodAlgebra(2), [0,2,4], [[Sq(4),Sq(2),0]])

        sage: m = M((Sq(6), 0, Sq(2))); m
        Sq(6)*a0 + Sq(2)*c4
        sage: m.normalize()
        Sq(6)*a0 + Sq(2)*c4
        sage: m == m.normalize()
        True

        sage: n = M((Sq(4), Sq(2), 0)); n
        Sq(4)*a0 + Sq(2)*b2
        sage: n.normalize()
        0
        sage: n == n.normalize()
        True

    Python

        >>> from sage.all import *
        >>> from sage.modules.fp_graded.module import FPModule
        >>> M = FPModule(SteenrodAlgebra(Integer(2)), [Integer(0),Integer(2),Integer(4)], [[Sq(Integer(4)),Sq(Integer(2)),Integer(0)]], names=('a0', 'b2', 'c4',)); (a0, b2, c4,) = M._first_ngens(3)

        >>> m = M((Sq(Integer(6)), Integer(0), Sq(Integer(2)))); m
        Sq(6)*a0 + Sq(2)*c4
        >>> m.normalize()
        Sq(6)*a0 + Sq(2)*c4
        >>> m == m.normalize()
        True

        >>> n = M((Sq(Integer(4)), Sq(Integer(2)), Integer(0))); n
        Sq(4)*a0 + Sq(2)*b2
        >>> n.normalize()
        0
        >>> n == n.normalize()
        True

  vector_presentation()

    A coordinate vector representing `self` when it is nonzero.

    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 nonzero. Otherwise, the value `None`.

    See also

    - `sage.modules.fp_graded.module.FPModule.vector_presentation()`

    - `sage.modules.fp_graded.module.FPModule.basis_elements()`

    - `sage.modules.fp_graded.module.FPModule.element_from_coordinates()`

    EXAMPLES:

    Sage

        sage: from sage.modules.fp_graded.module import FPModule
        sage: A2 = SteenrodAlgebra(2, profile=(3,2,1))
        sage: M.<m0,m1> = FPModule(A2, (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: V = M.vector_presentation(7)
        sage: v in V
        True

        sage: M.element_from_coordinates(v, 7) == x
        True

    Python

        >>> from sage.all import *
        >>> from sage.modules.fp_graded.module import FPModule
        >>> A2 = SteenrodAlgebra(Integer(2), profile=(Integer(3),Integer(2),Integer(1)))
        >>> M = FPModule(A2, (Integer(0),Integer(1)), names=('m0', 'm1',)); (m0, m1,) = M._first_ngens(2)

        >>> 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'>

        >>> 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

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

    [Python]

        >>> 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)*m0 + Sq(3,1)*m1
        >>> x__ = M.linear_combination(zip(basis, v)); x__
        Sq(0,0,1)*m0 + Sq(3,1)*m1
        >>> x == x_ == x__
        True