# Combinatorial Algebras¶

A combinatorial algebra is an algebra whose basis elements are indexed by a combinatorial class. Some examples of combinatorial algebras are the symmetric group algebra of order n (indexed by permutations of size n) and the algebra of symmetric functions (indexed by integer partitions).

The CombinatorialAlgebra base class makes it easy to define and work with new combinatorial algebras in Sage. For example, the following code constructs an algebra which models the power-sum symmetric functions.

sage: class PowerSums(CombinatorialAlgebra):
...     def __init__(self, R):
...         self._one = Partition([])
...         self._name = 'Power-sum symmetric functions'
...         CombinatorialAlgebra.__init__(self, R, Partitions())
...         self.print_options(prefix='p')
...
...     def _multiply_basis(self, a, b):
...         l = list(a)+list(b)
...         l.sort(reverse=True)
...         return Partition(l)
...

sage: ps = PowerSums(QQ); ps
Power-sum symmetric functions over Rational Field
sage: ps([2,1])^2
p[2, 2, 1, 1]
sage: ps([2,1])+2*ps([1,1,1])
2*p[1, 1, 1] + p[2, 1]
sage: ps(2)
2*p[]


The important things to define are ._indices which specifies the combinatorial class that indexes the basis elements, ._one which specifies the identity element in the algebra, ._name which specifies the name of the algebra, .print_options is used to set the print options for the elements, and finally a _multiply or _multiply_basis method that defines the multiplication in the algebra.

class sage.combinat.combinatorial_algebra.CombinatorialAlgebra(R, cc=None, element_class=None, category=None)

Deprecated! Don’t use!

one_basis()

TESTS:

sage: s = sage.combinat.combinatorial_algebra.TestAlgebra(QQ)
sage: s.one_basis()
[]

product(left, right)

Returns left*right where left and right are elements of self. product() uses either _multiply or _multiply basis to carry out the actual multiplication.

EXAMPLES:

sage: s = sage.combinat.combinatorial_algebra.TestAlgebra(QQ)
sage: a = s([2])
sage: s.product(a,a)
s[2, 2] + s[3, 1] + s[4]
sage: ZS3 = SymmetricGroupAlgebra(ZZ, 3)
sage: a = 2 + ZS3([2,1,3])
sage: a*a
5*[1, 2, 3] + 4*[2, 1, 3]
sage: H3 = HeckeAlgebraSymmetricGroupT(QQ,3)
sage: j2 = H3.jucys_murphy(2)
sage: j2*j2
(q^3-q^2+q)*T[1, 2, 3] + (q^3-q^2+q-1)*T[2, 1, 3]
sage: X = SchubertPolynomialRing(ZZ)
sage: X([1,2,3])*X([2,1,3])
X[2, 1]

class sage.combinat.combinatorial_algebra.CombinatorialAlgebraElementOld(M, x)

Create a combinatorial module element. This should never be called directly, but only through the parent combinatorial free module’s __call__() method.

TESTS:

sage: F = CombinatorialFreeModule(QQ, ['a','b','c'])
sage: B = F.basis()
sage: f = B['a'] + 3*B['c']; f
B['a'] + 3*B['c']
True

class sage.combinat.combinatorial_algebra.TestAlgebra(R)

TESTS:

sage: s = sage.combinat.combinatorial_algebra.TestAlgebra(QQ)
sage: TestSuite(s).run()

prefix()

TESTS:

sage: sa = sage.combinat.combinatorial_algebra.TestAlgebra(QQ)
sage: x = sa([2]); x  # indirect doctest
s[2]


Combinations

#### Next topic

Combinatorial maps