# Ticket #13399: trac_13399-sf-as.3.patch

File trac_13399-sf-as.3.patch, 38.2 KB (added by Jeroen Demeyer, 10 years ago)

same patch with minor doc changes

• ## sage/combinat/sf/jack.py

# HG changeset patch
# User Anne Schilling <anne@math.ucdavis.edu>
# Date 1345872756 25200
# Node ID 2ef52b39a638c141bcdec41f7182d6f1aed69895
# Parent  0452690e4d618e75f2eaa859e09056bc59cd28fc
#13399: Some fixes in symmetric functions.

This patch implements the following fixes to symmetric functions:
- HL creation operator for k-Schur functions
- it fixes omega for k-Schur functions for generic t
- it changes the multiplication for k-Schur functions for generic t, so that
the result stays in the k-bounded subspace if possible and lifts to symmetric functions otherwise
- it moves coproduct_by_coercion to SymmetricFunctionAlgebra_generic and
inserts a coproduct function in KBoundedSubspaceBases, ElementMethods
- it fixes the coersion between the Jack P and Pq basis; this was previously extremely slow,
for example for
{{{
sage: Sym = SymmetricFunctions(FractionField(QQ['t']))
sage: Qp = Sym.jack().Qp()
sage: P = Sym.jack().P()
sage: P(Qp[2,1])
((-192*t^3+192*t^2-192*t+192)/(-64*t^3-224*t^2-224*t-64))*JackP[1, 1, 1]
+ ((128*t^2-64*t+80)/(64*t^2+64*t+16))*JackP[2, 1] + ((8*t-8)/(8*t+4))*JackP[3]
}}}
- it fixes the coproduct for Jack symmetric functions

