Quasisymmetric functions

REFERENCES:

[Ges]I. Gessel, Multipartite P-partitions and inner products of skew Schur functions, Contemp. Math. 34 (1984), 289-301.
[MR]C. Malvenuto and C. Reutenauer, Duality between quasi-symmetric functions and the Solomon descent algebra, J. Algebra 177 (1995), no. 3, 967-982.

AUTHOR:

  • Jason Bandlow
  • Franco Saliola
  • Chris Berg
class sage.combinat.ncsf_qsym.qsym.QuasiSymmetricFunctions(R)

Bases: sage.structure.unique_representation.UniqueRepresentation, sage.structure.parent.Parent

The Hopf algebra of quasisymmetric functions.

The ring of quasi-symmetric functions may be realized as a subring of polynomials of n variables {\bf k}[x_1, x_2, \ldots, x_n] where the dimension of the subspace of elements of degree k is equal to the number of compositions of k (with less than n parts). The two classical bases, the Monomial and Fundamental, are defined by the formulas:

M_I = \sum_{1 \leq i_1 < i_2 < \cdots < i_\ell \leq n} x_{i_1}^{I_1}
x_{i_2}^{I_2} \cdots x_{i_\ell}^{I_\ell}

and

F_I = \sum_{1 \leq i_1 \leq i_2 \leq \cdots \leq i_\ell \leq n} x_{i_1}^{I_1}
x_{i_2}^{I_2} \cdots x_{i_\ell}^{I_\ell}

where in the sum for the Fundamental basis there is strict inequality from i_r to i_{r+1} if i_r is a descent of the composition I.

These bases are related by the formula

F_I = \sum_{J \leq I} M_J

where the inequality J \leq I indicates that J is finer than I. By taking the limit on n, the ring of quasi-symmetric polynomials is a Hopf algebra that inherits the product and co-product structure from the polynomial ring where it lives.

The implementation of the quasi-symmetric function Hopf algebra

We realize the ring of quasi-symmetric functions in Sage as a graded Hopf algebra with basis elements indexed by compositions.

sage: QSym = QuasiSymmetricFunctions(QQ)
sage: QSym.category()
Join of Category of graded hopf algebras over Rational Field and Category of monoids with realizations and Category of coalgebras over Rational Field with realizations

Currently the quasi-symmetric functions have a minimal implementation and the only two bases implemented natively are the Monomial and Fundamental bases.

sage: M = QSym.M()
sage: F = QSym.F()
sage: M(F[2,1,2])
M[1, 1, 1, 1, 1] + M[1, 1, 1, 2] + M[2, 1, 1, 1] + M[2, 1, 2]
sage: F(M[2,1,2])
F[1, 1, 1, 1, 1] - F[1, 1, 1, 2] - F[2, 1, 1, 1] + F[2, 1, 2]

The product on this space is commutative and is inherited from the product by the realization within the polynomial ring.

sage: M[3]*M[1,1] == M[1,1]*M[3]
True
sage: M[3]*M[1,1]
M[1, 1, 3] + M[1, 3, 1] + M[1, 4] + M[3, 1, 1] + M[4, 1]
sage: F[3]*F[1,1]
F[1, 1, 3] + F[1, 2, 2] + F[1, 3, 1] + F[1, 4] + F[2, 1, 2] + F[2, 2, 1] + F[2, 3] + F[3, 1, 1] + F[3, 2] + F[4, 1]
sage: M[3]*F[2]
M[1, 1, 3] + M[1, 3, 1] + M[1, 4] + M[2, 3] + M[3, 1, 1] + M[3, 2] + M[4, 1] + M[5]
sage: F[2]*M[3]
F[1, 1, 1, 2] - F[1, 2, 2] + F[2, 1, 1, 1] - F[2, 1, 2] - F[2, 2, 1] + F[5]

There is a coproduct on this ring as well, which in the Monomial basis acts by cutting the composition into a left half and a right half. The co-product is non-co-commutative.

