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())
...
... _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 ._basis_keys 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, ._prefix which is the string put in front of each basis element, and finally a _multiply or _multiply basis method that defines the multiplication in the algebra.
Bases: sage.combinat.free_module.CombinatorialFreeModule
Deprecated! Don’t use!
TESTS:
sage: s = sage.combinat.combinatorial_algebra.TestAlgebra(QQ)
sage: s.one_basis()
[]
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]
Bases: sage.combinat.combinatorial_algebra.CombinatorialAlgebra
TESTS:
sage: sa = sage.combinat.combinatorial_algebra.TestAlgebra(QQ)
sage: x = sa([2]); x # indirect doctest
s[2]