diff --git a/sage/combinat/sf/jack.py b/sage/combinat/sf/jack.py
 a - Sym -- a ring of symmetric functions - t -- an optional parameter (default : 't') EXAMPLES :: EXAMPLES:: sage: SymmetricFunctions(FractionField(QQ['t'])).jack() Jack polynomials over Fraction Field of Univariate Polynomial Ring in t over Rational Field - returns the name of the family of bases EXAMPLES :: EXAMPLES:: sage: SymmetricFunctions(QQ).jack(1) Jack polynomials with t=1 over Rational Field - the base ring of the symmetric functions ring of self EXAMPLES :: EXAMPLES:: sage: J2 = SymmetricFunctions(QQ).jack(t=2) sage: J2.base_ring() - the symmetric functions ring of self EXAMPLES :: EXAMPLES:: sage: Jacks = SymmetricFunctions(FractionField(QQ['t'])).jack() sage: Jacks.symmetric_function_ring() - the P basis of the Jack symmetric functions EXAMPLES :: EXAMPLES:: sage: Sym = SymmetricFunctions(FractionField(QQ['t'])) sage: JP = Sym.jack().P(); JP - the Q basis of the Jack symmetric functions EXAMPLES :: EXAMPLES:: sage: Sym = SymmetricFunctions(FractionField(QQ['t'])) sage: JQ = Sym.jack().Q(); JQ OUTPUT: the J basis of the Jack symmetric functions EXAMPLES :: EXAMPLES:: sage: Sym = SymmetricFunctions(FractionField(QQ['t'])) sage: JJ = Sym.jack().J(); JJ - the Q' basis of the Jack symmetric functions EXAMPLES :: EXAMPLES:: sage: Sym = SymmetricFunctions(FractionField(QQ['t'])) sage: JP = Sym.jack().P() sage: a.scalar(JP([1,1])) 0 sage: JP(JQp([2]))                        # todo: missing auto normalization ((2*t-2)/(2*t+2))*JackP[1, 1] + JackP[2] ((-t+1)/(-t-1))*JackP[1, 1] + JackP[2] sage: JP._normalize(JP(JQp([2]))) ((t-1)/(t+1))*JackP[1, 1] + JackP[2] ((-t+1)/(-t-1))*JackP[1, 1] + JackP[2] """ return self.P().dual_basis(prefix="JackQp", basis_name = "Jack Qp"+ self._name_suffix) return JackPolynomials_qp(self) ############################# # to be deprecated 0 sage: s = P.realization_of().s() sage: P(Qp([2]))                        # todo: missing auto normalization ((2*t-2)/(2*t+2))*JackP[1, 1] + JackP[2] ((-t+1)/(-t-1))*JackP[1, 1] + JackP[2] sage: P._normalize(P(Qp([2]))) ((t-1)/(t+1))*JackP[1, 1] + JackP[2] ((-t+1)/(-t-1))*JackP[1, 1] + JackP[2] """ (R, t) = NoneConvention(R, t) sage.misc.superseded.deprecation(5457, "Deprecation warning: In the future use SymmetricFunctions(R).jack(t=%s).Qp()"%(t)) - a polynomial in the parameter t which is equal to the scalar product of J(part) and P(part) EXAMPLES :: EXAMPLES:: sage: from sage.combinat.sf.jack import c1 sage: t = QQ['t'].gen() - a polynomial in the parameter t which is equal to the scalar product of J(part) and Q(part) EXAMPLES :: EXAMPLES:: sage: from sage.combinat.sf.jack import c2 sage: t = QQ['t'].gen() return prod([t+t*part.arm_lengths(flat=True)[i]+part.leg_lengths(flat=True)[i] for i in range(sum(part))], t.parent().one()) def normalize_coefficients(self, c): r""" If our coefficient ring is the field of fractions over a univariate polynomial ring over the rationals, then we should clear both the numerator and denominator of the denominators of their coefficients. INPUT: - self -- a Jack basis of the symmetric functions - c -- a coefficient in the base ring of self OUTPUT: - divide numerator and denominator by the greatest common divisor EXAMPLES:: sage: JP = SymmetricFunctions(FractionField(QQ['t'])).jack().P() sage: t = JP.base_ring().gen() sage: a = 2/(1/2*t+1/2) sage: JP._normalize_coefficients(a) 4/(t + 1) sage: a = 1/(1/3+1/6*t) sage: JP._normalize_coefficients(a) 6/(t + 2) sage: a = 24/(4*t^2 + 12*t + 8) sage: JP._normalize_coefficients(a) 6/(t^2 + 3*t + 2) """ BR = self.base_ring() if is_FractionField(BR) and BR.base_ring() == QQ: denom = c.denominator() numer = c.numerator() #Clear the denominators a = lcm([i.denominator() for i in denom.coeffs()]) b = lcm([i.denominator() for i in numer.coeffs()]) l = Integer(a).lcm(Integer(b)) denom *= l numer *= l #Divide through by the gcd of the numerators a = gcd([i.numerator() for i in denom.coeffs()]) b = gcd([i.numerator() for i in numer.coeffs()]) l = Integer(a).gcd(Integer(b)) denom = denom / l numer = numer / l return c.parent()(numer, denom) else: return c #################################################################### class JackPolynomials_generic(sfa.SymmetricFunctionAlgebra_generic): self._m = self._sym.monomial() self   .register_coercion(SetMorphism(Hom(self._m, self, category), self._m_to_self)) self._m.register_coercion(SetMorphism(Hom(self, self._m, category), self._self_to_m)) if hasattr(self, "_h_cache"): # temporary until Hom(GradedHopfAlgebrasWithBasis work better) category = sage.categories.all.ModulesWithBasis(self._sym.base_ring()) self._h = self._sym.homogeneous() self   .register_coercion(SetMorphism(Hom(self._h, self, category), self._h_to_self)) self._h.register_coercion(SetMorphism(Hom(self, self._h, category), self._self_to_h)) def _m_to_self(self, x): r""" - a polynomial in the parameter t which is equal to the scalar product of J(part) and Q(part) EXAMPLES :: EXAMPLES:: sage: JP = SymmetricFunctions(FractionField(QQ['t'])).jack().P() sage: JP.c2(Partition([2,1])) """ return c2(part, self.t) def _normalize_coefficients(self, c): r""" If our coefficient ring is the field of fractions over a univariate polynomial ring over the rationals, then we should clear both the numerator and denominator of the denominators of their coefficients. INPUT: - self -- a Jack basis of the symmetric functions - c -- a coefficient in the base ring of self OUTPUT: - divide numerator and denominator by the greatest common divisor EXAMPLES :: sage: JP = SymmetricFunctions(FractionField(QQ['t'])).jack().P() sage: t = JP.base_ring().gen() sage: a = 2/(1/2*t+1/2) sage: JP._normalize_coefficients(a) 4/(t + 1) sage: a = 1/(1/3+1/6*t) sage: JP._normalize_coefficients(a) 6/(t + 2) sage: a = 24/(4*t^2 + 12*t + 8) sage: JP._normalize_coefficients(a) 6/(t^2 + 3*t + 2) """ BR = self.base_ring() if is_FractionField(BR) and BR.base_ring() == QQ: denom = c.denominator() numer = c.numerator() #Clear the denominators a = lcm([i.denominator() for i in denom.coeffs()]) b = lcm([i.denominator() for i in numer.coeffs()]) l = Integer(a).lcm(Integer(b)) denom *= l numer *= l #Divide through by the gcd of the numerators a = gcd([i.numerator() for i in denom.coeffs()]) b = gcd([i.numerator() for i in numer.coeffs()]) l = Integer(a).gcd(Integer(b)) denom = denom / l numer = numer / l return c.parent()(numer, denom) else: return c _normalize_coefficients = normalize_coefficients def _normalize(self, x): r""" - returns x with _normalize_coefficient applied to each of the coefficients EXAMPLES :: EXAMPLES:: sage: JP = SymmetricFunctions(FractionField(QQ['t'])).jack().P() sage: t = JP.base_ring().gen() - the normalized morphism EXAMPLES :: EXAMPLES:: sage: JP = SymmetricFunctions(FractionField(QQ['t'])).jack().P() sage: normal = JP._normalize_morphism(AlgebrasWithBasis(JP.base_ring())) - returns the product of left and right expanded in the basis self EXAMPLES :: EXAMPLES:: sage: JJ = SymmetricFunctions(FractionField(QQ['t'])).jack().J() sage: JJ([1])^2              # indirect doctest - the family of Jack symmetric functions associated to self EXAMPLES :: EXAMPLES:: sage: JackP = SymmetricFunctions(QQ).jack(t=2).P() sage: JackP.jack_family() """ return self._jack def coproduct_by_coercion(self, elt): r""" Returns the coproduct of the element elt by coercion to the Schur basis. INPUT: - self -- a Jack symmetric function basis - elt -- an instance of this basis OUTPUT: - The coproduct acting on elt, the result is an element of the tensor squared of the Jack symmetric function basis EXAMPLES:: sage: Sym = SymmetricFunctions(QQ['t'].fraction_field()) sage: Sym.jack().P()[2,2].coproduct() #indirect doctest JackP[] # JackP[2, 2] + (2/(t+1))*JackP[1] # JackP[2, 1] + ((-8*t-4)/(-t^3-4*t^2-5*t-2))*JackP[1, 1] # JackP[1, 1] + JackP[2] # JackP[2] + (2/(t+1))*JackP[2, 1] # JackP[1] + JackP[2, 2] # JackP[] """ from sage.categories.tensor import tensor s = self.realization_of().schur() g = self.tensor_square().sum(coeff*tensor([self(s[x]), self(s[y])]) for ((x,y), coeff) in s(elt).coproduct()) normalize = self._normalize_coefficients return self.tensor_square().sum(normalize(coeff)*tensor([self(x), self(y)]) for ((x,y), coeff) in g) class Element(sfa.SymmetricFunctionAlgebra_generic.Element): pass def scalar_jack(self, x, t=None): r""" A scalar product where the power sums are orthogonal and - returns the Jack scalar product between x and self EXAMPLES :: EXAMPLES:: sage: Sym = SymmetricFunctions(FractionField(QQ['t'])) sage: JP = Sym.jack().P() - returns the scalar product between the power sum indexed by part1 and part2 EXAMPLES :: EXAMPLES:: sage: Q. = QQ[] sage: from sage.combinat.sf.jack import part_scalar_jack - self -- an instance of the Jack P basis of the symmetric functions - jack -- a family of Jack symmetric function bases EXAMPLES :: EXAMPLES:: sage: P = SymmetricFunctions(FractionField(QQ['t'])).jack().P() sage: TestSuite(P).run(skip=['_test_associativity', '_test_distributivity', '_test_prod']) # products are too expensive - self -- an instance of the Jack P basis of the symmetric functions - n -- a positive integer indicating the degree EXAMPLES :: EXAMPLES:: sage: JP = SymmetricFunctions(FractionField(QQ['t'])).jack().P() sage: l = lambda c: [ (i[0],[j for j in sorted(i[1].items())]) for i in sorted(c.items())] - returns a function that accepts a partition and returns the coefficients of the expansion of the element of P(part) in the monomial basis EXAMPLES :: EXAMPLES:: sage: JP = SymmetricFunctions(FractionField(QQ['t'])).jack().P() sage: JP._m_cache(3) - returns the product of left and right expanded in the basis self EXAMPLES :: EXAMPLES:: sage: JP = SymmetricFunctions(FractionField(QQ['t'])).jack().P() sage: m = JP.symmetric_function_ring().m() The Clarendon Press, Oxford University Press, New York, 1995, With contributions by A. Zelevinsky, Oxford Science Publications. EXAMPLES :: EXAMPLES:: sage: JP = SymmetricFunctions(FractionField(QQ['t'])).jack().P() sage: JJ = SymmetricFunctions(FractionField(QQ['t'])).jack().J() def __init__(self, jack): r""" The J basis is a defined as a normalized form of the P basis The J basis is a defined as a normalized form of the P basis INPUT: - self -- an instance of the Jack P basis of the symmetric functions - jack -- a family of Jack symmetric function bases EXAMPLES :: EXAMPLES:: sage: J = SymmetricFunctions(FractionField(QQ['t'])).jack().J() sage: TestSuite(J).run(skip=['_test_associativity', '_test_distributivity', '_test_prod']) # products are too expensive def __init__(self, jack): r""" The Q basis is defined as a normalized form of the P basis The Q basis is defined as a normalized form of the P basis INPUT: - self -- an instance of the Jack P basis of the symmetric functions - self -- an instance of the Jack Q basis of the symmetric functions - jack -- a family of Jack symmetric function bases EXAMPLES :: EXAMPLES:: sage: Q = SymmetricFunctions(FractionField(QQ['t'])).jack().J() sage: Q = SymmetricFunctions(FractionField(QQ['t'])).jack().Q() sage: TestSuite(Q).run(skip=['_test_associativity', '_test_distributivity', '_test_prod']) # products are too expensive sage: TestSuite(Q).run(elements = [Q.t*Q[1,1]+Q[2], Q[1]+(1+Q.t)*Q[1,1]])  # long time (3s on sage.math, 2012) """ class Element(JackPolynomials_generic.Element): pass qp_to_h_cache = {} h_to_qp_cache = {} class JackPolynomials_qp(JackPolynomials_generic): def __init__(self, jack): r""" The Qp basis is the dual basis to the P basis with respect to the standard scalar product INPUT: - self -- an instance of the Jack Qp basis of the symmetric functions - jack -- a family of Jack symmetric function bases EXAMPLES:: sage: Qp = SymmetricFunctions(FractionField(QQ['t'])).jack().Qp() sage: TestSuite(Qp).run(skip=['_test_associativity', '_test_distributivity', '_test_prod']) # products are too expensive sage: TestSuite(Qp).run(elements = [Qp.t*Qp[1,1]+Qp[2], Qp[1]+(1+Qp.t)*Qp[1,1]])  # long time (3s on sage.math, 2012) """ self._name = "Jack polynomials in the Qp basis" self._prefix = "JackQp" JackPolynomials_generic.__init__(self, jack) self._P = self._jack.P() self._self_to_h_cache = qp_to_h_cache self._h_to_self_cache = h_to_qp_cache def _multiply(self, left, right): r""" The product of two Jack symmetric functions is done by multiplying the elements in the monomial basis and then expressing the elements the basis self. INPUT: - self -- an instance of the Jack Qp basis of the symmetric functions - left, right -- symmetric function elements OUTPUT: - returns the product of left and right expanded in the basis self EXAMPLES:: sage: JQp = SymmetricFunctions(FractionField(QQ['t'])).jack().Qp() sage: h = JQp.symmetric_function_ring().h() sage: JQp([1])^2 # indirect doctest JackQp[1, 1] + (-2/(-t-1))*JackQp[2] sage: h(_) h[1, 1] sage: JQp = SymmetricFunctions(QQ).jack(t=2).Qp() sage: h = SymmetricFunctions(QQ).h() sage: JQp([2,1])^2 JackQp[2, 2, 1, 1] + 2/3*JackQp[2, 2, 2] + 2/3*JackQp[3, 1, 1, 1] + 48/35*JackQp[3, 2, 1] + 28/75*JackQp[3, 3] + 128/225*JackQp[4, 1, 1] + 28/75*JackQp[4, 2] sage: h(_) h[2, 2, 1, 1] - 6/5*h[3, 2, 1] + 9/25*h[3, 3] """ return self( self._h(left)*self._h(right) ) def _h_cache(self, n): r""" Computes the change of basis between the Jack polynomials in the Qp basis and the homogeneous symmetric functions. This uses the coefficients in the change of basis between the Jack P basis and the monomial basis. INPUT: - self -- an instance of the Jack Qp basis of the symmetric functions - n -- a positive integer indicating the degree EXAMPLES:: sage: JQp = SymmetricFunctions(FractionField(QQ['t'])).jack().Qp() sage: l = lambda c: [ (i[0],[j for j in sorted(i[1].items())]) for i in sorted(c.items())] sage: JQp._h_cache(2) sage: l(JQp._self_to_h_cache[2]) [([1, 1], [([1, 1], 1), ([2], 2/(-t - 1))]), ([2], [([2], 1)])] sage: l(JQp._h_to_self_cache[2]) [([1, 1], [([1, 1], 1), ([2], -2/(-t - 1))]), ([2], [([2], 1)])] sage: JQp._h_cache(3) sage: l(JQp._h_to_self_cache[3]) [([1, 1, 1], [([1, 1, 1], 1), ([2, 1], 6/(t + 2)), ([3], -6/(-2*t^2 - 3*t - 1))]), ([2, 1], [([2, 1], 1), ([3], 3/(2*t + 1))]), ([3], [([3], 1)])] sage: l(JQp._self_to_h_cache[3]) [([1, 1, 1], [([1, 1, 1], 1), ([2, 1], -6/(t + 2)), ([3], -6/(-t^2 - 3*t - 2))]), ([2, 1], [([2, 1], 1), ([3], -3/(2*t + 1))]), ([3], [([3], 1)])] """ if n in self._self_to_h_cache: return else: self._self_to_h_cache[n] = {} self._h_to_self_cache[n] = {} self._P._m_cache(n) from_cache_1 = self._P._self_to_m_cache[n] to_cache_1 = self._self_to_h_cache[n] from_cache_2 = self._P._m_to_self_cache[n] to_cache_2 = self._h_to_self_cache[n] for mu in from_cache_1.keys(): for la in from_cache_1[mu].keys(): if not la in to_cache_1: to_cache_1[la] = {} to_cache_2[la] = {} to_cache_2[la][mu] = from_cache_1[mu][la] to_cache_1[la][mu] = from_cache_2[mu][la] def _self_to_h( self, x ): r""" Isomorphism from self to the homogeneous basis INPUT: - self -- a Jack Qp basis of the symmetric functions - x -- an element of the Jack Qp basis OUTPUT: - an element of the homogeneous basis equivalent to x EXAMPLES :: sage: Sym = SymmetricFunctions(QQ) sage: JQp = Sym.jack(t=2).Qp() sage: h = Sym.homogeneous() sage: JQp._self_to_h(JQp[2,1]) h[2, 1] - 3/5*h[3] This is for internal use only. Please use instead:: sage: h(JQp[2,1]) h[2, 1] - 3/5*h[3] """ return self._h._from_cache(x, self._h_cache, self._self_to_h_cache, t = self.t) def _h_to_self( self, x ): r""" Isomorphism from the homogeneous basis into self INPUT: - self -- a Jack Qp basis of the symmetric functions - x -- element of the homogeneous basis OUTPUT: - an element of the Jack Qp basis equivalent to x EXAMPLES :: sage: Sym = SymmetricFunctions(QQ) sage: JQp = Sym.jack(t=2).Qp() sage: h = Sym.homogeneous() sage: JQp._h_to_self(h[2,1]) JackQp[2, 1] + 3/5*JackQp[3] This is for internal use only. Please use instead:: sage: JQp(h[2,1]) JackQp[2, 1] + 3/5*JackQp[3] """ return self._from_cache(x, self._h_cache, self._h_to_self_cache, t = self.t) def coproduct_by_coercion( self, elt ): r""" Returns the coproduct of the element elt by coercion to the Schur basis. INPUT: - elt -- an instance of the Qp basis OUTPUT: - The coproduct acting on elt, the result is an element of the tensor squared of the Qp symmetric function basis EXAMPLES:: sage: Sym = SymmetricFunctions(QQ['t'].fraction_field()) sage: JQp = Sym.jack().Qp() sage: JQp[2,2].coproduct()   #indirect doctest JackQp[] # JackQp[2, 2] + (2*t/(t+1))*JackQp[1] # JackQp[2, 1] + JackQp[1, 1] # JackQp[1, 1] + ((-4*t^3-8*t^2)/(-2*t^3-5*t^2-4*t-1))*JackQp[2] # JackQp[2] + (2*t/(t+1))*JackQp[2, 1] # JackQp[1] + JackQp[2, 2] # JackQp[] """ h = elt.parent().realization_of().h() parent = elt.parent() from sage.categories.tensor import tensor cfunc = lambda x, y: tensor([parent(x), parent(y)]) cprod = h(elt).coproduct().apply_multilinear_morphism( cfunc ) normalize = lambda c: normalize_coefficients( parent, c ) return cprod.parent().sum(normalize(coeff)*tensor([parent(x), parent(y)]) for ((x,y), coeff) in cprod) class Element(JackPolynomials_generic.Element): pass #Zonal polynomials ( =P(at t=2) ) class SymmetricFunctionAlgebra_zonal(sfa.SymmetricFunctionAlgebra_generic): def __init__(self, Sym): # Backward compatibility for unpickling from sage.structure.sage_object import register_unpickle_override register_unpickle_override('sage.combinat.sf.jack', 'JackPolynomial_qp', JackPolynomials_qp.Element) register_unpickle_override('sage.combinat.sf.jack', 'JackPolynomial_j', JackPolynomials_j.Element) register_unpickle_override('sage.combinat.sf.jack', 'JackPolynomial_p', JackPolynomials_p.Element) register_unpickle_override('sage.combinat.sf.jack', 'JackPolynomial_q', JackPolynomials_q.Element)