sage: M[1,3,1].coproduct()
M[] # M[1, 3, 1] + M[1] # M[3, 1] + M[1, 3] # M[1] + M[1, 3, 1] # M[]
sage: F[1,3,1].coproduct()
F[] # F[1, 3, 1] + F[1] # F[3, 1] + F[1, 1] # F[2, 1] + F[1, 2] # F[1, 1] + F[1, 3] # F[1] + F[1, 3, 1] # F[]

The duality pairing with non-commutative symmetric functions

These two operations endow the quasi-symmetric functions QSym with the structure of a Hopf algebra. It is the dual Hopf algebra of the non-commutative symmetric functions NCSF. Under this duality, the Monomial basis of QSym is dual to the Complete basis of NCSF, and the Fundamental basis of QSym is dual to the Ribbon basis of NCSF (see [MR]).

sage: S = M.dual(); S
Non-Commutative Symmetric Functions over the Rational Field in the Complete basis
sage: M[1,3,1].duality_pairing( S[1,3,1] )
1
sage: M.duality_pairing_matrix( S, degree=4 )
[1 0 0 0 0 0 0 0]
[0 1 0 0 0 0 0 0]
[0 0 1 0 0 0 0 0]
[0 0 0 1 0 0 0 0]
[0 0 0 0 1 0 0 0]
[0 0 0 0 0 1 0 0]
[0 0 0 0 0 0 1 0]
[0 0 0 0 0 0 0 1]
sage: F.duality_pairing_matrix( S, degree=4 )
[1 0 0 0 0 0 0 0]
[1 1 0 0 0 0 0 0]
[1 0 1 0 0 0 0 0]
[1 1 1 1 0 0 0 0]
[1 0 0 0 1 0 0 0]
[1 1 0 0 1 1 0 0]
[1 0 1 0 1 0 1 0]
[1 1 1 1 1 1 1 1]
sage: NCSF = M.realization_of().dual()
sage: R = NCSF.Ribbon()
sage: F.duality_pairing_matrix( R, degree=4 )
[1 0 0 0 0 0 0 0]
[0 1 0 0 0 0 0 0]
[0 0 1 0 0 0 0 0]
[0 0 0 1 0 0 0 0]
[0 0 0 0 1 0 0 0]
[0 0 0 0 0 1 0 0]
[0 0 0 0 0 0 1 0]
[0 0 0 0 0 0 0 1]
sage: M.duality_pairing_matrix( R, degree=4 )
[ 1  0  0  0  0  0  0  0]
[-1  1  0  0  0  0  0  0]
[-1  0  1  0  0  0  0  0]
[ 1 -1 -1  1  0  0  0  0]
[-1  0  0  0  1  0  0  0]
[ 1 -1  0  0 -1  1  0  0]
[ 1  0 -1  0 -1  0  1  0]
[-1  1  1 -1  1 -1 -1  1]

Let H and G be elements of QSym and h an element of NCSF. Then if we represent the duality pairing with the mathematical notation [ \cdot,
\cdot ],

[H G, h] = [H \otimes G, \Delta(h)]~.

For example, the coefficient of M[2,1,4,1] in M[1,3]*M[2,1,1] may be computed with the duality pairing:

sage: I, J = Composition([1,3]), Composition([2,1,1])
sage: (M[I]*M[J]).duality_pairing(S[2,1,4,1])
1

And the coefficient of S[1,3] # S[2,1,1] in S[2,1,4,1].coproduct() is equal to this result.

sage: S[2,1,4,1].coproduct()
S[] # S[2, 1, 4, 1] + ... + S[1, 3] # S[2, 1, 1] + ... + S[4, 1] # S[2, 1]

The duality pairing on the tensor space is another way of getting this coefficient, but currently the method duality_pairing is not defined on the tensor squared space. However, we can extend this functionality by applying a linear morphism to the terms in the coproduct, as follows.

sage: X = S[2,1,4,1].coproduct()
sage: def linear_morphism(x, y):
...     return x.duality_pairing(M[1,3]) * y.duality_pairing(M[2,1,1])
sage: X.apply_multilinear_morphism(linear_morphism, codomain=ZZ)
1

Similarly, if H is an element of QSym and g and h are elements of NCSF, then

[ H, g h ] = [ \Delta(H), g \otimes h ]~.

