Generic code for bases#
This is a collection of code that is shared by bases of noncommutative symmetric functions and quasisymmetric functions.
AUTHORS:
Jason Bandlow
Franco Saliola
Chris Berg
- class sage.combinat.ncsf_qsym.generic_basis_code.AlgebraMorphism(domain, on_generators, position=0, codomain=None, category=None, anti=False)[source]#
Bases:
ModuleMorphismByLinearity
A class for algebra morphism defined on a free algebra from the image of the generators
- class sage.combinat.ncsf_qsym.generic_basis_code.BasesOfQSymOrNCSF(parent_with_realization)[source]#
Bases:
Category_realization_of_parent
- class ElementMethods[source]#
Bases:
object
- degree()[source]#
The maximum of the degrees of the homogeneous summands.
See also
homogeneous_degree()
EXAMPLES:
sage: S = NonCommutativeSymmetricFunctions(QQ).S() sage: (x, y) = (S[2], S[3]) sage: x.degree() 2 sage: (x^3 + 4*y^2).degree() 6 sage: ((1 + x)^3).degree() 6
>>> from sage.all import * >>> S = NonCommutativeSymmetricFunctions(QQ).S() >>> (x, y) = (S[Integer(2)], S[Integer(3)]) >>> x.degree() 2 >>> (x**Integer(3) + Integer(4)*y**Integer(2)).degree() 6 >>> ((Integer(1) + x)**Integer(3)).degree() 6
sage: F = QuasiSymmetricFunctions(QQ).F() sage: (x, y) = (F[2], F[3]) sage: x.degree() 2 sage: (x^3 + 4*y^2).degree() 6 sage: ((1 + x)^3).degree() 6
>>> from sage.all import * >>> F = QuasiSymmetricFunctions(QQ).F() >>> (x, y) = (F[Integer(2)], F[Integer(3)]) >>> x.degree() 2 >>> (x**Integer(3) + Integer(4)*y**Integer(2)).degree() 6 >>> ((Integer(1) + x)**Integer(3)).degree() 6
- degree_negation()[source]#
Return the image of
self
under the degree negation automorphism of the parent ofself
.The degree negation is the automorphism which scales every homogeneous element of degree \(k\) by \((-1)^k\) (for all \(k\)).
Calling
degree_negation(self)
is equivalent to callingself.parent().degree_negation(self)
.EXAMPLES:
sage: NSym = NonCommutativeSymmetricFunctions(ZZ) sage: S = NSym.S() sage: f = 2*S[2,1] + 4*S[1,1] - 5*S[1,2] - 3*S[[]] sage: f.degree_negation() -3*S[] + 4*S[1, 1] + 5*S[1, 2] - 2*S[2, 1] sage: QSym = QuasiSymmetricFunctions(QQ) sage: dI = QSym.dualImmaculate() sage: f = -3*dI[2,1] + 4*dI[2] + 2*dI[1] sage: f.degree_negation() -2*dI[1] + 4*dI[2] + 3*dI[2, 1]
>>> from sage.all import * >>> NSym = NonCommutativeSymmetricFunctions(ZZ) >>> S = NSym.S() >>> f = Integer(2)*S[Integer(2),Integer(1)] + Integer(4)*S[Integer(1),Integer(1)] - Integer(5)*S[Integer(1),Integer(2)] - Integer(3)*S[[]] >>> f.degree_negation() -3*S[] + 4*S[1, 1] + 5*S[1, 2] - 2*S[2, 1] >>> QSym = QuasiSymmetricFunctions(QQ) >>> dI = QSym.dualImmaculate() >>> f = -Integer(3)*dI[Integer(2),Integer(1)] + Integer(4)*dI[Integer(2)] + Integer(2)*dI[Integer(1)] >>> f.degree_negation() -2*dI[1] + 4*dI[2] + 3*dI[2, 1]
Todo
Generalize this to all graded vector spaces?
- duality_pairing(y)[source]#
The duality pairing between elements of \(NSym\) and elements of \(QSym\).
The complete basis is dual to the monomial basis with respect to this pairing.
INPUT:
y
– an element of the dual Hopf algebra ofself
OUTPUT:
The result of pairing
self
withy
.
EXAMPLES:
sage: R = NonCommutativeSymmetricFunctions(QQ).Ribbon() sage: F = QuasiSymmetricFunctions(QQ).Fundamental() sage: R[1,1,2].duality_pairing(F[1,1,2]) 1 sage: R[1,2,1].duality_pairing(F[1,1,2]) 0
>>> from sage.all import * >>> R = NonCommutativeSymmetricFunctions(QQ).Ribbon() >>> F = QuasiSymmetricFunctions(QQ).Fundamental() >>> R[Integer(1),Integer(1),Integer(2)].duality_pairing(F[Integer(1),Integer(1),Integer(2)]) 1 >>> R[Integer(1),Integer(2),Integer(1)].duality_pairing(F[Integer(1),Integer(1),Integer(2)]) 0
sage: L = NonCommutativeSymmetricFunctions(QQ).Elementary() sage: F = QuasiSymmetricFunctions(QQ).Fundamental() sage: L[1,2].duality_pairing(F[1,2]) 0 sage: L[1,1,1].duality_pairing(F[1,2]) 1
>>> from sage.all import * >>> L = NonCommutativeSymmetricFunctions(QQ).Elementary() >>> F = QuasiSymmetricFunctions(QQ).Fundamental() >>> L[Integer(1),Integer(2)].duality_pairing(F[Integer(1),Integer(2)]) 0 >>> L[Integer(1),Integer(1),Integer(1)].duality_pairing(F[Integer(1),Integer(2)]) 1
- skew_by(y, side='left')[source]#
The operation which is dual to multiplication by
y
, wherey
is an element of the dual space ofself
.This is calculated through the coproduct of
self
and the expansion ofy
in the dual basis.INPUT:
y
– an element of the dual Hopf algebra ofself
side
– (Default=’left’) Either ‘left’ or ‘right’
OUTPUT:
The result of skewing
self
byy
, on the sideside
EXAMPLES:
Skewing an element of NCSF by an element of QSym:
sage: R = NonCommutativeSymmetricFunctions(QQ).ribbon() sage: F = QuasiSymmetricFunctions(QQ).Fundamental() sage: R([2,2,2]).skew_by(F[1,1]) R[1, 1, 2] + R[1, 2, 1] + R[1, 3] + R[2, 1, 1] + 2*R[2, 2] + R[3, 1] + R[4] sage: R([2,2,2]).skew_by(F[2]) R[1, 1, 2] + R[1, 2, 1] + R[1, 3] + R[2, 1, 1] + 3*R[2, 2] + R[3, 1] + R[4]
>>> from sage.all import * >>> R = NonCommutativeSymmetricFunctions(QQ).ribbon() >>> F = QuasiSymmetricFunctions(QQ).Fundamental() >>> R([Integer(2),Integer(2),Integer(2)]).skew_by(F[Integer(1),Integer(1)]) R[1, 1, 2] + R[1, 2, 1] + R[1, 3] + R[2, 1, 1] + 2*R[2, 2] + R[3, 1] + R[4] >>> R([Integer(2),Integer(2),Integer(2)]).skew_by(F[Integer(2)]) R[1, 1, 2] + R[1, 2, 1] + R[1, 3] + R[2, 1, 1] + 3*R[2, 2] + R[3, 1] + R[4]
Skewing an element of QSym by an element of NCSF:
sage: S = NonCommutativeSymmetricFunctions(QQ).S() sage: R = NonCommutativeSymmetricFunctions(QQ).R() sage: F = QuasiSymmetricFunctions(QQ).F() sage: F[3,2].skew_by(R[1,1]) 0 sage: F[3,2].skew_by(R[1,1], side='right') 0 sage: F[3,2].skew_by(S[1,1,1], side='right') F[2] sage: F[3,2].skew_by(S[1,2], side='right') F[2] sage: F[3,2].skew_by(S[2,1], side='right') 0 sage: F[3,2].skew_by(S[1,1,1]) F[2] sage: F[3,2].skew_by(S[1,1]) F[1, 2] sage: F[3,2].skew_by(S[1]) F[2, 2]
>>> from sage.all import * >>> S = NonCommutativeSymmetricFunctions(QQ).S() >>> R = NonCommutativeSymmetricFunctions(QQ).R() >>> F = QuasiSymmetricFunctions(QQ).F() >>> F[Integer(3),Integer(2)].skew_by(R[Integer(1),Integer(1)]) 0 >>> F[Integer(3),Integer(2)].skew_by(R[Integer(1),Integer(1)], side='right') 0 >>> F[Integer(3),Integer(2)].skew_by(S[Integer(1),Integer(1),Integer(1)], side='right') F[2] >>> F[Integer(3),Integer(2)].skew_by(S[Integer(1),Integer(2)], side='right') F[2] >>> F[Integer(3),Integer(2)].skew_by(S[Integer(2),Integer(1)], side='right') 0 >>> F[Integer(3),Integer(2)].skew_by(S[Integer(1),Integer(1),Integer(1)]) F[2] >>> F[Integer(3),Integer(2)].skew_by(S[Integer(1),Integer(1)]) F[1, 2] >>> F[Integer(3),Integer(2)].skew_by(S[Integer(1)]) F[2, 2]
sage: S = NonCommutativeSymmetricFunctions(QQ).S() sage: R = NonCommutativeSymmetricFunctions(QQ).R() sage: M = QuasiSymmetricFunctions(QQ).M() sage: M[3,2].skew_by(S[2]) 0 sage: M[3,2].skew_by(S[2], side='right') M[3] sage: M[3,2].skew_by(S[3]) M[2] sage: M[3,2].skew_by(S[3], side='right') 0
>>> from sage.all import * >>> S = NonCommutativeSymmetricFunctions(QQ).S() >>> R = NonCommutativeSymmetricFunctions(QQ).R() >>> M = QuasiSymmetricFunctions(QQ).M() >>> M[Integer(3),Integer(2)].skew_by(S[Integer(2)]) 0 >>> M[Integer(3),Integer(2)].skew_by(S[Integer(2)], side='right') M[3] >>> M[Integer(3),Integer(2)].skew_by(S[Integer(3)]) M[2] >>> M[Integer(3),Integer(2)].skew_by(S[Integer(3)], side='right') 0
- class ParentMethods[source]#
Bases:
object
- alternating_sum_of_compositions(n)[source]#
Alternating sum over compositions of
n
.Note that this differs from the method
alternating_sum_of_finer_compositions()
because the coefficient of the composition \(1^n\) is positive. This method is used in the expansion of the elementary generators into the complete generators and vice versa.INPUT:
n
– a positive integer
OUTPUT:
The expansion of the complete generator indexed by
n
into the elementary basis.
EXAMPLES:
sage: L = NonCommutativeSymmetricFunctions(QQ).L() sage: L.alternating_sum_of_compositions(0) L[] sage: L.alternating_sum_of_compositions(1) L[1] sage: L.alternating_sum_of_compositions(2) L[1, 1] - L[2] sage: L.alternating_sum_of_compositions(3) L[1, 1, 1] - L[1, 2] - L[2, 1] + L[3] sage: S = NonCommutativeSymmetricFunctions(QQ).S() sage: S.alternating_sum_of_compositions(3) S[1, 1, 1] - S[1, 2] - S[2, 1] + S[3]
>>> from sage.all import * >>> L = NonCommutativeSymmetricFunctions(QQ).L() >>> L.alternating_sum_of_compositions(Integer(0)) L[] >>> L.alternating_sum_of_compositions(Integer(1)) L[1] >>> L.alternating_sum_of_compositions(Integer(2)) L[1, 1] - L[2] >>> L.alternating_sum_of_compositions(Integer(3)) L[1, 1, 1] - L[1, 2] - L[2, 1] + L[3] >>> S = NonCommutativeSymmetricFunctions(QQ).S() >>> S.alternating_sum_of_compositions(Integer(3)) S[1, 1, 1] - S[1, 2] - S[2, 1] + S[3]
- alternating_sum_of_fatter_compositions(composition)[source]#
Return the alternating sum of fatter compositions in a basis of the non-commutative symmetric functions.
INPUT:
composition
– a composition
OUTPUT:
The alternating sum of the compositions fatter than
composition
, in the basisself
. The alternation is upon the length of the compositions, and is normalized so thatcomposition
has coefficient \(1\).
EXAMPLES:
sage: NCSF=NonCommutativeSymmetricFunctions(QQ) sage: elementary = NCSF.elementary() sage: elementary.alternating_sum_of_fatter_compositions(Composition([2,2,1])) L[2, 2, 1] - L[2, 3] - L[4, 1] + L[5] sage: elementary.alternating_sum_of_fatter_compositions(Composition([1,2])) L[1, 2] - L[3]
>>> from sage.all import * >>> NCSF=NonCommutativeSymmetricFunctions(QQ) >>> elementary = NCSF.elementary() >>> elementary.alternating_sum_of_fatter_compositions(Composition([Integer(2),Integer(2),Integer(1)])) L[2, 2, 1] - L[2, 3] - L[4, 1] + L[5] >>> elementary.alternating_sum_of_fatter_compositions(Composition([Integer(1),Integer(2)])) L[1, 2] - L[3]
- alternating_sum_of_finer_compositions(composition, conjugate=False)[source]#
Return the alternating sum of finer compositions in a basis of the non-commutative symmetric functions.
INPUT:
composition
– a compositionconjugate
– (default:False
) a boolean
OUTPUT:
The alternating sum of the compositions finer than
composition
, in the basisself
. The alternation is upon the length of the compositions, and is normalized so thatcomposition
has coefficient \(1\). If the variableconjugate
is set toTrue
, then the conjugate ofcomposition
is used instead ofcomposition
.
EXAMPLES:
sage: NCSF = NonCommutativeSymmetricFunctions(QQ) sage: elementary = NCSF.elementary() sage: elementary.alternating_sum_of_finer_compositions(Composition([2,2,1])) L[1, 1, 1, 1, 1] - L[1, 1, 2, 1] - L[2, 1, 1, 1] + L[2, 2, 1] sage: elementary.alternating_sum_of_finer_compositions(Composition([1,2])) -L[1, 1, 1] + L[1, 2]
>>> from sage.all import * >>> NCSF = NonCommutativeSymmetricFunctions(QQ) >>> elementary = NCSF.elementary() >>> elementary.alternating_sum_of_finer_compositions(Composition([Integer(2),Integer(2),Integer(1)])) L[1, 1, 1, 1, 1] - L[1, 1, 2, 1] - L[2, 1, 1, 1] + L[2, 2, 1] >>> elementary.alternating_sum_of_finer_compositions(Composition([Integer(1),Integer(2)])) -L[1, 1, 1] + L[1, 2]
- counit_on_basis(I)[source]#
The counit is defined by sending all elements of positive degree to zero.
EXAMPLES:
sage: S = NonCommutativeSymmetricFunctions(QQ).S() sage: S.counit_on_basis([1,3]) 0 sage: M = QuasiSymmetricFunctions(QQ).M() sage: M.counit_on_basis([1,3]) 0
>>> from sage.all import * >>> S = NonCommutativeSymmetricFunctions(QQ).S() >>> S.counit_on_basis([Integer(1),Integer(3)]) 0 >>> M = QuasiSymmetricFunctions(QQ).M() >>> M.counit_on_basis([Integer(1),Integer(3)]) 0
- degree_negation(element)[source]#
Return the image of
element
under the degree negation automorphism ofself
.The degree negation is the automorphism which scales every homogeneous element of degree \(k\) by \((-1)^k\) (for all \(k\)).
INPUT:
element
– element ofself
EXAMPLES:
sage: NSym = NonCommutativeSymmetricFunctions(ZZ) sage: S = NSym.S() sage: f = 2*S[2,1] + 4*S[1,1] - 5*S[1,2] - 3*S[[]] sage: S.degree_negation(f) -3*S[] + 4*S[1, 1] + 5*S[1, 2] - 2*S[2, 1] sage: QSym = QuasiSymmetricFunctions(QQ) sage: dI = QSym.dualImmaculate() sage: f = -3*dI[2,1] + 4*dI[2] + 2*dI[1] sage: dI.degree_negation(f) -2*dI[1] + 4*dI[2] + 3*dI[2, 1]
>>> from sage.all import * >>> NSym = NonCommutativeSymmetricFunctions(ZZ) >>> S = NSym.S() >>> f = Integer(2)*S[Integer(2),Integer(1)] + Integer(4)*S[Integer(1),Integer(1)] - Integer(5)*S[Integer(1),Integer(2)] - Integer(3)*S[[]] >>> S.degree_negation(f) -3*S[] + 4*S[1, 1] + 5*S[1, 2] - 2*S[2, 1] >>> QSym = QuasiSymmetricFunctions(QQ) >>> dI = QSym.dualImmaculate() >>> f = -Integer(3)*dI[Integer(2),Integer(1)] + Integer(4)*dI[Integer(2)] + Integer(2)*dI[Integer(1)] >>> dI.degree_negation(f) -2*dI[1] + 4*dI[2] + 3*dI[2, 1]
Todo
Generalize this to all graded vector spaces?
- degree_on_basis(I)[source]#
Return the degree of the basis element indexed by \(I\).
INPUT:
I
– a composition
OUTPUT:
The degree of the non-commutative symmetric function basis element of
self
indexed byI
. By definition, this is the size of the compositionI
.
EXAMPLES:
sage: R = NonCommutativeSymmetricFunctions(QQ).ribbon() sage: R.degree_on_basis(Composition([2,3])) 5 sage: M = QuasiSymmetricFunctions(QQ).Monomial() sage: M.degree_on_basis(Composition([3,2])) 5 sage: M.degree_on_basis(Composition([])) 0
>>> from sage.all import * >>> R = NonCommutativeSymmetricFunctions(QQ).ribbon() >>> R.degree_on_basis(Composition([Integer(2),Integer(3)])) 5 >>> M = QuasiSymmetricFunctions(QQ).Monomial() >>> M.degree_on_basis(Composition([Integer(3),Integer(2)])) 5 >>> M.degree_on_basis(Composition([])) 0
- duality_pairing(x, y)[source]#
The duality pairing between elements of \(NSym\) and elements of \(QSym\).
This is a default implementation that uses
self.realizations_of().a_realization()
and its dual basis.INPUT:
x
– an element ofself
y
– an element in the dual basis ofself
OUTPUT:
The result of pairing the function
x
fromself
with the functiony
from the dual basis ofself
EXAMPLES:
sage: R = NonCommutativeSymmetricFunctions(QQ).Ribbon() sage: F = QuasiSymmetricFunctions(QQ).Fundamental() sage: R.duality_pairing(R[1,1,2], F[1,1,2]) 1 sage: R.duality_pairing(R[1,2,1], F[1,1,2]) 0 sage: F.duality_pairing(F[1,2,1], R[1,1,2]) 0
>>> from sage.all import * >>> R = NonCommutativeSymmetricFunctions(QQ).Ribbon() >>> F = QuasiSymmetricFunctions(QQ).Fundamental() >>> R.duality_pairing(R[Integer(1),Integer(1),Integer(2)], F[Integer(1),Integer(1),Integer(2)]) 1 >>> R.duality_pairing(R[Integer(1),Integer(2),Integer(1)], F[Integer(1),Integer(1),Integer(2)]) 0 >>> F.duality_pairing(F[Integer(1),Integer(2),Integer(1)], R[Integer(1),Integer(1),Integer(2)]) 0
sage: S = NonCommutativeSymmetricFunctions(QQ).Complete() sage: M = QuasiSymmetricFunctions(QQ).Monomial() sage: S.duality_pairing(S[1,1,2], M[1,1,2]) 1 sage: S.duality_pairing(S[1,2,1], M[1,1,2]) 0 sage: M.duality_pairing(M[1,1,2], S[1,1,2]) 1 sage: M.duality_pairing(M[1,2,1], S[1,1,2]) 0
>>> from sage.all import * >>> S = NonCommutativeSymmetricFunctions(QQ).Complete() >>> M = QuasiSymmetricFunctions(QQ).Monomial() >>> S.duality_pairing(S[Integer(1),Integer(1),Integer(2)], M[Integer(1),Integer(1),Integer(2)]) 1 >>> S.duality_pairing(S[Integer(1),Integer(2),Integer(1)], M[Integer(1),Integer(1),Integer(2)]) 0 >>> M.duality_pairing(M[Integer(1),Integer(1),Integer(2)], S[Integer(1),Integer(1),Integer(2)]) 1 >>> M.duality_pairing(M[Integer(1),Integer(2),Integer(1)], S[Integer(1),Integer(1),Integer(2)]) 0
sage: S = NonCommutativeSymmetricFunctions(QQ).Complete() sage: F = QuasiSymmetricFunctions(QQ).Fundamental() sage: S.duality_pairing(S[1,2], F[1,1,1]) 0 sage: S.duality_pairing(S[1,1,1,1], F[4]) 1
>>> from sage.all import * >>> S = NonCommutativeSymmetricFunctions(QQ).Complete() >>> F = QuasiSymmetricFunctions(QQ).Fundamental() >>> S.duality_pairing(S[Integer(1),Integer(2)], F[Integer(1),Integer(1),Integer(1)]) 0 >>> S.duality_pairing(S[Integer(1),Integer(1),Integer(1),Integer(1)], F[Integer(4)]) 1
- duality_pairing_by_coercion(x, y)[source]#
The duality pairing between elements of NSym and elements of QSym.
This is a default implementation that uses
self.realizations_of().a_realization()
and its dual basis.INPUT:
x
– an element ofself
y
– an element in the dual basis ofself
OUTPUT:
The result of pairing the function
x
fromself
with the functiony
from the dual basis ofself
EXAMPLES:
sage: L = NonCommutativeSymmetricFunctions(QQ).Elementary() sage: F = QuasiSymmetricFunctions(QQ).Fundamental() sage: L.duality_pairing_by_coercion(L[1,2], F[1,2]) 0 sage: F.duality_pairing_by_coercion(F[1,2], L[1,2]) 0 sage: L.duality_pairing_by_coercion(L[1,1,1], F[1,2]) 1 sage: F.duality_pairing_by_coercion(F[1,2], L[1,1,1]) 1
>>> from sage.all import * >>> L = NonCommutativeSymmetricFunctions(QQ).Elementary() >>> F = QuasiSymmetricFunctions(QQ).Fundamental() >>> L.duality_pairing_by_coercion(L[Integer(1),Integer(2)], F[Integer(1),Integer(2)]) 0 >>> F.duality_pairing_by_coercion(F[Integer(1),Integer(2)], L[Integer(1),Integer(2)]) 0 >>> L.duality_pairing_by_coercion(L[Integer(1),Integer(1),Integer(1)], F[Integer(1),Integer(2)]) 1 >>> F.duality_pairing_by_coercion(F[Integer(1),Integer(2)], L[Integer(1),Integer(1),Integer(1)]) 1
- duality_pairing_matrix(basis, degree)[source]#
The matrix of scalar products between elements of NSym and elements of QSym.
INPUT:
basis
– A basis of the dual Hopf algebradegree
– a non-negative integer
OUTPUT:
The matrix of scalar products between the basis
self
and the basisbasis
in the dual Hopf algebra in degreedegree
.
EXAMPLES:
The ribbon basis of NCSF is dual to the fundamental basis of QSym:
sage: R = NonCommutativeSymmetricFunctions(QQ).ribbon() sage: F = QuasiSymmetricFunctions(QQ).Fundamental() sage: R.duality_pairing_matrix(F, 3) [1 0 0 0] [0 1 0 0] [0 0 1 0] [0 0 0 1] sage: F.duality_pairing_matrix(R, 3) [1 0 0 0] [0 1 0 0] [0 0 1 0] [0 0 0 1]
>>> from sage.all import * >>> R = NonCommutativeSymmetricFunctions(QQ).ribbon() >>> F = QuasiSymmetricFunctions(QQ).Fundamental() >>> R.duality_pairing_matrix(F, Integer(3)) [1 0 0 0] [0 1 0 0] [0 0 1 0] [0 0 0 1] >>> F.duality_pairing_matrix(R, Integer(3)) [1 0 0 0] [0 1 0 0] [0 0 1 0] [0 0 0 1]
The complete basis of NCSF is dual to the monomial basis of QSym:
sage: S = NonCommutativeSymmetricFunctions(QQ).complete() sage: M = QuasiSymmetricFunctions(QQ).Monomial() sage: S.duality_pairing_matrix(M, 3) [1 0 0 0] [0 1 0 0] [0 0 1 0] [0 0 0 1] sage: M.duality_pairing_matrix(S, 3) [1 0 0 0] [0 1 0 0] [0 0 1 0] [0 0 0 1]
>>> from sage.all import * >>> S = NonCommutativeSymmetricFunctions(QQ).complete() >>> M = QuasiSymmetricFunctions(QQ).Monomial() >>> S.duality_pairing_matrix(M, Integer(3)) [1 0 0 0] [0 1 0 0] [0 0 1 0] [0 0 0 1] >>> M.duality_pairing_matrix(S, Integer(3)) [1 0 0 0] [0 1 0 0] [0 0 1 0] [0 0 0 1]
The matrix between the ribbon basis of NCSF and the monomial basis of QSym:
sage: R = NonCommutativeSymmetricFunctions(QQ).ribbon() sage: M = QuasiSymmetricFunctions(QQ).Monomial() sage: R.duality_pairing_matrix(M, 3) [ 1 -1 -1 1] [ 0 1 0 -1] [ 0 0 1 -1] [ 0 0 0 1] sage: M.duality_pairing_matrix(R, 3) [ 1 0 0 0] [-1 1 0 0] [-1 0 1 0] [ 1 -1 -1 1]
>>> from sage.all import * >>> R = NonCommutativeSymmetricFunctions(QQ).ribbon() >>> M = QuasiSymmetricFunctions(QQ).Monomial() >>> R.duality_pairing_matrix(M, Integer(3)) [ 1 -1 -1 1] [ 0 1 0 -1] [ 0 0 1 -1] [ 0 0 0 1] >>> M.duality_pairing_matrix(R, Integer(3)) [ 1 0 0 0] [-1 1 0 0] [-1 0 1 0] [ 1 -1 -1 1]
The matrix between the complete basis of NCSF and the fundamental basis of QSym:
sage: S = NonCommutativeSymmetricFunctions(QQ).complete() sage: F = QuasiSymmetricFunctions(QQ).Fundamental() sage: S.duality_pairing_matrix(F, 3) [1 1 1 1] [0 1 0 1] [0 0 1 1] [0 0 0 1]
>>> from sage.all import * >>> S = NonCommutativeSymmetricFunctions(QQ).complete() >>> F = QuasiSymmetricFunctions(QQ).Fundamental() >>> S.duality_pairing_matrix(F, Integer(3)) [1 1 1 1] [0 1 0 1] [0 0 1 1] [0 0 0 1]
A base case test:
sage: R.duality_pairing_matrix(M,0) [1]
>>> from sage.all import * >>> R.duality_pairing_matrix(M,Integer(0)) [1]
- one_basis()[source]#
Return the empty composition.
OUTPUT:
The empty composition.
EXAMPLES:
sage: L = NonCommutativeSymmetricFunctions(QQ).L() sage: parent(L) <class 'sage.combinat.ncsf_qsym.ncsf.NonCommutativeSymmetricFunctions.Elementary_with_category'> sage: parent(L).one_basis() []
>>> from sage.all import * >>> L = NonCommutativeSymmetricFunctions(QQ).L() >>> parent(L) <class 'sage.combinat.ncsf_qsym.ncsf.NonCommutativeSymmetricFunctions.Elementary_with_category'> >>> parent(L).one_basis() []
- skew(x, y, side='left')[source]#
Return a function
x
inself
skewed by a functiony
in the Hopf dual ofself
.INPUT:
x
– a non-commutative or quasi-symmetric function; it is an element ofself
y
– a quasi-symmetric or non-commutative symmetric function; it is an element of the dual algebra ofself
side
– (default:'left'
) either'left'
or'right'
OUTPUT:
The result of skewing the element
x
by the Hopf algebra elementy
(either from the left or from the right, as determined byside
), written in the basisself
.
EXAMPLES:
sage: S = NonCommutativeSymmetricFunctions(QQ).complete() sage: F = QuasiSymmetricFunctions(QQ).Fundamental() sage: S.skew(S[2,2,2], F[1,1]) S[1, 1, 2] + S[1, 2, 1] + S[2, 1, 1] sage: S.skew(S[2,2,2], F[2]) S[1, 1, 2] + S[1, 2, 1] + S[2, 1, 1] + 3*S[2, 2]
>>> from sage.all import * >>> S = NonCommutativeSymmetricFunctions(QQ).complete() >>> F = QuasiSymmetricFunctions(QQ).Fundamental() >>> S.skew(S[Integer(2),Integer(2),Integer(2)], F[Integer(1),Integer(1)]) S[1, 1, 2] + S[1, 2, 1] + S[2, 1, 1] >>> S.skew(S[Integer(2),Integer(2),Integer(2)], F[Integer(2)]) S[1, 1, 2] + S[1, 2, 1] + S[2, 1, 1] + 3*S[2, 2]
sage: R = NonCommutativeSymmetricFunctions(QQ).ribbon() sage: F = QuasiSymmetricFunctions(QQ).Fundamental() sage: R.skew(R[2,2,2], F[1,1]) R[1, 1, 2] + R[1, 2, 1] + R[1, 3] + R[2, 1, 1] + 2*R[2, 2] + R[3, 1] + R[4] sage: R.skew(R[2,2,2], F[2]) R[1, 1, 2] + R[1, 2, 1] + R[1, 3] + R[2, 1, 1] + 3*R[2, 2] + R[3, 1] + R[4]
>>> from sage.all import * >>> R = NonCommutativeSymmetricFunctions(QQ).ribbon() >>> F = QuasiSymmetricFunctions(QQ).Fundamental() >>> R.skew(R[Integer(2),Integer(2),Integer(2)], F[Integer(1),Integer(1)]) R[1, 1, 2] + R[1, 2, 1] + R[1, 3] + R[2, 1, 1] + 2*R[2, 2] + R[3, 1] + R[4] >>> R.skew(R[Integer(2),Integer(2),Integer(2)], F[Integer(2)]) R[1, 1, 2] + R[1, 2, 1] + R[1, 3] + R[2, 1, 1] + 3*R[2, 2] + R[3, 1] + R[4]
sage: S = NonCommutativeSymmetricFunctions(QQ).S() sage: R = NonCommutativeSymmetricFunctions(QQ).R() sage: M = QuasiSymmetricFunctions(QQ).M() sage: M.skew(M[3,2], S[2]) 0 sage: M.skew(M[3,2], S[2], side='right') M[3] sage: M.skew(M[3,2], S[3]) M[2] sage: M.skew(M[3,2], S[3], side='right') 0
>>> from sage.all import * >>> S = NonCommutativeSymmetricFunctions(QQ).S() >>> R = NonCommutativeSymmetricFunctions(QQ).R() >>> M = QuasiSymmetricFunctions(QQ).M() >>> M.skew(M[Integer(3),Integer(2)], S[Integer(2)]) 0 >>> M.skew(M[Integer(3),Integer(2)], S[Integer(2)], side='right') M[3] >>> M.skew(M[Integer(3),Integer(2)], S[Integer(3)]) M[2] >>> M.skew(M[Integer(3),Integer(2)], S[Integer(3)], side='right') 0
- sum_of_fatter_compositions(composition)[source]#
Return the sum of all fatter compositions.
INPUT:
composition
– a composition
OUTPUT:
the sum of all basis elements which are indexed by compositions fatter (coarser?) than
composition
.
EXAMPLES:
sage: L = NonCommutativeSymmetricFunctions(QQ).L() sage: L.sum_of_fatter_compositions(Composition([2,1])) L[2, 1] + L[3] sage: R = NonCommutativeSymmetricFunctions(QQ).R() sage: R.sum_of_fatter_compositions(Composition([1,3])) R[1, 3] + R[4]
>>> from sage.all import * >>> L = NonCommutativeSymmetricFunctions(QQ).L() >>> L.sum_of_fatter_compositions(Composition([Integer(2),Integer(1)])) L[2, 1] + L[3] >>> R = NonCommutativeSymmetricFunctions(QQ).R() >>> R.sum_of_fatter_compositions(Composition([Integer(1),Integer(3)])) R[1, 3] + R[4]
- sum_of_finer_compositions(composition)[source]#
Return the sum of all finer compositions.
INPUT:
composition
– a composition
OUTPUT:
The sum of all basis
self
elements which are indexed by compositions finer thancomposition
.
EXAMPLES:
sage: L = NonCommutativeSymmetricFunctions(QQ).L() sage: L.sum_of_finer_compositions(Composition([2,1])) L[1, 1, 1] + L[2, 1] sage: R = NonCommutativeSymmetricFunctions(QQ).R() sage: R.sum_of_finer_compositions(Composition([1,3])) R[1, 1, 1, 1] + R[1, 1, 2] + R[1, 2, 1] + R[1, 3]
>>> from sage.all import * >>> L = NonCommutativeSymmetricFunctions(QQ).L() >>> L.sum_of_finer_compositions(Composition([Integer(2),Integer(1)])) L[1, 1, 1] + L[2, 1] >>> R = NonCommutativeSymmetricFunctions(QQ).R() >>> R.sum_of_finer_compositions(Composition([Integer(1),Integer(3)])) R[1, 1, 1, 1] + R[1, 1, 2] + R[1, 2, 1] + R[1, 3]
- sum_of_partition_rearrangements(par)[source]#
Return the sum of all basis elements indexed by compositions which can be sorted to obtain a given partition.
INPUT:
par
– a partition
OUTPUT:
The sum of all
self
basis elements indexed by compositions which are permutations ofpar
(without multiplicity).
EXAMPLES:
sage: NCSF=NonCommutativeSymmetricFunctions(QQ) sage: elementary = NCSF.elementary() sage: elementary.sum_of_partition_rearrangements(Partition([2,2,1])) L[1, 2, 2] + L[2, 1, 2] + L[2, 2, 1] sage: elementary.sum_of_partition_rearrangements(Partition([3,2,1])) L[1, 2, 3] + L[1, 3, 2] + L[2, 1, 3] + L[2, 3, 1] + L[3, 1, 2] + L[3, 2, 1] sage: elementary.sum_of_partition_rearrangements(Partition([])) L[]
>>> from sage.all import * >>> NCSF=NonCommutativeSymmetricFunctions(QQ) >>> elementary = NCSF.elementary() >>> elementary.sum_of_partition_rearrangements(Partition([Integer(2),Integer(2),Integer(1)])) L[1, 2, 2] + L[2, 1, 2] + L[2, 2, 1] >>> elementary.sum_of_partition_rearrangements(Partition([Integer(3),Integer(2),Integer(1)])) L[1, 2, 3] + L[1, 3, 2] + L[2, 1, 3] + L[2, 3, 1] + L[3, 1, 2] + L[3, 2, 1] >>> elementary.sum_of_partition_rearrangements(Partition([])) L[]
- class sage.combinat.ncsf_qsym.generic_basis_code.GradedModulesWithInternalProduct(base, name=None)[source]#
Bases:
Category_over_base_ring
Constructs the class of modules with internal product. This is used to give an internal product structure to the non-commutative symmetric functions.
EXAMPLES:
sage: from sage.combinat.ncsf_qsym.generic_basis_code import GradedModulesWithInternalProduct sage: N = NonCommutativeSymmetricFunctions(QQ) sage: R = N.ribbon() sage: R in GradedModulesWithInternalProduct(QQ) True
>>> from sage.all import * >>> from sage.combinat.ncsf_qsym.generic_basis_code import GradedModulesWithInternalProduct >>> N = NonCommutativeSymmetricFunctions(QQ) >>> R = N.ribbon() >>> R in GradedModulesWithInternalProduct(QQ) True
- class ElementMethods[source]#
Bases:
object
- internal_product(other)[source]#
Return the internal product of two non-commutative symmetric functions.
The internal product on the algebra of non-commutative symmetric functions is adjoint to the internal coproduct on the algebra of quasisymmetric functions with respect to the duality pairing between these two algebras. This means, explicitly, that any two non-commutative symmetric functions \(f\) and \(g\) and any quasi-symmetric function \(h\) satisfy
\[\langle f * g, h \rangle = \sum_i \left\langle f, h^{\prime}_i \right\rangle \left\langle g, h^{\prime\prime}_i \right\rangle,\]where we write \(\Delta^{\times}(h)\) as \(\sum_i h^{\prime}_i \otimes h^{\prime\prime}_i\). Here, \(f * g\) denotes the internal product of the non-commutative symmetric functions \(f\) and \(g\).
If \(f\) and \(g\) are two homogeneous elements of \(NSym\) having distinct degrees, then the internal product \(f * g\) is zero.
Explicit formulas can be given for internal products of elements of the complete and the Psi bases. First, the formula for the Complete basis ([NCSF1] Proposition 5.1): If \(I\) and \(J\) are two compositions of lengths \(p\) and \(q\), respectively, then the corresponding Complete homogeneous non-commutative symmetric functions \(S^I\) and \(S^J\) have internal product
\[S^I * S^J = \sum S^{\operatorname*{comp}M},\]where the sum ranges over all \(p \times q\)-matrices \(M \in \NN^{p \times q}\) (with nonnegative integers as entries) whose row sum vector is \(I\) (that is, the sum of the entries of the \(r\)-th row is the \(r\)-th part of \(I\) for all \(r\)) and whose column sum vector is \(J\) (that is, the sum of all entries of the \(s\)-th row is the \(s\)-th part of \(J\) for all \(s\)). Here, for any \(M \in \NN^{p \times q}\), we denote by \(\operatorname*{comp}M\) the composition obtained by reading the entries of the matrix \(M\) in the usual order (row by row, proceeding left to right in each row, traversing the rows from top to bottom).
The formula on the Psi basis ([NCSF2] Lemma 3.10) is more complicated. Let \(I\) and \(J\) be two compositions of lengths \(p\) and \(q\), respectively, having the same size \(|I| = |J|\). We denote by \(\Psi^K\) the element of the Psi basis corresponding to any composition \(K\).
If \(p > q\), then \(\Psi^I * \Psi^J\) is plainly \(0\).
Assume that \(p = q\). Let \(\widetilde{\delta}_{I, J}\) denote the integer \(1\) if the compositions \(I\) and \(J\) are permutations of each other, and the integer \(0\) otherwise. For every positive integer \(i\), let \(m_i\) denote the number of parts of \(I\) equal to \(i\). Then, \(\Psi^I * \Psi^J\) equals \(\widetilde{\delta}_{I, J} \prod_{i>0} i^{m_i} m_i! \Psi^I\).
Now assume that \(p < q\). Write the composition \(I\) as \(I = (i_1, i_2, \ldots, i_p)\). For every nonempty composition \(K = (k_1, k_2, \ldots, k_s)\), denote by \(\Gamma_K\) the non-commutative symmetric function \(k_1 [\ldots [[\Psi_{k_1}, \Psi_{k_2}], \Psi_{k_3}], \ldots \Psi_{k_s}]\). For any subset \(A\) of \(\{ 1, 2, \ldots, q \}\), let \(J_A\) be the composition obtained from \(J\) by removing the \(r\)-th parts for all \(r \notin A\) (while keeping the \(r\)-th parts for all \(r \in A\) in order). Then, \(\Psi^I * \Psi^J\) equals the sum of \(\Gamma_{J_{K_1}} \Gamma_{J_{K_2}} \cdots \Gamma_{J_{K_p}}\) over all ordered set partitions \((K_1, K_2, \ldots, K_p)\) of \(\{ 1, 2, \ldots, q \}\) into \(p\) parts such that each \(1 \leq k \leq p\) satisfies \(\left\lvert J_{K_k} \right\rvert = i_k\). (See
OrderedSetPartition()
for the meaning of “ordered set partition”.)
Aliases for
internal_product()
areitensor()
andkronecker_product()
.INPUT:
other
– another non-commutative symmetric function
OUTPUT:
The result of taking the internal product of
self
withother
.
EXAMPLES:
sage: N = NonCommutativeSymmetricFunctions(QQ) sage: S = N.complete() sage: x = S.an_element(); x 2*S[] + 2*S[1] + 3*S[1, 1] sage: x.internal_product(S[2]) 3*S[1, 1] sage: x.internal_product(S[1]) 2*S[1] sage: S[1,2].internal_product(S[1,2]) S[1, 1, 1] + S[1, 2]
>>> from sage.all import * >>> N = NonCommutativeSymmetricFunctions(QQ) >>> S = N.complete() >>> x = S.an_element(); x 2*S[] + 2*S[1] + 3*S[1, 1] >>> x.internal_product(S[Integer(2)]) 3*S[1, 1] >>> x.internal_product(S[Integer(1)]) 2*S[1] >>> S[Integer(1),Integer(2)].internal_product(S[Integer(1),Integer(2)]) S[1, 1, 1] + S[1, 2]
Let us check the duality between the inner product and the inner coproduct in degree \(4\):
sage: M = QuasiSymmetricFunctions(FiniteField(29)).M() sage: S = NonCommutativeSymmetricFunctions(FiniteField(29)).S() sage: def tensor_incopr(f, g, h): # computes \sum_i \left< f, h'_i \right> \left< g, h''_i \right> ....: result = h.base_ring().zero() ....: h_parent = h.parent() ....: for partition_pair, coeff in h.internal_coproduct().monomial_coefficients().items(): ....: result += coeff * f.duality_pairing(h_parent[partition_pair[0]]) * g.duality_pairing(h_parent[partition_pair[1]]) ....: return result sage: def testall(n): ....: return all( all( all( tensor_incopr(S[u], S[v], M[w]) == (S[u].itensor(S[v])).duality_pairing(M[w]) ....: for w in Compositions(n) ) ....: for v in Compositions(n) ) ....: for u in Compositions(n) ) sage: testall(2) True sage: testall(3) # long time True sage: testall(4) # not tested, too long True
>>> from sage.all import * >>> M = QuasiSymmetricFunctions(FiniteField(Integer(29))).M() >>> S = NonCommutativeSymmetricFunctions(FiniteField(Integer(29))).S() >>> def tensor_incopr(f, g, h): # computes \sum_i \left< f, h'_i \right> \left< g, h''_i \right> ... result = h.base_ring().zero() ... h_parent = h.parent() ... for partition_pair, coeff in h.internal_coproduct().monomial_coefficients().items(): ... result += coeff * f.duality_pairing(h_parent[partition_pair[Integer(0)]]) * g.duality_pairing(h_parent[partition_pair[Integer(1)]]) ... return result >>> def testall(n): ... return all( all( all( tensor_incopr(S[u], S[v], M[w]) == (S[u].itensor(S[v])).duality_pairing(M[w]) ... for w in Compositions(n) ) ... for v in Compositions(n) ) ... for u in Compositions(n) ) >>> testall(Integer(2)) True >>> testall(Integer(3)) # long time True >>> testall(Integer(4)) # not tested, too long True
The internal product on the algebra of non-commutative symmetric functions commutes with the canonical commutative projection on the symmetric functions:
sage: S = NonCommutativeSymmetricFunctions(ZZ).S() sage: e = SymmetricFunctions(ZZ).e() sage: def int_pr_of_S_in_e(I, J): ....: return (S[I].internal_product(S[J])).to_symmetric_function() sage: all( all( int_pr_of_S_in_e(I, J) ....: == S[I].to_symmetric_function().internal_product(S[J].to_symmetric_function()) ....: for I in Compositions(3) ) ....: for J in Compositions(3) ) True
>>> from sage.all import * >>> S = NonCommutativeSymmetricFunctions(ZZ).S() >>> e = SymmetricFunctions(ZZ).e() >>> def int_pr_of_S_in_e(I, J): ... return (S[I].internal_product(S[J])).to_symmetric_function() >>> all( all( int_pr_of_S_in_e(I, J) ... == S[I].to_symmetric_function().internal_product(S[J].to_symmetric_function()) ... for I in Compositions(Integer(3)) ) ... for J in Compositions(Integer(3)) ) True
- itensor(other)[source]#
Return the internal product of two non-commutative symmetric functions.
The internal product on the algebra of non-commutative symmetric functions is adjoint to the internal coproduct on the algebra of quasisymmetric functions with respect to the duality pairing between these two algebras. This means, explicitly, that any two non-commutative symmetric functions \(f\) and \(g\) and any quasi-symmetric function \(h\) satisfy
\[\langle f * g, h \rangle = \sum_i \left\langle f, h^{\prime}_i \right\rangle \left\langle g, h^{\prime\prime}_i \right\rangle,\]where we write \(\Delta^{\times}(h)\) as \(\sum_i h^{\prime}_i \otimes h^{\prime\prime}_i\). Here, \(f * g\) denotes the internal product of the non-commutative symmetric functions \(f\) and \(g\).
If \(f\) and \(g\) are two homogeneous elements of \(NSym\) having distinct degrees, then the internal product \(f * g\) is zero.
Explicit formulas can be given for internal products of elements of the complete and the Psi bases. First, the formula for the Complete basis ([NCSF1] Proposition 5.1): If \(I\) and \(J\) are two compositions of lengths \(p\) and \(q\), respectively, then the corresponding Complete homogeneous non-commutative symmetric functions \(S^I\) and \(S^J\) have internal product
\[S^I * S^J = \sum S^{\operatorname*{comp}M},\]where the sum ranges over all \(p \times q\)-matrices \(M \in \NN^{p \times q}\) (with nonnegative integers as entries) whose row sum vector is \(I\) (that is, the sum of the entries of the \(r\)-th row is the \(r\)-th part of \(I\) for all \(r\)) and whose column sum vector is \(J\) (that is, the sum of all entries of the \(s\)-th row is the \(s\)-th part of \(J\) for all \(s\)). Here, for any \(M \in \NN^{p \times q}\), we denote by \(\operatorname*{comp}M\) the composition obtained by reading the entries of the matrix \(M\) in the usual order (row by row, proceeding left to right in each row, traversing the rows from top to bottom).
The formula on the Psi basis ([NCSF2] Lemma 3.10) is more complicated. Let \(I\) and \(J\) be two compositions of lengths \(p\) and \(q\), respectively, having the same size \(|I| = |J|\). We denote by \(\Psi^K\) the element of the Psi basis corresponding to any composition \(K\).
If \(p > q\), then \(\Psi^I * \Psi^J\) is plainly \(0\).
Assume that \(p = q\). Let \(\widetilde{\delta}_{I, J}\) denote the integer \(1\) if the compositions \(I\) and \(J\) are permutations of each other, and the integer \(0\) otherwise. For every positive integer \(i\), let \(m_i\) denote the number of parts of \(I\) equal to \(i\). Then, \(\Psi^I * \Psi^J\) equals \(\widetilde{\delta}_{I, J} \prod_{i>0} i^{m_i} m_i! \Psi^I\).
Now assume that \(p < q\). Write the composition \(I\) as \(I = (i_1, i_2, \ldots, i_p)\). For every nonempty composition \(K = (k_1, k_2, \ldots, k_s)\), denote by \(\Gamma_K\) the non-commutative symmetric function \(k_1 [\ldots [[\Psi_{k_1}, \Psi_{k_2}], \Psi_{k_3}], \ldots \Psi_{k_s}]\). For any subset \(A\) of \(\{ 1, 2, \ldots, q \}\), let \(J_A\) be the composition obtained from \(J\) by removing the \(r\)-th parts for all \(r \notin A\) (while keeping the \(r\)-th parts for all \(r \in A\) in order). Then, \(\Psi^I * \Psi^J\) equals the sum of \(\Gamma_{J_{K_1}} \Gamma_{J_{K_2}} \cdots \Gamma_{J_{K_p}}\) over all ordered set partitions \((K_1, K_2, \ldots, K_p)\) of \(\{ 1, 2, \ldots, q \}\) into \(p\) parts such that each \(1 \leq k \leq p\) satisfies \(\left\lvert J_{K_k} \right\rvert = i_k\). (See
OrderedSetPartition()
for the meaning of “ordered set partition”.)
Aliases for
internal_product()
areitensor()
andkronecker_product()
.INPUT:
other
– another non-commutative symmetric function
OUTPUT:
The result of taking the internal product of
self
withother
.
EXAMPLES:
sage: N = NonCommutativeSymmetricFunctions(QQ) sage: S = N.complete() sage: x = S.an_element(); x 2*S[] + 2*S[1] + 3*S[1, 1] sage: x.internal_product(S[2]) 3*S[1, 1] sage: x.internal_product(S[1]) 2*S[1] sage: S[1,2].internal_product(S[1,2]) S[1, 1, 1] + S[1, 2]
>>> from sage.all import * >>> N = NonCommutativeSymmetricFunctions(QQ) >>> S = N.complete() >>> x = S.an_element(); x 2*S[] + 2*S[1] + 3*S[1, 1] >>> x.internal_product(S[Integer(2)]) 3*S[1, 1] >>> x.internal_product(S[Integer(1)]) 2*S[1] >>> S[Integer(1),Integer(2)].internal_product(S[Integer(1),Integer(2)]) S[1, 1, 1] + S[1, 2]
Let us check the duality between the inner product and the inner coproduct in degree \(4\):
sage: M = QuasiSymmetricFunctions(FiniteField(29)).M() sage: S = NonCommutativeSymmetricFunctions(FiniteField(29)).S() sage: def tensor_incopr(f, g, h): # computes \sum_i \left< f, h'_i \right> \left< g, h''_i \right> ....: result = h.base_ring().zero() ....: h_parent = h.parent() ....: for partition_pair, coeff in h.internal_coproduct().monomial_coefficients().items(): ....: result += coeff * f.duality_pairing(h_parent[partition_pair[0]]) * g.duality_pairing(h_parent[partition_pair[1]]) ....: return result sage: def testall(n): ....: return all( all( all( tensor_incopr(S[u], S[v], M[w]) == (S[u].itensor(S[v])).duality_pairing(M[w]) ....: for w in Compositions(n) ) ....: for v in Compositions(n) ) ....: for u in Compositions(n) ) sage: testall(2) True sage: testall(3) # long time True sage: testall(4) # not tested, too long True
>>> from sage.all import * >>> M = QuasiSymmetricFunctions(FiniteField(Integer(29))).M() >>> S = NonCommutativeSymmetricFunctions(FiniteField(Integer(29))).S() >>> def tensor_incopr(f, g, h): # computes \sum_i \left< f, h'_i \right> \left< g, h''_i \right> ... result = h.base_ring().zero() ... h_parent = h.parent() ... for partition_pair, coeff in h.internal_coproduct().monomial_coefficients().items(): ... result += coeff * f.duality_pairing(h_parent[partition_pair[Integer(0)]]) * g.duality_pairing(h_parent[partition_pair[Integer(1)]]) ... return result >>> def testall(n): ... return all( all( all( tensor_incopr(S[u], S[v], M[w]) == (S[u].itensor(S[v])).duality_pairing(M[w]) ... for w in Compositions(n) ) ... for v in Compositions(n) ) ... for u in Compositions(n) ) >>> testall(Integer(2)) True >>> testall(Integer(3)) # long time True >>> testall(Integer(4)) # not tested, too long True
The internal product on the algebra of non-commutative symmetric functions commutes with the canonical commutative projection on the symmetric functions:
sage: S = NonCommutativeSymmetricFunctions(ZZ).S() sage: e = SymmetricFunctions(ZZ).e() sage: def int_pr_of_S_in_e(I, J): ....: return (S[I].internal_product(S[J])).to_symmetric_function() sage: all( all( int_pr_of_S_in_e(I, J) ....: == S[I].to_symmetric_function().internal_product(S[J].to_symmetric_function()) ....: for I in Compositions(3) ) ....: for J in Compositions(3) ) True
>>> from sage.all import * >>> S = NonCommutativeSymmetricFunctions(ZZ).S() >>> e = SymmetricFunctions(ZZ).e() >>> def int_pr_of_S_in_e(I, J): ... return (S[I].internal_product(S[J])).to_symmetric_function() >>> all( all( int_pr_of_S_in_e(I, J) ... == S[I].to_symmetric_function().internal_product(S[J].to_symmetric_function()) ... for I in Compositions(Integer(3)) ) ... for J in Compositions(Integer(3)) ) True
- kronecker_product(other)[source]#
Return the internal product of two non-commutative symmetric functions.
The internal product on the algebra of non-commutative symmetric functions is adjoint to the internal coproduct on the algebra of quasisymmetric functions with respect to the duality pairing between these two algebras. This means, explicitly, that any two non-commutative symmetric functions \(f\) and \(g\) and any quasi-symmetric function \(h\) satisfy
\[\langle f * g, h \rangle = \sum_i \left\langle f, h^{\prime}_i \right\rangle \left\langle g, h^{\prime\prime}_i \right\rangle,\]where we write \(\Delta^{\times}(h)\) as \(\sum_i h^{\prime}_i \otimes h^{\prime\prime}_i\). Here, \(f * g\) denotes the internal product of the non-commutative symmetric functions \(f\) and \(g\).
If \(f\) and \(g\) are two homogeneous elements of \(NSym\) having distinct degrees, then the internal product \(f * g\) is zero.
Explicit formulas can be given for internal products of elements of the complete and the Psi bases. First, the formula for the Complete basis ([NCSF1] Proposition 5.1): If \(I\) and \(J\) are two compositions of lengths \(p\) and \(q\), respectively, then the corresponding Complete homogeneous non-commutative symmetric functions \(S^I\) and \(S^J\) have internal product
\[S^I * S^J = \sum S^{\operatorname*{comp}M},\]where the sum ranges over all \(p \times q\)-matrices \(M \in \NN^{p \times q}\) (with nonnegative integers as entries) whose row sum vector is \(I\) (that is, the sum of the entries of the \(r\)-th row is the \(r\)-th part of \(I\) for all \(r\)) and whose column sum vector is \(J\) (that is, the sum of all entries of the \(s\)-th row is the \(s\)-th part of \(J\) for all \(s\)). Here, for any \(M \in \NN^{p \times q}\), we denote by \(\operatorname*{comp}M\) the composition obtained by reading the entries of the matrix \(M\) in the usual order (row by row, proceeding left to right in each row, traversing the rows from top to bottom).
The formula on the Psi basis ([NCSF2] Lemma 3.10) is more complicated. Let \(I\) and \(J\) be two compositions of lengths \(p\) and \(q\), respectively, having the same size \(|I| = |J|\). We denote by \(\Psi^K\) the element of the Psi basis corresponding to any composition \(K\).
If \(p > q\), then \(\Psi^I * \Psi^J\) is plainly \(0\).
Assume that \(p = q\). Let \(\widetilde{\delta}_{I, J}\) denote the integer \(1\) if the compositions \(I\) and \(J\) are permutations of each other, and the integer \(0\) otherwise. For every positive integer \(i\), let \(m_i\) denote the number of parts of \(I\) equal to \(i\). Then, \(\Psi^I * \Psi^J\) equals \(\widetilde{\delta}_{I, J} \prod_{i>0} i^{m_i} m_i! \Psi^I\).
Now assume that \(p < q\). Write the composition \(I\) as \(I = (i_1, i_2, \ldots, i_p)\). For every nonempty composition \(K = (k_1, k_2, \ldots, k_s)\), denote by \(\Gamma_K\) the non-commutative symmetric function \(k_1 [\ldots [[\Psi_{k_1}, \Psi_{k_2}], \Psi_{k_3}], \ldots \Psi_{k_s}]\). For any subset \(A\) of \(\{ 1, 2, \ldots, q \}\), let \(J_A\) be the composition obtained from \(J\) by removing the \(r\)-th parts for all \(r \notin A\) (while keeping the \(r\)-th parts for all \(r \in A\) in order). Then, \(\Psi^I * \Psi^J\) equals the sum of \(\Gamma_{J_{K_1}} \Gamma_{J_{K_2}} \cdots \Gamma_{J_{K_p}}\) over all ordered set partitions \((K_1, K_2, \ldots, K_p)\) of \(\{ 1, 2, \ldots, q \}\) into \(p\) parts such that each \(1 \leq k \leq p\) satisfies \(\left\lvert J_{K_k} \right\rvert = i_k\). (See
OrderedSetPartition()
for the meaning of “ordered set partition”.)
Aliases for
internal_product()
areitensor()
andkronecker_product()
.INPUT:
other
– another non-commutative symmetric function
OUTPUT:
The result of taking the internal product of
self
withother
.
EXAMPLES:
sage: N = NonCommutativeSymmetricFunctions(QQ) sage: S = N.complete() sage: x = S.an_element(); x 2*S[] + 2*S[1] + 3*S[1, 1] sage: x.internal_product(S[2]) 3*S[1, 1] sage: x.internal_product(S[1]) 2*S[1] sage: S[1,2].internal_product(S[1,2]) S[1, 1, 1] + S[1, 2]
>>> from sage.all import * >>> N = NonCommutativeSymmetricFunctions(QQ) >>> S = N.complete() >>> x = S.an_element(); x 2*S[] + 2*S[1] + 3*S[1, 1] >>> x.internal_product(S[Integer(2)]) 3*S[1, 1] >>> x.internal_product(S[Integer(1)]) 2*S[1] >>> S[Integer(1),Integer(2)].internal_product(S[Integer(1),Integer(2)]) S[1, 1, 1] + S[1, 2]
Let us check the duality between the inner product and the inner coproduct in degree \(4\):
sage: M = QuasiSymmetricFunctions(FiniteField(29)).M() sage: S = NonCommutativeSymmetricFunctions(FiniteField(29)).S() sage: def tensor_incopr(f, g, h): # computes \sum_i \left< f, h'_i \right> \left< g, h''_i \right> ....: result = h.base_ring().zero() ....: h_parent = h.parent() ....: for partition_pair, coeff in h.internal_coproduct().monomial_coefficients().items(): ....: result += coeff * f.duality_pairing(h_parent[partition_pair[0]]) * g.duality_pairing(h_parent[partition_pair[1]]) ....: return result sage: def testall(n): ....: return all( all( all( tensor_incopr(S[u], S[v], M[w]) == (S[u].itensor(S[v])).duality_pairing(M[w]) ....: for w in Compositions(n) ) ....: for v in Compositions(n) ) ....: for u in Compositions(n) ) sage: testall(2) True sage: testall(3) # long time True sage: testall(4) # not tested, too long True
>>> from sage.all import * >>> M = QuasiSymmetricFunctions(FiniteField(Integer(29))).M() >>> S = NonCommutativeSymmetricFunctions(FiniteField(Integer(29))).S() >>> def tensor_incopr(f, g, h): # computes \sum_i \left< f, h'_i \right> \left< g, h''_i \right> ... result = h.base_ring().zero() ... h_parent = h.parent() ... for partition_pair, coeff in h.internal_coproduct().monomial_coefficients().items(): ... result += coeff * f.duality_pairing(h_parent[partition_pair[Integer(0)]]) * g.duality_pairing(h_parent[partition_pair[Integer(1)]]) ... return result >>> def testall(n): ... return all( all( all( tensor_incopr(S[u], S[v], M[w]) == (S[u].itensor(S[v])).duality_pairing(M[w]) ... for w in Compositions(n) ) ... for v in Compositions(n) ) ... for u in Compositions(n) ) >>> testall(Integer(2)) True >>> testall(Integer(3)) # long time True >>> testall(Integer(4)) # not tested, too long True
The internal product on the algebra of non-commutative symmetric functions commutes with the canonical commutative projection on the symmetric functions:
sage: S = NonCommutativeSymmetricFunctions(ZZ).S() sage: e = SymmetricFunctions(ZZ).e() sage: def int_pr_of_S_in_e(I, J): ....: return (S[I].internal_product(S[J])).to_symmetric_function() sage: all( all( int_pr_of_S_in_e(I, J) ....: == S[I].to_symmetric_function().internal_product(S[J].to_symmetric_function()) ....: for I in Compositions(3) ) ....: for J in Compositions(3) ) True
>>> from sage.all import * >>> S = NonCommutativeSymmetricFunctions(ZZ).S() >>> e = SymmetricFunctions(ZZ).e() >>> def int_pr_of_S_in_e(I, J): ... return (S[I].internal_product(S[J])).to_symmetric_function() >>> all( all( int_pr_of_S_in_e(I, J) ... == S[I].to_symmetric_function().internal_product(S[J].to_symmetric_function()) ... for I in Compositions(Integer(3)) ) ... for J in Compositions(Integer(3)) ) True
- class ParentMethods[source]#
Bases:
object
- internal_product()[source]#
The bilinear product inherited from the isomorphism with the descent algebra.
This is constructed by extending the method
internal_product_on_basis()
bilinearly, if available, or using the methodinternal_product_by_coercion()
.OUTPUT:
The internal product map of the algebra the non-commutative symmetric functions.
EXAMPLES:
sage: N = NonCommutativeSymmetricFunctions(QQ) sage: S = N.complete() sage: S.internal_product Generic endomorphism of Non-Commutative Symmetric Functions over the Rational Field in the Complete basis sage: S.internal_product(S[2,2], S[1,2,1]) 2*S[1, 1, 1, 1] + S[1, 1, 2] + S[2, 1, 1] sage: S.internal_product(S[2,2], S[1,2]) 0
>>> from sage.all import * >>> N = NonCommutativeSymmetricFunctions(QQ) >>> S = N.complete() >>> S.internal_product Generic endomorphism of Non-Commutative Symmetric Functions over the Rational Field in the Complete basis >>> S.internal_product(S[Integer(2),Integer(2)], S[Integer(1),Integer(2),Integer(1)]) 2*S[1, 1, 1, 1] + S[1, 1, 2] + S[2, 1, 1] >>> S.internal_product(S[Integer(2),Integer(2)], S[Integer(1),Integer(2)]) 0
sage: N = NonCommutativeSymmetricFunctions(QQ) sage: R = N.ribbon() sage: R.internal_product <bound method ....internal_product_by_coercion ...> sage: R.internal_product_by_coercion(R[1, 1], R[1,1]) R[2] sage: R.internal_product(R[2,2], R[1,2]) 0
>>> from sage.all import * >>> N = NonCommutativeSymmetricFunctions(QQ) >>> R = N.ribbon() >>> R.internal_product <bound method ....internal_product_by_coercion ...> >>> R.internal_product_by_coercion(R[Integer(1), Integer(1)], R[Integer(1),Integer(1)]) R[2] >>> R.internal_product(R[Integer(2),Integer(2)], R[Integer(1),Integer(2)]) 0
- internal_product_on_basis(I, J)[source]#
The internal product of the two basis elements indexed by
I
andJ
(optional)INPUT:
I
,J
– compositions indexing two elements of the basis of self
Returns the internal product of the corresponding basis elements. If this method is implemented, the internal product is defined from it by linearity.
EXAMPLES:
sage: N = NonCommutativeSymmetricFunctions(QQ) sage: S = N.complete() sage: S.internal_product_on_basis([2,2], [1,2,1]) 2*S[1, 1, 1, 1] + S[1, 1, 2] + S[2, 1, 1] sage: S.internal_product_on_basis([2,2], [2,1]) 0
>>> from sage.all import * >>> N = NonCommutativeSymmetricFunctions(QQ) >>> S = N.complete() >>> S.internal_product_on_basis([Integer(2),Integer(2)], [Integer(1),Integer(2),Integer(1)]) 2*S[1, 1, 1, 1] + S[1, 1, 2] + S[2, 1, 1] >>> S.internal_product_on_basis([Integer(2),Integer(2)], [Integer(2),Integer(1)]) 0
- itensor()[source]#
The bilinear product inherited from the isomorphism with the descent algebra.
This is constructed by extending the method
internal_product_on_basis()
bilinearly, if available, or using the methodinternal_product_by_coercion()
.OUTPUT:
The internal product map of the algebra the non-commutative symmetric functions.
EXAMPLES:
sage: N = NonCommutativeSymmetricFunctions(QQ) sage: S = N.complete() sage: S.internal_product Generic endomorphism of Non-Commutative Symmetric Functions over the Rational Field in the Complete basis sage: S.internal_product(S[2,2], S[1,2,1]) 2*S[1, 1, 1, 1] + S[1, 1, 2] + S[2, 1, 1] sage: S.internal_product(S[2,2], S[1,2]) 0
>>> from sage.all import * >>> N = NonCommutativeSymmetricFunctions(QQ) >>> S = N.complete() >>> S.internal_product Generic endomorphism of Non-Commutative Symmetric Functions over the Rational Field in the Complete basis >>> S.internal_product(S[Integer(2),Integer(2)], S[Integer(1),Integer(2),Integer(1)]) 2*S[1, 1, 1, 1] + S[1, 1, 2] + S[2, 1, 1] >>> S.internal_product(S[Integer(2),Integer(2)], S[Integer(1),Integer(2)]) 0
sage: N = NonCommutativeSymmetricFunctions(QQ) sage: R = N.ribbon() sage: R.internal_product <bound method ....internal_product_by_coercion ...> sage: R.internal_product_by_coercion(R[1, 1], R[1,1]) R[2] sage: R.internal_product(R[2,2], R[1,2]) 0
>>> from sage.all import * >>> N = NonCommutativeSymmetricFunctions(QQ) >>> R = N.ribbon() >>> R.internal_product <bound method ....internal_product_by_coercion ...> >>> R.internal_product_by_coercion(R[Integer(1), Integer(1)], R[Integer(1),Integer(1)]) R[2] >>> R.internal_product(R[Integer(2),Integer(2)], R[Integer(1),Integer(2)]) 0
- kronecker_product()[source]#
The bilinear product inherited from the isomorphism with the descent algebra.
This is constructed by extending the method
internal_product_on_basis()
bilinearly, if available, or using the methodinternal_product_by_coercion()
.OUTPUT:
The internal product map of the algebra the non-commutative symmetric functions.
EXAMPLES:
sage: N = NonCommutativeSymmetricFunctions(QQ) sage: S = N.complete() sage: S.internal_product Generic endomorphism of Non-Commutative Symmetric Functions over the Rational Field in the Complete basis sage: S.internal_product(S[2,2], S[1,2,1]) 2*S[1, 1, 1, 1] + S[1, 1, 2] + S[2, 1, 1] sage: S.internal_product(S[2,2], S[1,2]) 0
>>> from sage.all import * >>> N = NonCommutativeSymmetricFunctions(QQ) >>> S = N.complete() >>> S.internal_product Generic endomorphism of Non-Commutative Symmetric Functions over the Rational Field in the Complete basis >>> S.internal_product(S[Integer(2),Integer(2)], S[Integer(1),Integer(2),Integer(1)]) 2*S[1, 1, 1, 1] + S[1, 1, 2] + S[2, 1, 1] >>> S.internal_product(S[Integer(2),Integer(2)], S[Integer(1),Integer(2)]) 0
sage: N = NonCommutativeSymmetricFunctions(QQ) sage: R = N.ribbon() sage: R.internal_product <bound method ....internal_product_by_coercion ...> sage: R.internal_product_by_coercion(R[1, 1], R[1,1]) R[2] sage: R.internal_product(R[2,2], R[1,2]) 0
>>> from sage.all import * >>> N = NonCommutativeSymmetricFunctions(QQ) >>> R = N.ribbon() >>> R.internal_product <bound method ....internal_product_by_coercion ...> >>> R.internal_product_by_coercion(R[Integer(1), Integer(1)], R[Integer(1),Integer(1)]) R[2] >>> R.internal_product(R[Integer(2),Integer(2)], R[Integer(1),Integer(2)]) 0
- class Realizations(category, *args)[source]#
Bases:
RealizationsCategory
- class ParentMethods[source]#
Bases:
object
- internal_product_by_coercion(left, right)[source]#
Internal product of
left
andright
.This is a default implementation that computes the internal product in the realization specified by
self.realization_of().a_realization()
.INPUT:
left
– an element of the non-commutative symmetric functionsright
– an element of the non-commutative symmetric functions
OUTPUT:
The internal product of
left
andright
.
EXAMPLES:
sage: S = NonCommutativeSymmetricFunctions(QQ).S() sage: S.internal_product_by_coercion(S[2,1], S[3]) S[2, 1] sage: S.internal_product_by_coercion(S[2,1], S[4]) 0
>>> from sage.all import * >>> S = NonCommutativeSymmetricFunctions(QQ).S() >>> S.internal_product_by_coercion(S[Integer(2),Integer(1)], S[Integer(3)]) S[2, 1] >>> S.internal_product_by_coercion(S[Integer(2),Integer(1)], S[Integer(4)]) 0
- super_categories()[source]#
EXAMPLES:
sage: from sage.combinat.ncsf_qsym.generic_basis_code import GradedModulesWithInternalProduct sage: GradedModulesWithInternalProduct(ZZ).super_categories() [Category of graded modules over Integer Ring]
>>> from sage.all import * >>> from sage.combinat.ncsf_qsym.generic_basis_code import GradedModulesWithInternalProduct >>> GradedModulesWithInternalProduct(ZZ).super_categories() [Category of graded modules over Integer Ring]