# Algebras With Basis¶

class sage.categories.algebras_with_basis.AlgebrasWithBasis(base_category)

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_cardinality() . . . 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_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'>


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

class CartesianProducts(category, *args)

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()
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])]

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 ElementMethods
Filtered
FiniteDimensional
Graded
class ParentMethods
hochschild_complex(M)

Return the Hochschild complex of self with coefficients in M.

EXAMPLES:

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

sage: SGA = SymmetricGroupAlgebra(QQ, 3)
sage: T = SGA.trivial_representation()
sage: H = SGA.hochschild_complex(T)

one()

Return the multiplicative unit element.

EXAMPLES:

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

Super
class TensorProducts(category, *args)

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

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]

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