For example, the coefficient of R[2,3,1] in R[2,1]*R[2,1] is computed with the duality pairing by the following command.

sage: (R[2,1]*R[2,1]).duality_pairing(F[2,3,1])
1
sage: R[2,1]*R[2,1]
R[2, 1, 2, 1] + R[2, 3, 1]

This coefficient should then be equal to the coefficient of F[2,1] # F[2,1] in F[2,3,1].coproduct().

sage: F[2,3,1].coproduct()
F[] # F[2, 3, 1] + ... + F[2, 1] # F[2, 1]  + ... + F[2, 3, 1] # F[]

This can also be computed by the duality pairing on the tensor space, as above.

sage: X = F[2,3,1].coproduct()
sage: def linear_morphism(x, y):
...     return x.duality_pairing(R[2,1]) * y.duality_pairing(R[2,1])
sage: X.apply_multilinear_morphism(linear_morphism, codomain=ZZ)
1

The operation dual to multiplication by a non-commutative symmetric function

Let g \in NCSF and consider the linear endomorphism of NCSF defined by left (respectively, right) multiplication by g. Since there is a duality between QSym and NCSF, this linear transformation induces an operator g^\perp on QSym satisfying

[ g^\perp(H), h ] = [ H, gh ]~.

for any non-commutative symmetric function h.

This is implemented by the method skew_by(). Explicitly, if H is a quasi-symmetric function and g a non-commutative symmetric function, then H.skew_by(g) and H.skew_by(g, side='right') are expressions that satisfy for any non-commutative symmetric function h.

H.skew_by(g).duality_pairing(h) == H.duality_pairing(g*h)
H.skew_by(g, side='right').duality_pairing(h) == H.duality_pairing(h*g)

For example, M[J].skew_by(S[I]) is 0 unless the composition J begins with I and M(J).skew_by(S(I), side='right') is 0 unless the composition J ends with I.

sage: M[3,2,2].skew_by(S[3])
M[2, 2]
sage: M[3,2,2].skew_by(S[2])
0
sage: M[3,2,2].coproduct().apply_multilinear_morphism( lambda x,y: x.duality_pairing(S[3])*y )
M[2, 2]
sage: M[3,2,2].skew_by(S[3], side='right')
0
sage: M[3,2,2].skew_by(S[2], side='right')
M[3, 2]

The counit

The counit is defined by sending all elements of positive degree to zero:

sage: M[3].degree(), M[3,1,2].degree(), M.one().degree()
(3, 6, 0)
sage: M[3].counit()
0
sage: M[3,1,2].counit()
0
sage: M.one().counit()
1
sage: (M[3] - 2*M[3,1,2] + 7).counit()
7
sage: (F[3] - 2*F[3,1,2] + 7).counit()
7

The antipode

The antipode sends the Fundamental basis element indexed by the composition I to -1 to the size of I times the Fundamental basis element indexed by the conjugate composition to I.

sage: F[3,2,2].antipode()
-F[1, 2, 2, 1, 1]
sage: Composition([3,2,2]).conjugate()
[1, 2, 2, 1, 1]
sage: M[3,2,2].antipode()
-M[2, 2, 3] - M[2, 5] - M[4, 3] - M[7]

We demonstrate here the defining relation of the antipode:

sage: X = F[3,2,2].coproduct()
sage: X.apply_multilinear_morphism(lambda x,y: x*y.antipode())
0
sage: X.apply_multilinear_morphism(lambda x,y: x.antipode()*y)
0

The relation with symmetric functions

The quasi-symmetric functions are a ring which contain the symmetric functions as a subring. The Monomial quasi-symmetric functions are related to the monomial symmetric functions by

m_\lambda = \sum_{sort(I) = \lambda} M_I~.

There are methods to test if an expression in the quasi-symmetric functions is a symmetric function and, if it is, send it to an expression in the symmetric functions.

sage: f = M[1,1,2] + M[1,2,1]
sage: f.is_symmetric()
False
sage: g = M[3,1] + M[1,3]
sage: g.is_symmetric()
True
sage: g.to_symmetric_function()
m[3, 1]