• ## sage/combinat/sf/monomial.py

diff --git a/sage/combinat/sf/monomial.py b/sage/combinat/sf/monomial.py
 a return self.sum_of_terms((Partition(exp=monomial), coeff) for (monomial, coeff) in p.dict().iteritems()) def coproduct_by_coercion(self, elt): r""" Returns the coproduct of the element elt by coercion to the Schur basis. INPUT: - self -- a monomial symmetric function basis - elt -- an instance of monomial basis OUTPUT: - The coproduct acting on elt, the result is an element of the tensor squared of the monomial symmetric function basis EXAMPLES:: sage: m = SymmetricFunctions(QQ).m() sage: m[3,1,1].coproduct() m[] # m[3, 1, 1] + m[1] # m[3, 1] + m[1, 1] # m[3] + m[3] # m[1, 1] + m[3, 1] # m[1] + m[3, 1, 1] # m[] sage: m.coproduct_by_coercion(m[2,1]) m[] # m[2, 1] + m[1] # m[2] + m[2] # m[1] + m[2, 1] # m[] sage: m.coproduct_by_coercion(m[2,1]) == m([2,1]).coproduct() True """ from sage.categories.tensor import tensor s = self.realization_of().schur() return self.tensor_square().sum(coeff * tensor([self(s[x]), self(s[y])]) for ((x,y), coeff) in s(elt).coproduct()) class Element(classical.SymmetricFunctionAlgebra_classical.Element): def expand(self, n, alphabet='x'):
