### Navigation

- index
- modules |
- next |
- previous |
- Category Theory »

# Algebras With Basis

class `sage.categories.algebras_with_basis.``AlgebrasWithBasis`(base_category)

  Bases: `sage.categories.category_with_axiom.CategoryWithAxiom_over_base_ring`

  The category of algebras with a distinguished basis.

  EXAMPLES:

      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]

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

      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 FreeAlgebra_with_category._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_category() . . . pass
      running ._test_characteristic() . . . 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_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_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.combinat.free_module.FreeAlgebra_with_category.element_class'>

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

  TESTS:

      sage: TestSuite(AlgebrasWithBasis(QQ)).run()

  class `CartesianProducts`(category, *args)

    Bases: `sage.categories.cartesian_product.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`
      `one`()

        TESTS:

            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: B = cartesian_product((A, A, A))
            sage: B.one()
            B[(0, word: )] + B[(1, word: )] + B[(2, word: )]

      `one_from_cartesian_product_of_one_basis`()

        Returns 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: 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), SymmetricGroupAlgebra(QQ, 4)]).one()
            B[(0, [1, 2, 3])] + B[(1, [1, 2, 3, 4])]

    `AlgebrasWithBasis.CartesianProducts.``extra_super_categories`()

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

      EXAMPLES:

          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]

  class `AlgebrasWithBasis.``ElementMethods`
  `AlgebrasWithBasis.``FiniteDimensional`

    alias of `FiniteDimensionalAlgebrasWithBasis`

  `AlgebrasWithBasis.``Graded`

    alias of `GradedAlgebrasWithBasis`

  class `AlgebrasWithBasis.``ParentMethods`
    `one`()

      Return the multiplicative unit element.

      EXAMPLES:

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

  class `AlgebrasWithBasis.``TensorProducts`(category, *args)

    Bases: `sage.categories.tensor.TensorProductsCategory`

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

    class `ElementMethods`

      Implements operations on elements of tensor products of algebras with basis

    class `AlgebrasWithBasis.TensorProducts.``ParentMethods`

      implements operations on tensor products of algebras with basis

      `one_basis`()

        Returns 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: 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: ]

      `product_on_basis`(t1, t2)

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

        EXAMPLES:

            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]

        TODO: optimize this implementation!

    `AlgebrasWithBasis.TensorProducts.``extra_super_categories`()

      EXAMPLES:

          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]

  `AlgebrasWithBasis.``example`(alphabet=('a', 'b', 'c'))

    Return an example of algebra with basis.

    EXAMPLES:

        sage: AlgebrasWithBasis(QQ).example()
        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: AlgebrasWithBasis(QQ).example((1,2,3))
        An example of an algebra with basis: the free algebra on the generators (1, 2, 3) over Rational Field

### Navigation

- index
- modules |
- next |
- previous |
- Category Theory »