The expansion of the Schur function in terms of the Fundamental quasi-symmetric functions is due to [Ges]. There is one term in the expansion for each standard tableau of shape equal to the partition indexing the Schur function.

sage: f = F[3,2] + F[2,2,1] + F[2,3] + F[1,3,1] + F[1,2,2]
sage: f.is_symmetric()
True
sage: f.to_symmetric_function()
5*m[1, 1, 1, 1, 1] + 3*m[2, 1, 1, 1] + 2*m[2, 2, 1] + m[3, 1, 1] + m[3, 2]
sage: s = SymmetricFunctions(QQ).s()
sage: s(f.to_symmetric_function())
s[3, 2]

It is also possible to convert a symmetric function to a quasi-symmetric function.

sage: m = SymmetricFunctions(QQ).m()
sage: M( m[3,1,1] )
M[1, 1, 3] + M[1, 3, 1] + M[3, 1, 1]
sage: F( s[2,2,1] )
F[1, 1, 2, 1] + F[1, 2, 1, 1] + F[1, 2, 2] + F[2, 1, 2] + F[2, 2, 1]

It is possible to experiment with the quasi-symmetric function expansion of other bases, but it is important that the base ring be the same for both algebras.

sage: R = QQ['t']
sage: Qp = SymmetricFunctions(R).hall_littlewood().Qp()
sage: QSymt = QuasiSymmetricFunctions(R)
sage: Ft = QSymt.F()
sage: Ft( Qp[2,2] )
F[1, 2, 1] + t*F[1, 3] + (t+1)*F[2, 2] + t*F[3, 1] + t^2*F[4]
sage: K = QQ['q','t'].fraction_field()
sage: Ht = SymmetricFunctions(K).macdonald().Ht()
sage: Fqt = QuasiSymmetricFunctions(Ht.base_ring()).F()
sage: Fqt(Ht[2,1])
q*t*F[1, 1, 1] + (q+t)*F[1, 2] + (q+t)*F[2, 1] + F[3]

The following will raise an error because the base ring of F is not equal to the base ring of Ht.

sage: F(Ht[2,1])
Traceback (most recent call last):
...
TypeError: do not know how to make x (= McdHt[2, 1]) an element of self (=Quasisymmetric functions over the Rational Field in the Fundamental basis)

The map to the ring of polynomials

Since the quasi-symmetric functions are the limit of a subring of polynomials as the number of variables increases, there exists a projection from the quasi-symmetric functions into the polynomial ring {\bf k}[x_1, x_2, \ldots, x_n]. Although not precise, we may think of the quasi-symmetric functions indexed by a composition as a function in an infinite number of variables and project this into the ring of polynomials by setting x_{n+1} = x_{n+2} = \cdots = 0. If the the number of variables is smaller than the length of the composition, the result is 0.

sage: M[1,3,1].expand(4)
x0*x1^3*x2 + x0*x1^3*x3 + x0*x2^3*x3 + x1*x2^3*x3
sage: F[1,3,1].expand(4)
x0*x1^3*x2 + x0*x1^3*x3 + x0*x1^2*x2*x3 + x0*x1*x2^2*x3 + x0*x2^3*x3 + x1*x2^3*x3
sage: M[1,3,1].expand(2)
0

TESTS:

sage: QSym = QuasiSymmetricFunctions(QQ); QSym
Quasisymmetric functions over the Rational Field
sage: QSym.base_ring()
Rational Field
class Bases(parent_with_realization)

Bases: sage.categories.realizations.Category_realization_of_parent

Category of bases of quasi-symmetric functions.

EXAMPLES:

sage: QSym = QuasiSymmetricFunctions(QQ)
sage: QSym.Bases()
Category of bases of Quasisymmetric functions over the Rational Field
ElementMethods

alias of Bases.ElementMethods

ParentMethods

alias of Bases.ParentMethods

super_categories()

Returns the super categories of bases of the Quasi-symmetric functions.

OUTPUT:

  • a list of categories

TESTS:

sage: QSym = QuasiSymmetricFunctions(QQ)
sage: QSym.Bases().super_categories()
[Category of bases of Non-Commutative Symmetric Functions or Quasisymmetric functions over the Rational Field, Category of commutative rings]
class QuasiSymmetricFunctions.Fundamental(QSym)

