Algebras With Basis - Category Framework

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

# Algebras With Basis

class sage.categories.algebras_with_basis.AlgebrasWithBasis(base_category)

  Bases: `CategoryWithAxiom_over_base_ring`

  The category of algebras with a distinguished basis.

  EXAMPLES:

  Sage

      sage: C = AlgebrasWithBasis(QQ); C
      Category of algebras with basis over Rational Field
      sage: sorted(C.super_categories(), key=str)
      [Category of algebras over Rational Field,
       Category of unital algebras with basis over Rational Field]

  Python

      >>> from sage.all import *
      >>> C = AlgebrasWithBasis(QQ); C
      Category of algebras with basis over Rational Field
      >>> sorted(C.super_categories(), key=str)
      [Category of algebras over Rational Field,
       Category of unital algebras with basis over Rational Field]

  We construct a typical parent in this category, and do some computations with it:

  Sage

      sage: # needs sage.combinat sage.modules
      sage: A = C.example(); A
      An example of an algebra with basis:
       the free algebra on the generators ('a', 'b', 'c') over Rational Field
      sage: A.category()
      Category of algebras with basis over Rational Field
      sage: A.one_basis()
      word:
      sage: A.one()
      B[word: ]
      sage: A.base_ring()
      Rational Field
      sage: A.basis().keys()
      Finite words over {'a', 'b', 'c'}
      sage: (a,b,c) = A.algebra_generators()
      sage: a^3, b^2
      (B[word: aaa], B[word: bb])
      sage: a * c * b
      B[word: acb]
      sage: A.product
      <bound method MagmaticAlgebras.WithBasis.ParentMethods._product_from_product_on_basis_multiply of
       An example of an algebra with basis:
        the free algebra on the generators ('a', 'b', 'c') over Rational Field>
      sage: A.product(a * b, b)
      B[word: abb]
      sage: TestSuite(A).run(verbose=True)
      running ._test_additive_associativity() . . . pass
      running ._test_an_element() . . . pass
      running ._test_associativity() . . . pass
      running ._test_cardinality() . . . pass
      running ._test_category() . . . pass
      running ._test_characteristic() . . . pass
      running ._test_construction() . . . pass
      running ._test_distributivity() . . . pass
      running ._test_elements() . . .
        Running the test suite of self.an_element()
        running ._test_category() . . . pass
        running ._test_eq() . . . pass
        running ._test_monomial_coefficients() . . . pass
        running ._test_new() . . . pass
        running ._test_nonzero_equal() . . . pass
        running ._test_not_implemented_methods() . . . pass
        running ._test_pickling() . . . pass
        pass
      running ._test_elements_eq_reflexive() . . . pass
      running ._test_elements_eq_symmetric() . . . pass
      running ._test_elements_eq_transitive() . . . pass
      running ._test_elements_neq() . . . pass
      running ._test_eq() . . . pass
      running ._test_new() . . . pass
      running ._test_not_implemented_methods() . . . pass
      running ._test_one() . . . pass
      running ._test_pickling() . . . pass
      running ._test_prod() . . . pass
      running ._test_some_elements() . . . pass
      running ._test_zero() . . . pass
      sage: A.__class__
      <class 'sage.categories.examples.algebras_with_basis.FreeAlgebra_with_category'>
      sage: A.element_class
      <class 'sage.categories.examples.algebras_with_basis.FreeAlgebra_with_category.element_class'>

  [Python]

      >>> from sage.all import *
      >>> # needs sage.combinat sage.modules
      >>> A = C.example(); A
      An example of an algebra with basis:
       the free algebra on the generators ('a', 'b', 'c') over Rational Field
      >>> A.category()
      Category of algebras with basis over Rational Field
      >>> A.one_basis()
      word:
      >>> A.one()
      B[word: ]
      >>> A.base_ring()
      Rational Field
      >>> A.basis().keys()
      Finite words over {'a', 'b', 'c'}
      >>> (a,b,c) = A.algebra_generators()
      >>> a**Integer(3), b**Integer(2)
      (B[word: aaa], B[word: bb])
      >>> a * c * b
      B[word: acb]
      >>> A.product
      <bound method MagmaticAlgebras.WithBasis.ParentMethods._product_from_product_on_basis_multiply of
       An example of an algebra with basis:
        the free algebra on the generators ('a', 'b', 'c') over Rational Field>
      >>> A.product(a * b, b)
      B[word: abb]
      >>> TestSuite(A).run(verbose=True)
      running ._test_additive_associativity() . . . pass
      running ._test_an_element() . . . pass
      running ._test_associativity() . . . pass
      running ._test_cardinality() . . . pass
      running ._test_category() . . . pass
      running ._test_characteristic() . . . pass
      running ._test_construction() . . . pass
      running ._test_distributivity() . . . pass
      running ._test_elements() . . .
        Running the test suite of self.an_element()
        running ._test_category() . . . pass
        running ._test_eq() . . . pass
        running ._test_monomial_coefficients() . . . pass
        running ._test_new() . . . pass
        running ._test_nonzero_equal() . . . pass
        running ._test_not_implemented_methods() . . . pass
        running ._test_pickling() . . . pass
        pass
      running ._test_elements_eq_reflexive() . . . pass
      running ._test_elements_eq_symmetric() . . . pass
      running ._test_elements_eq_transitive() . . . pass
      running ._test_elements_neq() . . . pass
      running ._test_eq() . . . pass
      running ._test_new() . . . pass
      running ._test_not_implemented_methods() . . . pass
      running ._test_one() . . . pass
      running ._test_pickling() . . . pass
      running ._test_prod() . . . pass
      running ._test_some_elements() . . . pass
      running ._test_zero() . . . pass
      >>> A.__class__
      <class 'sage.categories.examples.algebras_with_basis.FreeAlgebra_with_category'>
      >>> A.element_class
      <class 'sage.categories.examples.algebras_with_basis.FreeAlgebra_with_category.element_class'>

  Please see the source code of \(A\) (with `A??`) for how to implement other algebras with basis.

  class CartesianProducts(category, *args)

    Bases: `CartesianProductsCategory`

    The category of algebras with basis, constructed as Cartesian products of algebras with basis.

    Note: this construction give the direct products of algebras with basis. See comment in `Algebras.CartesianProducts`

    class ParentMethods

      Bases: `object`

      one()
      one_from_cartesian_product_of_one_basis()

        Return the one of this Cartesian product of algebras, as per `Monoids.ParentMethods.one`

        It is constructed as the Cartesian product of the ones of the summands, using their `one_basis()` methods.

        This implementation does not require multiplication by scalars nor calling cartesian_product. This might help keeping things as lazy as possible upon initialization.

        EXAMPLES:

        Sage

            sage: # needs sage.combinat sage.modules
            sage: A = AlgebrasWithBasis(QQ).example(); A
            An example of an algebra with basis: the free algebra
             on the generators ('a', 'b', 'c') over Rational Field
            sage: A.one_basis()
            word:
            sage: B = cartesian_product((A, A, A))
            sage: B.one_from_cartesian_product_of_one_basis()
            B[(0, word: )] + B[(1, word: )] + B[(2, word: )]
            sage: B.one()
            B[(0, word: )] + B[(1, word: )] + B[(2, word: )]

            sage: cartesian_product([SymmetricGroupAlgebra(QQ, 3),              # needs sage.combinat sage.groups sage.modules
            ....:                    SymmetricGroupAlgebra(QQ, 4)]).one()
            B[(0, [1, 2, 3])] + B[(1, [1, 2, 3, 4])]

        Python

            >>> from sage.all import *
            >>> # needs sage.combinat sage.modules
            >>> A = AlgebrasWithBasis(QQ).example(); A
            An example of an algebra with basis: the free algebra
             on the generators ('a', 'b', 'c') over Rational Field
            >>> A.one_basis()
            word:
            >>> B = cartesian_product((A, A, A))
            >>> B.one_from_cartesian_product_of_one_basis()
            B[(0, word: )] + B[(1, word: )] + B[(2, word: )]
            >>> B.one()
            B[(0, word: )] + B[(1, word: )] + B[(2, word: )]

            >>> cartesian_product([SymmetricGroupAlgebra(QQ, Integer(3)),              # needs sage.combinat sage.groups sage.modules
            ...                    SymmetricGroupAlgebra(QQ, Integer(4))]).one()
            B[(0, [1, 2, 3])] + B[(1, [1, 2, 3, 4])]

    extra_super_categories()

      A Cartesian product of algebras with basis is endowed with a natural algebra with basis structure.

      EXAMPLES:

      Sage

          sage: AlgebrasWithBasis(QQ).CartesianProducts().extra_super_categories()
          [Category of algebras with basis over Rational Field]
          sage: AlgebrasWithBasis(QQ).CartesianProducts().super_categories()
          [Category of algebras with basis over Rational Field,
           Category of Cartesian products of algebras over Rational Field,
           Category of Cartesian products of vector spaces with basis over Rational Field]

      Python

          >>> from sage.all import *
          >>> AlgebrasWithBasis(QQ).CartesianProducts().extra_super_categories()
          [Category of algebras with basis over Rational Field]
          >>> AlgebrasWithBasis(QQ).CartesianProducts().super_categories()
          [Category of algebras with basis over Rational Field,
           Category of Cartesian products of algebras over Rational Field,
           Category of Cartesian products of vector spaces with basis over Rational Field]

  class ElementMethods

    Bases: `object`

  Filtered

    alias of `FilteredAlgebrasWithBasis`

  FiniteDimensional

    alias of `FiniteDimensionalAlgebrasWithBasis`

  Graded

    alias of `GradedAlgebrasWithBasis`

  class ParentMethods

    Bases: `object`

    hochschild_complex(M)

      Return the Hochschild complex of `self` with coefficients in `M`.

      See also

      `HochschildComplex`

      EXAMPLES:

      Sage

          sage: R.<x> = QQ[]
          sage: A = algebras.DifferentialWeyl(R)                                  # needs sage.modules
          sage: H = A.hochschild_complex(A)                                       # needs sage.modules

          sage: # needs sage.combinat sage.groups sage.modules
          sage: SGA = SymmetricGroupAlgebra(QQ, 3)
          sage: T = SGA.trivial_representation()
          sage: H = SGA.hochschild_complex(T)

      Python

          >>> from sage.all import *
          >>> R = QQ['x']; (x,) = R._first_ngens(1)
          >>> A = algebras.DifferentialWeyl(R)                                  # needs sage.modules
          >>> H = A.hochschild_complex(A)                                       # needs sage.modules

          >>> # needs sage.combinat sage.groups sage.modules
          >>> SGA = SymmetricGroupAlgebra(QQ, Integer(3))
          >>> T = SGA.trivial_representation()
          >>> H = SGA.hochschild_complex(T)

    one()

      Return the multiplicative unit element.

      EXAMPLES:

      Sage

          sage: A = AlgebrasWithBasis(QQ).example()                           # needs sage.combinat sage.modules
          sage: A.one_basis()                                                 # needs sage.combinat sage.modules
          word:
          sage: A.one()                                                       # needs sage.combinat sage.modules
          B[word: ]

      Python

          >>> from sage.all import *
          >>> A = AlgebrasWithBasis(QQ).example()                           # needs sage.combinat sage.modules
          >>> A.one_basis()                                                 # needs sage.combinat sage.modules
          word:
          >>> A.one()                                                       # needs sage.combinat sage.modules
          B[word: ]

  Super

    alias of `SuperAlgebrasWithBasis`

  class TensorProducts(category, *args)

    Bases: `TensorProductsCategory`

    The category of algebras with basis constructed by tensor product of algebras with basis

    class ElementMethods

      Bases: `object`

      Implement operations on elements of tensor products of algebras with basis

    class ParentMethods

      Bases: `object`

      implements operations on tensor products of algebras with basis

      one_basis()

        Return the index of the one of this tensor product of algebras, as per `AlgebrasWithBasis.ParentMethods.one_basis`

        It is the tuple whose operands are the indices of the ones of the operands, as returned by their `one_basis()` methods.

        EXAMPLES:

        Sage

            sage: # needs sage.combinat sage.modules
            sage: A = AlgebrasWithBasis(QQ).example(); A
            An example of an algebra with basis: the free algebra
             on the generators ('a', 'b', 'c') over Rational Field
            sage: A.one_basis()
            word:
            sage: B = tensor((A, A, A))
            sage: B.one_basis()
            (word: , word: , word: )
            sage: B.one()
            B[word: ] # B[word: ] # B[word: ]

        Python

            >>> from sage.all import *
            >>> # needs sage.combinat sage.modules
            >>> A = AlgebrasWithBasis(QQ).example(); A
            An example of an algebra with basis: the free algebra
             on the generators ('a', 'b', 'c') over Rational Field
            >>> A.one_basis()
            word:
            >>> B = tensor((A, A, A))
            >>> B.one_basis()
            (word: , word: , word: )
            >>> B.one()
            B[word: ] # B[word: ] # B[word: ]

      product_on_basis(t1, t2)

        The product of the algebra on the basis, as per `AlgebrasWithBasis.ParentMethods.product_on_basis`.

        EXAMPLES:

        Sage

            sage: # needs sage.combinat sage.modules
            sage: A = AlgebrasWithBasis(QQ).example(); A
            An example of an algebra with basis: the free algebra
             on the generators ('a', 'b', 'c') over Rational Field
            sage: (a,b,c) = A.algebra_generators()
            sage: x = tensor((a, b, c)); x
            B[word: a] # B[word: b] # B[word: c]
            sage: y = tensor((c, b, a)); y
            B[word: c] # B[word: b] # B[word: a]
            sage: x * y
            B[word: ac] # B[word: bb] # B[word: ca]
            sage: x = tensor(((a + 2*b), c)); x
            B[word: a] # B[word: c] + 2*B[word: b] # B[word: c]
            sage: y = tensor((c, a)) + 1; y
            B[word: ] # B[word: ] + B[word: c] # B[word: a]
            sage: x * y
            B[word: a] # B[word: c] + B[word: ac] # B[word: ca]
             + 2*B[word: b] # B[word: c] + 2*B[word: bc] # B[word: ca]

        Python

            >>> from sage.all import *
            >>> # needs sage.combinat sage.modules
            >>> A = AlgebrasWithBasis(QQ).example(); A
            An example of an algebra with basis: the free algebra
             on the generators ('a', 'b', 'c') over Rational Field
            >>> (a,b,c) = A.algebra_generators()
            >>> x = tensor((a, b, c)); x
            B[word: a] # B[word: b] # B[word: c]
            >>> y = tensor((c, b, a)); y
            B[word: c] # B[word: b] # B[word: a]
            >>> x * y
            B[word: ac] # B[word: bb] # B[word: ca]
            >>> x = tensor(((a + Integer(2)*b), c)); x
            B[word: a] # B[word: c] + 2*B[word: b] # B[word: c]
            >>> y = tensor((c, a)) + Integer(1); y
            B[word: ] # B[word: ] + B[word: c] # B[word: a]
            >>> x * y
            B[word: a] # B[word: c] + B[word: ac] # B[word: ca]
             + 2*B[word: b] # B[word: c] + 2*B[word: bc] # B[word: ca]

        TODO: optimize this implementation!

    extra_super_categories()

      EXAMPLES:

      Sage

          sage: AlgebrasWithBasis(QQ).TensorProducts().extra_super_categories()
          [Category of algebras with basis over Rational Field]
          sage: AlgebrasWithBasis(QQ).TensorProducts().super_categories()
          [Category of algebras with basis over Rational Field,
           Category of tensor products of algebras over Rational Field,
           Category of tensor products of vector spaces with basis over Rational Field]

      Python

          >>> from sage.all import *
          >>> AlgebrasWithBasis(QQ).TensorProducts().extra_super_categories()
          [Category of algebras with basis over Rational Field]
          >>> AlgebrasWithBasis(QQ).TensorProducts().super_categories()
          [Category of algebras with basis over Rational Field,
           Category of tensor products of algebras over Rational Field,
           Category of tensor products of vector spaces with basis over Rational Field]

  example(alphabet=('a', 'b', 'c'))

    Return an example of algebra with basis.

    EXAMPLES:

    Sage

        sage: AlgebrasWithBasis(QQ).example()                                       # needs sage.combinat sage.modules
        An example of an algebra with basis:
         the free algebra on the generators ('a', 'b', 'c') over Rational Field

    Python

        >>> from sage.all import *
        >>> AlgebrasWithBasis(QQ).example()                                       # needs sage.combinat sage.modules
        An example of an algebra with basis:
         the free algebra on the generators ('a', 'b', 'c') over Rational Field

    An other set of generators can be specified as optional argument:

    Sage

        sage: AlgebrasWithBasis(QQ).example((1,2,3))                                # needs sage.combinat sage.modules
        An example of an algebra with basis:
         the free algebra on the generators (1, 2, 3) over Rational Field

    [Python]

        >>> from sage.all import *
        >>> AlgebrasWithBasis(QQ).example((Integer(1),Integer(2),Integer(3)))                                # needs sage.combinat sage.modules
        An example of an algebra with basis:
         the free algebra on the generators (1, 2, 3) over Rational Field