• ## sage/combinat/sf/new_kschur.py

diff --git a/sage/combinat/sf/new_kschur.py b/sage/combinat/sf/new_kschur.py
 a from sage.categories.graded_coalgebras_with_basis import GradedCoalgebrasWithBasis from sage.categories.magmas import Magmas from sage.categories.examples.infinite_enumerated_sets import NonNegativeIntegers from sage.categories.tensor import tensor from sage.combinat.partition import Partition, Partitions, Partition_class from sage.combinat.sf.sf import SymmetricFunctions from sage.categories.morphism import SetMorphism Method for multiplying two elements. When t=1, the k-bounded subspace is an algebra, so the product of two elements is always in the space. For generic t, the result is returned in the ring of symmetric functions since the k-bounded subspace is not closed under multiplication. is always in the space. For generic t, the k-bounded subspace is not closed under multiplication, so the result is returned in the k-bounded subspace if possible and else in the ring of symmetric functions. EXAMPLES:: ks3[3, 2, 1] + ks3[3, 3] sage: f.parent() 3-bounded Symmetric Functions over Rational Field with t=1 in the 3-Schur basis also with t=1 TESTS:: sage: Sym = SymmetricFunctions(FractionField(QQ['t'])) sage: ks2 = Sym.kschur(2) sage: ks3 = Sym.kschur(3) sage: ks5 = Sym.kschur(5) sage: ks5(ks3[2]) * ks5(ks2[2,1]) ks5[2, 2, 1] + ks5[3, 1, 1] + (t+1)*ks5[3, 2] + (t+1)*ks5[4, 1] + t*ks5[5] """ if self.parent().realization_of().t == 1: return self.parent()(self.lift()*other.lift()) return self.lift()*other.lift() result = self.lift()*other.lift() try: result = self.parent()(result) except ValueError: pass return result def hl_creation_operator(self, nu, t = None): r""" This is the vertex operator that generalizes Jing's operator. It is a linear operator that raises the degree by |\nu|. This creation operator is a t-analogue of multiplication by s(nu) . .. SEEALSO:: Proposition 5 in [SZ.2001]_. INPUT: -  nu -- a partition - t -- a parameter (default: None, in this case t is used) REFERENCES: .. [SZ.2001] M. Shimozono, M. Zabrocki, Hall-Littlewood vertex operators and generalized Kostka polynomials. Adv. Math. 158 (2001), no. 1, 66-85. EXAMPLES:: sage: Sym = SymmetricFunctions(FractionField(QQ['t'])) sage: ks = Sym.kschur(4) sage: s = Sym.schur() sage: s(ks([3,1,1]).hl_creation_operator([1])) (t-1)*s[2, 2, 1, 1] + t^2*s[3, 1, 1, 1] + (t^3+t^2-t)*s[3, 2, 1] + (t^3-t^2)*s[3, 3] + (t^4+t^3)*s[4, 1, 1] + t^4*s[4, 2] + t^5*s[5, 1] sage: ks([3,1,1]).hl_creation_operator([1]) (t-1)*ks4[2, 2, 1, 1] + t^2*ks4[3, 1, 1, 1] + t^3*ks4[3, 2, 1] + (t^3-t^2)*ks4[3, 3] + t^4*ks4[4, 1, 1] sage: Sym = SymmetricFunctions(QQ) sage: ks = Sym.kschur(4,t=1) sage: ks([3,1,1]).hl_creation_operator([1]) ks4[3, 1, 1, 1] + ks4[3, 2, 1] + ks4[4, 1, 1] """ if t is None: t = self.parent().realization_of().t return self.parent()(self.lift().hl_creation_operator(nu,t=t)) def coproduct(self): r""" Returns the coproduct operation on self. The coproduct is first computed on the homogeneous basis if t=1 and on the Hall-Littlewood Qp basis otherwise.  The result is computed then converted to the tensor squared of self.parent() EXAMPLES:: sage: Sym = SymmetricFunctions(QQ) sage: ks3 = Sym.kschur(3,1) sage: ks3[2,1].coproduct() ks3[] # ks3[2, 1] + ks3[1] # ks3[1, 1] + ks3[1] # ks3[2] + ks3[1, 1] # ks3[1] + ks3[2] # ks3[1] + ks3[2, 1] # ks3[] sage: h3 = Sym.khomogeneous(3) sage: h3[2,1].coproduct() h3[] # h3[2, 1] + h3[1] # h3[1, 1] + h3[1] # h3[2] + h3[1, 1] # h3[1] + h3[2] # h3[1] + h3[2, 1] # h3[] sage: ks3t = SymmetricFunctions(FractionField(QQ['t'])).kschur(3) sage: ks3t[2,1].coproduct() ks3[] # ks3[2, 1] + ks3[1] # ks3[1, 1] + ks3[1] # ks3[2] + ks3[1, 1] # ks3[1] + ks3[2] # ks3[1] + ks3[2, 1] # ks3[] sage: ks3t[3,1].coproduct() ks3[] # ks3[3, 1] + ks3[1] # ks3[2, 1] + (t+1)*ks3[1] # ks3[3] + ks3[1, 1] # ks3[2] + ks3[2] # ks3[1, 1] + (t+1)*ks3[2] # ks3[2] + ks3[2, 1] # ks3[1] + (t+1)*ks3[3] # ks3[1] + ks3[3, 1] # ks3[] """ lifted = self.lift() target_basis = self.parent() ambient = self.parent().realization_of().ambient() t = self.parent().realization_of().t if t==1: source_basis = ambient.h() else: source_basis = ambient.hall_littlewood(t=t).Qp() cpfunc = lambda x,y: tensor([ target_basis(x), target_basis(y) ]) return source_basis(lifted).coproduct().apply_multilinear_morphism( cpfunc ) def omega(self): r""" Returns the \omega operator on self. \omega maps the k-Schur function s_\lambda to s_{\lambda^{(k)}}, where At t=1, \omega maps the k-Schur function s^{(k)}_\lambda to s^{(k)}_{\lambda^{(k)}}, where \lambda^{(k)} is the k-conjugate of the partition \lambda. .. SEEALSO:: :meth:~sage.combinat.partition.Partition_class.k_conjugate. For generic t, \omega sends s^{(k)}_\lambda[X;t] to t^d s^{(k)}_{\lambda^{(k)}}[X;1/t], where d is the size of the core of \lambda minus the size of \lambda. Most of the time, this result is not in the k-bounded subspace. .. SEEALSO:: :meth:omega_t_inverse. EXAMPLES:: sage: kh[3].omega() h3[1, 1, 1] - 2*h3[2, 1] + h3[3] sage: Sym = SymmetricFunctions(QQ['t']) sage: ks = Sym.kschur(4) sage: ks[2,2,1,1].omega() ks4[3, 2, 1] sage: Sym = SymmetricFunctions(FractionField(QQ['t'])) sage: ks = Sym.kschur(3) sage: ks[3,1,1].omega() Traceback (most recent call last): ... ValueError: t*s[2, 1, 1, 1] + s[3, 1, 1] is not in the image of Generic morphism: From: 3-bounded Symmetric Functions over Fraction Field of Univariate Polynomial Ring in t over Rational Field in the 3-Schur basis To:   Symmetric Functions over Fraction Field of Univariate Polynomial Ring in t over Rational Field in the Schur basis """ ks = kSchur(self.parent().realization_of()) f = ks(self) return self.parent()(f.map_support( lambda p: p.k_conjugate(self.parent().k) )) return self.parent()(self.lift().omega()) def omega_t_inverse(self): r""" Returns the map t\to 1/t composed with \omega on self. Unlike the map :meth:omega, the result of :meth:omega_t_inverse lives in the k-bounded subspace and hence will return an element even for generic t. For t=1, :meth:omega and :meth:omega_t_inverse return the same result. EXAMPLES:: sage: Sym = SymmetricFunctions(FractionField(QQ['t'])) sage: ks = Sym.kschur(3) sage: ks[3,1,1].omega_t_inverse() 1/t*ks3[2, 1, 1, 1] sage: ks[3,2].omega_t_inverse() 1/t^2*ks3[1, 1, 1, 1, 1] """ s = self.parent().realization_of().ambient() t = s.base_ring().gen() invert = lambda x: s.base_ring()(x.subs(t=1/t)) return self.parent()(s(self).map_coefficients(invert).omega()) def is_schur_positive(self, *args, **kwargs): r"""