Bases: sage.combinat.free_module.CombinatorialFreeModule, sage.misc.bindable_class.BindableClass

The Hopf algebra of quasi-symmetric function in the Fundamental basis.

EXAMPLES:

sage: QSym = QuasiSymmetricFunctions(QQ)
sage: F = QSym.F()
sage: M = QSym.M()
sage: F(M[2,2])
F[1, 1, 1, 1] - F[1, 1, 2] - F[2, 1, 1] + F[2, 2]
sage: s = SymmetricFunctions(QQ).s()
sage: F(s[3,2])
F[1, 2, 2] + F[1, 3, 1] + F[2, 2, 1] + F[2, 3] + F[3, 2]
sage: (1+F[1])^3
F[] + 3*F[1] + 3*F[1, 1] + F[1, 1, 1] + 2*F[1, 2] + 3*F[2] + 2*F[2, 1] + F[3]
sage: F[1,2,1].coproduct()
F[] # F[1, 2, 1] + F[1] # F[2, 1] + F[1, 1] # F[1, 1] + F[1, 2] # F[1] + F[1, 2, 1] # F[]

The following is an alias for this basis:

sage: QSym.Fundamental()
Quasisymmetric functions over the Rational Field in the Fundamental basis

TESTS:

sage: F(M([]))
F[]
sage: F(M(0))
0
sage: F(s([]))
F[]
sage: F(s(0))
0
antipode_on_basis(compo)

Returns the antipode to a Fundamental quasi-symmetric basis element.

INPUT:

  • compo – composition

OUTPUT:

  • Returns the result of the antipode applied to the quasi-symmetric Fundamental basis element indexed by compo.

EXAMPLES:

sage: F = QuasiSymmetricFunctions(QQ).F()
sage: F.antipode_on_basis(Composition([2,1]))
-F[2, 1]
coproduct_on_basis(compo)

Returns the coproduct to a Fundamental quasi-symmetric basis element.

Combinatorial rule: quasi deconcatenation.

INPUT:

  • compo – composition

OUTPUT:

  • Returns the application of the coproduct to the Fundamental quasi-symmetric function indexed by the composition compo.

EXAMPLES:

sage: F = QuasiSymmetricFunctions(QQ).Fundamental()
sage: F[4].coproduct()
F[] # F[4] + F[1] # F[3] + F[2] # F[2] + F[3] # F[1] + F[4] # F[]
sage: F[2,1,3].coproduct()
F[] # F[2, 1, 3] + F[1] # F[1, 1, 3] + F[2] # F[1, 3] + F[2, 1] # F[3] + F[2, 1, 1] # F[2] + F[2, 1, 2] # F[1] + F[2, 1, 3] # F[]

TESTS:

sage: F.coproduct_on_basis(Composition([2,1,3]))
F[] # F[2, 1, 3] + F[1] # F[1, 1, 3] + F[2] # F[1, 3] + F[2, 1] # F[3] + F[2, 1, 1] # F[2] + F[2, 1, 2] # F[1] + F[2, 1, 3] # F[]
sage: F.one().coproduct()          # generic for graded / graded connected
F[] # F[]
dual()

Returns the dual basis to the Fundamental basis. This is the ribbon basis of the non-commutative symmetric functions.

OUTPUT:

  • The ribbon basis of the non-commutative symmetric functions.

EXAMPLES:

sage: F = QuasiSymmetricFunctions(QQ).F()
sage: F.dual()
Non-Commutative Symmetric Functions over the Rational Field in the Ribbon basis
class QuasiSymmetricFunctions.Monomial(QSym)

Bases: sage.combinat.free_module.CombinatorialFreeModule, sage.misc.bindable_class.BindableClass

The Hopf algebra of quasi-symmetric function in the Monomial basis.

EXAMPLES:

sage: QSym = QuasiSymmetricFunctions(QQ)
sage: M = QSym.M()
sage: F = QSym.F()
sage: M(F[2,2])
M[1, 1, 1, 1] + M[1, 1, 2] + M[2, 1, 1] + M[2, 2]
sage: m = SymmetricFunctions(QQ).m()
sage: M(m[3,1,1])
M[1, 1, 3] + M[1, 3, 1] + M[3, 1, 1]
sage: (1+M[1])^3
M[] + 3*M[1] + 6*M[1, 1] + 6*M[1, 1, 1] + 3*M[1, 2] + 3*M[2] + 3*M[2, 1] + M[3]
sage: M[1,2,1].coproduct()
M[] # M[1, 2, 1] + M[1] # M[2, 1] + M[1, 2] # M[1] + M[1, 2, 1] # M[]

The following is an alias for this basis:

sage: QSym.Monomial()
Quasisymmetric functions over the Rational Field in the Monomial basis

TESTS:

sage: M(F([]))
M[]
sage: M(F(0))
0
sage: M(m([]))
M[]
Element

alias of Monomial.Element

antipode_on_basis(compo)

Returns the result of the antipode applied to a quasi-symmetric Monomial basis element.

INPUT:

  • compo – composition

OUTPUT:

  • The result of the antipode applied to the composition compo, expressed in the Monomial basis.

EXAMPLES:

sage: M = QuasiSymmetricFunctions(QQ).M()
sage: M.antipode_on_basis(Composition([2,1]))
M[1, 2] + M[3]
sage: M.antipode_on_basis(Composition([]))
M[]
coproduct_on_basis(compo)

Returns the coproduct of a Monomial basis element.

Combinatorial rule: deconcatenation.

INPUT:

  • compo – composition

OUTPUT:

  • The coproduct applied to the Monomial quasi-symmetric function indexed by compo, expressed in the Monomial basis.

EXAMPLES:

sage: M=QuasiSymmetricFunctions(QQ).Monomial()
sage: M[4,2,3].coproduct()
M[] # M[4, 2, 3] + M[4] # M[2, 3] + M[4, 2] # M[3] + M[4, 2, 3] # M[]
sage: M.coproduct_on_basis(Composition([]))
M[] # M[]
dual()

Returns the dual basis to the Monomial basis. This is the complete basis of the non-commutative symmetric functions.

OUTPUT:

  • The complete basis of the non-commutative symmetric functions.

EXAMPLES:

sage: M = QuasiSymmetricFunctions(QQ).M()
sage: M.dual()
Non-Commutative Symmetric Functions over the Rational Field in the Complete basis
product_on_basis(I, J)

The product on Monomial basis elements. The product of the basis elements indexed by two compositions I and J is the sum of the basis elements indexed by compositions in the shuffle product of I and J.

INPUT:

  • I, J – compositions

OUTPUT:

  • The product of the Monomial quasi-symmetric functions indexed by I and J, expressed in the Monomial basis.

EXAMPLES:

sage: M = QuasiSymmetricFunctions(QQ).Monomial()
sage: c1 = Composition([2])
sage: c2 = Composition([1,3])
sage: M.product_on_basis(c1, c2)
M[1, 2, 3] + M[1, 3, 2] + M[1, 5] + M[2, 1, 3] + M[3, 3]
sage: M.product_on_basis(c1, Composition([]))
M[2]
class QuasiSymmetricFunctions.Quasisymmetric_Schur(QSym)

Bases: sage.combinat.free_module.CombinatorialFreeModule, sage.misc.bindable_class.BindableClass

The Hopf algebra of quasi-symmetric function in the Quasisymmetric Schur basis.

The basis of Quasisymmetric Schur functions is defined in [QSCHUR].

EXAMPLES:

sage: QSym = QuasiSymmetricFunctions(QQ)
sage: QS = QSym.QS()
sage: F = QSym.F()
sage: M = QSym.M()
sage: F(QS[1,2])
F[1, 2]
sage: M(QS[1,2])
M[1, 1, 1] + M[1, 2]
sage: s = SymmetricFunctions(QQ).s()
sage: QS(s[2,1,1])
QS[1, 1, 2] + QS[1, 2, 1] + QS[2, 1, 1]
QuasiSymmetricFunctions.a_realization()