• ## sage/combinat/sf/sfa.py

diff --git a/sage/combinat/sf/sfa.py b/sage/combinat/sf/sfa.py
 a m = sage.combinat.sf.sf.SymmetricFunctions(self.base_ring()).m() return self(m.from_polynomial(poly, check=check)) def coproduct_by_coercion(self, elt): r""" Returns the coproduct of the element elt by coercion to the Schur basis. INPUT: - self -- a symmetric function basis - elt -- an instance of this basis OUTPUT: - The coproduct acting on elt, the result is an element of the tensor squared of the basis self EXAMPLES:: sage: m = SymmetricFunctions(QQ).m() sage: m[3,1,1].coproduct() m[] # m[3, 1, 1] + m[1] # m[3, 1] + m[1, 1] # m[3] + m[3] # m[1, 1] + m[3, 1] # m[1] + m[3, 1, 1] # m[] sage: m.coproduct_by_coercion(m[2,1]) m[] # m[2, 1] + m[1] # m[2] + m[2] # m[1] + m[2, 1] # m[] sage: m.coproduct_by_coercion(m[2,1]) == m([2,1]).coproduct() True sage: McdH = SymmetricFunctions(QQ['q','t'].fraction_field()).macdonald().H() sage: McdH[2,1].coproduct() McdH[] # McdH[2, 1] + ((q^2*t-1)/(q*t-1))*McdH[1] # McdH[1, 1] + ((q*t^2-1)/(q*t-1))*McdH[1] # McdH[2] + ((q^2*t-1)/(q*t-1))*McdH[1, 1] # McdH[1] + ((q*t^2-1)/(q*t-1))*McdH[2] # McdH[1] + McdH[2, 1] # McdH[] sage: HLQp = SymmetricFunctions(QQ['t'].fraction_field()).hall_littlewood().Qp() sage: HLQp[2,1].coproduct() HLQp[] # HLQp[2, 1] + HLQp[1] # HLQp[1, 1] + HLQp[1] # HLQp[2] + HLQp[1, 1] # HLQp[1] + HLQp[2] # HLQp[1] + HLQp[2, 1] # HLQp[] sage: Sym = SymmetricFunctions(FractionField(QQ['t'])) sage: LLT = Sym.llt(3) sage: LLT.cospin([3,2,1]).coproduct() (t+1)*m[] # m[1, 1] + m[] # m[2] + (t+1)*m[1] # m[1] + (t+1)*m[1, 1] # m[] + m[2] # m[] """ from sage.categories.tensor import tensor s = self.realization_of().schur() return self.tensor_square().sum(coeff * tensor([self(s[x]), self(s[y])]) for ((x,y), coeff) in s(elt).coproduct()) class SymmetricFunctionAlgebra_generic_Element(CombinatorialFreeModule.Element): r""" Class of generic elements for the symmetric function algebra. This is the vertex operator that generalizes Jing's operator. It is a linear operator that raises the degree by sum(nu). This creation operator is a t-analogue of multiplication by s(nu) |\nu|. This creation operator is a t-analogue of multiplication by s(nu) . .. SEEALSO:: Proposition 5 in [SZ2001]_. TESTS:: sage: Sym = SymmetricFunctions(FractionField(QQ['t'])) sage: ks = Sym.kschur(4) sage: ks([3,1,1]).lift().hl_creation_operator([1]) (t-1)*s[2, 2, 1, 1] + t^2*s[3, 1, 1, 1] + (t^3+t^2-t)*s[3, 2, 1] + (t^3-t^2)*s[3, 3] + (t^4+t^3)*s[4, 1, 1] + t^4*s[4, 2] + t^5*s[5, 1] sage: ks(ks([3,1,1]).lift().hl_creation_operator([1])) (t-1)*ks4[2, 2, 1, 1] + t^2*ks4[3, 1, 1, 1] + t^3*ks4[3, 2, 1] + (t^3-t^2)*ks4[3, 3] + t^4*ks4[4, 1, 1] sage: s(0).hl_creation_operator([1]) 0 """ for mu in Partitions(d+1, max_length=len(nu)) ) ) SymmetricFunctionAlgebra_generic.Element = SymmetricFunctionAlgebra_generic_Element