Returns the realization of the Monomial basis of the ring of quasi-symmetric functions.

OUTPUT:

  • The Monomial basis of quasi-symmetric functions.

EXAMPLES:

sage: QuasiSymmetricFunctions(QQ).a_realization()
Quasisymmetric functions over the Rational Field in the Monomial basis
QuasiSymmetricFunctions.dual()

Returns the dual Hopf algebra of the quasi-symmetric functions, which is the non-commutative symmetric functions.

OUTPUT:

  • The non-commutative symmetric functions.

EXAMPLES:

sage: QSym = QuasiSymmetricFunctions(QQ)
sage: QSym.dual()
Non-Commutative Symmetric Functions over the Rational Field
class QuasiSymmetricFunctions.dualImmaculate(QSym)

Bases: sage.combinat.free_module.CombinatorialFreeModule, sage.misc.bindable_class.BindableClass

The dual immaculate basis of the non-commutative symmetric functions. This basis first appears in Berg, Bergeron, Saliola, Serrano and Zabrocki’s ” A lift of the Schur and Hall-Littlewood bases to non-commutative symmetric functions”.

EXAMPLES

sage: QSym = QuasiSymmetricFunctions(QQ)
sage: dI = QSym.dI()
sage: dI([1,3,2])*dI([1])  # long time (6s on sage.math, 2013)
dI[1, 1, 3, 2] + dI[2, 3, 2]
sage: dI([1,3])*dI([1,1])
dI[1, 1, 1, 3] + dI[1, 1, 4] + dI[1, 2, 3] - dI[1, 3, 2] - dI[1, 4, 1] - dI[1, 5] + dI[2, 3, 1] + dI[2, 4]
sage: dI([3,1])*dI([2,1])  # long time (7s on sage.math, 2013)
dI[1, 1, 5] - dI[1, 4, 1, 1] - dI[1, 4, 2] - 2*dI[1, 5, 1] - dI[1, 6] - dI[2, 4, 1] - dI[2, 5] - dI[3, 1, 3] + dI[3, 2, 1, 1] + dI[3, 2, 2] + dI[3, 3, 1] + dI[4, 1, 1, 1] + 2*dI[4, 2, 1] + dI[4, 3] + dI[5, 1, 1] + dI[5, 2]
sage: F = QSym.F()
sage: dI(F[1,3,1])
-dI[1, 1, 1, 2] + dI[1, 1, 2, 1] - dI[1, 2, 2] + dI[1, 3, 1]
sage: F(dI(F([2,1,3])))
F[2, 1, 3]
QuasiSymmetricFunctions.from_polynomial(f, check=True)

Returns the quasi-symmetric function in the Monomial basis corresponding to the quasi-symmetric polynomial f.

INPUT:

  • f – a polynomial in finitely many variables over the same base ring as self. It is assumed that this polynomial is quasi-symmetric.
  • check – boolean (default: True), checks whether the polynomial is indeed quasi-symmetric.

OUTPUT:

  • quasi-symmetric function in the Monomial basis

EXAMPLES:

sage: P = PolynomialRing(QQ, 'x', 3)
sage: x = P.gens()
sage: f = x[0] + x[1] + x[2]
sage: QSym = QuasiSymmetricFunctions(QQ)
sage: QSym.from_polynomial(f)
M[1]

Beware of setting check=False:

sage: f = x[0] + 2*x[1] + x[2]
sage: QSym.from_polynomial(f, check=True)
Traceback (most recent call last):
...
ValueError: x0 + 2*x1 + x2 is not a quasi-symmetric polynomial
sage: QSym.from_polynomial(f, check=False)
M[1]

To expand the quasi-symmetric function in a basis other than the Monomial basis, the following shorthands are provided:

sage: M = QSym.Monomial()
sage: f = x[0]**2+x[1]**2+x[2]**2
sage: g = M.from_polynomial(f); g
M[2]
sage: F = QSym.Fundamental()
sage: F(g)
-F[1, 1] + F[2]
sage: F.from_polynomial(f)
-F[1, 1] + F[2]

Previous topic

Non-Commutative Symmetric Functions

Next topic

Root Systems

This Page