Macdonald polynomials - Combinatorics

Skip to content
Back to top
View this page
Edit this page

# Macdonald polynomials

Notation used in the definitions follows mainly [Mac1995].

The integral forms of the bases \(H\) and \(Ht\) do not appear in Macdonald’s book. They correspond to the two bases \(H_\mu[X;q,t] = \sum_{\nu} K_{\nu\mu}(q,t) s_\mu[X]\) and \({\tilde H}_\mu[X;q,t] = t^{n(\mu)} \sum_{\nu} K_{\nu\mu}(q,1/t) s_\nu[X]\) where \(K_{\mu\nu}(q,t)\) are the Macdonald \(q,t\)-Koskta coefficients.

The \(Ht\) in this case is short for \({\tilde H}\) and is the basis which is the graded Frobenius image of the Garsia-Haiman modules [GH1993].

REFERENCES:

- [Mac1995]

[GH1993]

A. Garsia, M. Haiman, A graded representation module for Macdonald’s polynomials, Proc. Nat. Acad. U.S.A. no. 90, 3607–3610.

[BGHT1999] (1,2)

F. Bergeron, A. M. Garsia, M. Haiman, and G. Tesler, Identities and positivity conjectures for some remarkable operators in the theory of symmetric functions, Methods Appl. Anal. 6 (1999), no. 3, 363–420.

[LLM1998] (1,2)

L. Lapointe, A. Lascoux, J. Morse, Determinantal Expressions for Macdonald Polynomials, IRMN no. 18 (1998). arXiv math/9808050.

[BH2013] (1,2)

F. Bergeron, M. Haiman, Tableaux Formulas for Macdonald Polynomials, Special edition in honor of Christophe Reutenauer 60 birthday, International Journal of Algebra and Computation, Volume 23, Issue 4, (2013), pp. 833-852.

class sage.combinat.sf.macdonald.Macdonald(Sym, q, t)

  Bases: `UniqueRepresentation`

  Macdonald Symmetric functions including \(P\), \(Q\), \(J\), \(H\), \(Ht\) bases also including the S basis which is the plethystic transformation of the Schur basis (that which is dual to the Schur basis with respect to the Macdonald \(q,t\)-scalar product)

  INPUT:

  - `self` – a family of Macdonald symmetric function bases

  EXAMPLES:

  Sage

      sage: t = QQ['t'].gen(); SymmetricFunctions(QQ['t'].fraction_field()).macdonald(q=t,t=1)
      Macdonald polynomials with q=t and t=1 over Fraction Field of Univariate Polynomial Ring in t over Rational Field
      sage: Sym = SymmetricFunctions(FractionField(QQ['t'])).macdonald()
      Traceback (most recent call last):
      ...
      TypeError: unable to evaluate 'q' in Fraction Field of Univariate Polynomial Ring in t over Rational Field

  Python

      >>> from sage.all import *
      >>> t = QQ['t'].gen(); SymmetricFunctions(QQ['t'].fraction_field()).macdonald(q=t,t=Integer(1))
      Macdonald polynomials with q=t and t=1 over Fraction Field of Univariate Polynomial Ring in t over Rational Field
      >>> Sym = SymmetricFunctions(FractionField(QQ['t'])).macdonald()
      Traceback (most recent call last):
      ...
      TypeError: unable to evaluate 'q' in Fraction Field of Univariate Polynomial Ring in t over Rational Field

  H()

    Return the Macdonald polynomials on the H basis. When the \(H\) basis is expanded on the Schur basis, the coefficients are the \(qt\)-Kostka numbers.

    INPUT:

    - `self` – a family of Macdonald symmetric function bases

    OUTPUT: the \(H\) Macdonald basis of symmetric functions

    EXAMPLES:

    Sage

        sage: Sym = SymmetricFunctions(FractionField(QQ['q','t']))
        sage: H = Sym.macdonald().H(); H
        Symmetric Functions over Fraction Field of Multivariate Polynomial Ring in q, t over Rational Field in the Macdonald H basis
        sage: s = Sym.schur()
        sage: s(H([2]))
        q*s[1, 1] + s[2]
        sage: s(H([1,1]))
        s[1, 1] + t*s[2]

    Python

        >>> from sage.all import *
        >>> Sym = SymmetricFunctions(FractionField(QQ['q','t']))
        >>> H = Sym.macdonald().H(); H
        Symmetric Functions over Fraction Field of Multivariate Polynomial Ring in q, t over Rational Field in the Macdonald H basis
        >>> s = Sym.schur()
        >>> s(H([Integer(2)]))
        q*s[1, 1] + s[2]
        >>> s(H([Integer(1),Integer(1)]))
        s[1, 1] + t*s[2]

    Coercions to/from the Schur basis are implemented:

    Sage

        sage: H = Sym.macdonald().H()
        sage: s = Sym.schur()
        sage: H(s([2]))
        (q/(q*t-1))*McdH[1, 1] - (1/(q*t-1))*McdH[2]

    [Python]

        >>> from sage.all import *
        >>> H = Sym.macdonald().H()
        >>> s = Sym.schur()
        >>> H(s([Integer(2)]))
        (q/(q*t-1))*McdH[1, 1] - (1/(q*t-1))*McdH[2]

  Ht()

    Return the Macdonald polynomials on the \(Ht\) basis. The elements of the \(Ht\) basis are eigenvectors of the \(nabla\) operator. When expanded on the Schur basis, the coefficients are the modified \(qt\)-Kostka numbers.

    INPUT:

    - `self` – a family of Macdonald symmetric function bases

    OUTPUT: the \(Ht\) Macdonald basis of symmetric functions

    EXAMPLES:

    Sage

        sage: Sym = SymmetricFunctions(FractionField(QQ['q','t']))
        sage: Ht = Sym.macdonald().Ht(); Ht
        Symmetric Functions over Fraction Field of Multivariate Polynomial Ring in q, t over Rational Field in the Macdonald Ht basis
        sage: [Ht(p).nabla() for p in Partitions(3)]
        [q^3*McdHt[3], q*t*McdHt[2, 1], t^3*McdHt[1, 1, 1]]

    Python

        >>> from sage.all import *
        >>> Sym = SymmetricFunctions(FractionField(QQ['q','t']))
        >>> Ht = Sym.macdonald().Ht(); Ht
        Symmetric Functions over Fraction Field of Multivariate Polynomial Ring in q, t over Rational Field in the Macdonald Ht basis
        >>> [Ht(p).nabla() for p in Partitions(Integer(3))]
        [q^3*McdHt[3], q*t*McdHt[2, 1], t^3*McdHt[1, 1, 1]]

    Sage

        sage: s = Sym.schur()
        sage: from sage.combinat.sf.macdonald import qt_kostka
        sage: q,t = Ht.base_ring().gens()
        sage: s(Ht([2,1]))
        q*t*s[1, 1, 1] + (q+t)*s[2, 1] + s[3]
        sage: qt_kostka([1,1,1],[2,1]).subs(t=1/t)*t^Partition([2,1]).weighted_size()
        q*t
        sage: qt_kostka([2,1],[2,1]).subs(t=1/t)*t^Partition([2,1]).weighted_size()
        q + t
        sage: qt_kostka([3],[2,1]).subs(t=1/t)*t^Partition([2,1]).weighted_size()
        1

    [Python]

        >>> from sage.all import *
        >>> s = Sym.schur()
        >>> from sage.combinat.sf.macdonald import qt_kostka
        >>> q,t = Ht.base_ring().gens()
        >>> s(Ht([Integer(2),Integer(1)]))
        q*t*s[1, 1, 1] + (q+t)*s[2, 1] + s[3]
        >>> qt_kostka([Integer(1),Integer(1),Integer(1)],[Integer(2),Integer(1)]).subs(t=Integer(1)/t)*t**Partition([Integer(2),Integer(1)]).weighted_size()
        q*t
        >>> qt_kostka([Integer(2),Integer(1)],[Integer(2),Integer(1)]).subs(t=Integer(1)/t)*t**Partition([Integer(2),Integer(1)]).weighted_size()
        q + t
        >>> qt_kostka([Integer(3)],[Integer(2),Integer(1)]).subs(t=Integer(1)/t)*t**Partition([Integer(2),Integer(1)]).weighted_size()
        1

    Coercions to/from the Schur basis are implemented:

    Sage

        sage: Ht = Sym.macdonald().Ht()
        sage: s = Sym.schur()
        sage: Ht(s([2,1]))
        (q/(q*t^2-t^3-q^2+q*t))*McdHt[1, 1, 1] - ((q^2+q*t+t^2)/(q^2*t^2-q^3-t^3+q*t))*McdHt[2, 1]
        + (t/(-q^3+q^2*t+q*t-t^2))*McdHt[3]
        sage: Ht(s([2]))
        -(q/(-q+t))*McdHt[1, 1] + (t/(-q+t))*McdHt[2]

    Python

        >>> from sage.all import *
        >>> Ht = Sym.macdonald().Ht()
        >>> s = Sym.schur()
        >>> Ht(s([Integer(2),Integer(1)]))
        (q/(q*t^2-t^3-q^2+q*t))*McdHt[1, 1, 1] - ((q^2+q*t+t^2)/(q^2*t^2-q^3-t^3+q*t))*McdHt[2, 1]
        + (t/(-q^3+q^2*t+q*t-t^2))*McdHt[3]
        >>> Ht(s([Integer(2)]))
        -(q/(-q+t))*McdHt[1, 1] + (t/(-q+t))*McdHt[2]

  J()

    Return the Macdonald polynomials on the \(J\) basis also known as the integral form of the Macdonald polynomials. These are scalar multiples of both the \(P\) and \(Q\) bases. When expressed in the \(P\) or \(Q\) basis, the scaling coefficients are polynomials in \(q\) and \(t\) rather than rational functions.

    The \(J\) basis is calculated using determinantal formulas of Lapointe-Lascoux-Morse giving the action on the S-basis [LLM1998].

    INPUT:

    - `self` – a family of Macdonald symmetric function bases

    OUTPUT: the \(J\) Macdonald basis of symmetric functions

    EXAMPLES:

    Sage

        sage: Sym = SymmetricFunctions(FractionField(QQ['q','t']))
        sage: J = Sym.macdonald().J(); J
        Symmetric Functions over Fraction Field of Multivariate Polynomial Ring in q, t over Rational Field in the Macdonald J basis
        sage: P = Sym.macdonald().P()
        sage: Q = Sym.macdonald().Q()
        sage: P(J([2]))
        (q*t^2-q*t-t+1)*McdP[2]
        sage: P(J([1,1]))
        (t^3-t^2-t+1)*McdP[1, 1]
        sage: Q(J([2]))
        (q^3-q^2-q+1)*McdQ[2]
        sage: Q(J([1,1]))
        (q^2*t-q*t-q+1)*McdQ[1, 1]

    Python

        >>> from sage.all import *
        >>> Sym = SymmetricFunctions(FractionField(QQ['q','t']))
        >>> J = Sym.macdonald().J(); J
        Symmetric Functions over Fraction Field of Multivariate Polynomial Ring in q, t over Rational Field in the Macdonald J basis
        >>> P = Sym.macdonald().P()
        >>> Q = Sym.macdonald().Q()
        >>> P(J([Integer(2)]))
        (q*t^2-q*t-t+1)*McdP[2]
        >>> P(J([Integer(1),Integer(1)]))
        (t^3-t^2-t+1)*McdP[1, 1]
        >>> Q(J([Integer(2)]))
        (q^3-q^2-q+1)*McdQ[2]
        >>> Q(J([Integer(1),Integer(1)]))
        (q^2*t-q*t-q+1)*McdQ[1, 1]

    Coercions from the \(Q\) and \(J\) basis (proportional) and to/from the Schur basis are implemented:

    Sage

        sage: P = Sym.macdonald().P()
        sage: Q = Sym.macdonald().Q()
        sage: J = Sym.macdonald().J()
        sage: s = Sym.schur()

    [Python]

        >>> from sage.all import *
        >>> P = Sym.macdonald().P()
        >>> Q = Sym.macdonald().Q()
        >>> J = Sym.macdonald().J()
        >>> s = Sym.schur()

    Sage

        sage: J(P([2]))
        (1/(q*t^2-q*t-t+1))*McdJ[2]

    Python

        >>> from sage.all import *
        >>> J(P([Integer(2)]))
        (1/(q*t^2-q*t-t+1))*McdJ[2]

    Sage

        sage: J(Q([2]))
        (1/(q^3-q^2-q+1))*McdJ[2]

    [Python]

        >>> from sage.all import *
        >>> J(Q([Integer(2)]))
        (1/(q^3-q^2-q+1))*McdJ[2]

    Sage

        sage: s(J([2]))
        -(q*t-t^2-q+t)*s[1, 1] + (q*t^2-q*t-t+1)*s[2]
        sage: J(s([2]))
        ((q-t)/(q*t^4-q*t^3-q*t^2-t^3+q*t+t^2+t-1))*McdJ[1, 1] + (1/(q*t^2-q*t-t+1))*McdJ[2]

    Python

        >>> from sage.all import *
        >>> s(J([Integer(2)]))
        -(q*t-t^2-q+t)*s[1, 1] + (q*t^2-q*t-t+1)*s[2]
        >>> J(s([Integer(2)]))
        ((q-t)/(q*t^4-q*t^3-q*t^2-t^3+q*t+t^2+t-1))*McdJ[1, 1] + (1/(q*t^2-q*t-t+1))*McdJ[2]

  P()

    Return Macdonald polynomials in \(P\) basis. The \(P\) basis is defined here as a normalized form of the \(J\) basis.

    INPUT:

    - `self` – a family of Macdonald symmetric function bases

    OUTPUT: the \(P\) Macdonald basis of symmetric functions

    EXAMPLES:

    Sage

        sage: Sym = SymmetricFunctions(FractionField(QQ['q','t']))
        sage: P = Sym.macdonald().P(); P
        Symmetric Functions over Fraction Field of Multivariate Polynomial Ring in q, t over Rational Field in the Macdonald P basis
        sage: P[2]
        McdP[2]

    Python

        >>> from sage.all import *
        >>> Sym = SymmetricFunctions(FractionField(QQ['q','t']))
        >>> P = Sym.macdonald().P(); P
        Symmetric Functions over Fraction Field of Multivariate Polynomial Ring in q, t over Rational Field in the Macdonald P basis
        >>> P[Integer(2)]
        McdP[2]

    The \(P\) Macdonald basis is upper triangularly related to the monomial symmetric functions and are orthogonal with respect to the \(qt\)-Hall scalar product:

    Sage

        sage: Sym = SymmetricFunctions(FractionField(QQ['q','t']))
        sage: P = Sym.macdonald().P(); P
        Symmetric Functions over Fraction Field of Multivariate Polynomial Ring in q, t over Rational Field in the Macdonald P basis
        sage: m = Sym.monomial()
        sage: P.transition_matrix(m,2)
        [                          1 (q*t - q + t - 1)/(q*t - 1)]
        [                          0                           1]
        sage: P([1,1]).scalar_qt(P([2]))
        0
        sage: P([2]).scalar_qt(P([2]))
        (-q^3 + q^2 + q - 1)/(-q*t^2 + q*t + t - 1)
        sage: P([1,1]).scalar_qt(P([1,1]))
        (-q^2*t + q*t + q - 1)/(-t^3 + t^2 + t - 1)

    [Python]

        >>> from sage.all import *
        >>> Sym = SymmetricFunctions(FractionField(QQ['q','t']))
        >>> P = Sym.macdonald().P(); P
        Symmetric Functions over Fraction Field of Multivariate Polynomial Ring in q, t over Rational Field in the Macdonald P basis
        >>> m = Sym.monomial()
        >>> P.transition_matrix(m,Integer(2))
        [                          1 (q*t - q + t - 1)/(q*t - 1)]
        [                          0                           1]
        >>> P([Integer(1),Integer(1)]).scalar_qt(P([Integer(2)]))
        0
        >>> P([Integer(2)]).scalar_qt(P([Integer(2)]))
        (-q^3 + q^2 + q - 1)/(-q*t^2 + q*t + t - 1)
        >>> P([Integer(1),Integer(1)]).scalar_qt(P([Integer(1),Integer(1)]))
        (-q^2*t + q*t + q - 1)/(-t^3 + t^2 + t - 1)

    When \(q = 0\), the Macdonald polynomials on the \(P\) basis are the same as the Hall-Littlewood polynomials on the \(P\) basis.

    Sage

        sage: Sym = SymmetricFunctions(FractionField(QQ['t']))
        sage: P = Sym.macdonald(q=0).P(); P
        Symmetric Functions over Fraction Field of Univariate Polynomial Ring in t over Rational Field in the Macdonald P with q=0 basis
        sage: P([2])^2
        (t+1)*McdP[2, 2] + (-t+1)*McdP[3, 1] + McdP[4]
        sage: HLP = Sym.hall_littlewood().P()
        sage: HLP([2])^2
        (t+1)*HLP[2, 2] + (-t+1)*HLP[3, 1] + HLP[4]

    Python

        >>> from sage.all import *
        >>> Sym = SymmetricFunctions(FractionField(QQ['t']))
        >>> P = Sym.macdonald(q=Integer(0)).P(); P
        Symmetric Functions over Fraction Field of Univariate Polynomial Ring in t over Rational Field in the Macdonald P with q=0 basis
        >>> P([Integer(2)])**Integer(2)
        (t+1)*McdP[2, 2] + (-t+1)*McdP[3, 1] + McdP[4]
        >>> HLP = Sym.hall_littlewood().P()
        >>> HLP([Integer(2)])**Integer(2)
        (t+1)*HLP[2, 2] + (-t+1)*HLP[3, 1] + HLP[4]

    Coercions from the \(Q\) and \(J\) basis (proportional) are implemented:

    Sage

        sage: Sym = SymmetricFunctions(FractionField(QQ['q','t']))
        sage: P = Sym.macdonald().P()
        sage: Q = Sym.macdonald().Q()
        sage: J = Sym.macdonald().J()
        sage: s = Sym.schur()

    [Python]

        >>> from sage.all import *
        >>> Sym = SymmetricFunctions(FractionField(QQ['q','t']))
        >>> P = Sym.macdonald().P()
        >>> Q = Sym.macdonald().Q()
        >>> J = Sym.macdonald().J()
        >>> s = Sym.schur()

    Sage

        sage: P(Q([2]))
        ((q*t^2-q*t-t+1)/(q^3-q^2-q+1))*McdP[2]
        sage: P(Q([2,1]))
        -((q*t^4-2*q*t^3+q*t^2-t^2+2*t-1)/(-q^4*t+2*q^3*t-q^2*t+q^2-2*q+1))*McdP[2, 1]

    Python

        >>> from sage.all import *
        >>> P(Q([Integer(2)]))
        ((q*t^2-q*t-t+1)/(q^3-q^2-q+1))*McdP[2]
        >>> P(Q([Integer(2),Integer(1)]))
        -((q*t^4-2*q*t^3+q*t^2-t^2+2*t-1)/(-q^4*t+2*q^3*t-q^2*t+q^2-2*q+1))*McdP[2, 1]

    Sage

        sage: P(J([2]))
        (q*t^2-q*t-t+1)*McdP[2]
        sage: P(J([2,1]))
        -(q*t^4-2*q*t^3+q*t^2-t^2+2*t-1)*McdP[2, 1]

    [Python]

        >>> from sage.all import *
        >>> P(J([Integer(2)]))
        (q*t^2-q*t-t+1)*McdP[2]
        >>> P(J([Integer(2),Integer(1)]))
        -(q*t^4-2*q*t^3+q*t^2-t^2+2*t-1)*McdP[2, 1]

    By transitivity, one get coercions from the classical bases:

    Sage

        sage: P(s([2]))
        ((q-t)/(q*t-1))*McdP[1, 1] + McdP[2]
        sage: P(s([2,1]))
        ((q*t-t^2+q-t)/(q*t^2-1))*McdP[1, 1, 1] + McdP[2, 1]

    Python

        >>> from sage.all import *
        >>> P(s([Integer(2)]))
        ((q-t)/(q*t-1))*McdP[1, 1] + McdP[2]
        >>> P(s([Integer(2),Integer(1)]))
        ((q*t-t^2+q-t)/(q*t^2-1))*McdP[1, 1, 1] + McdP[2, 1]

    Sage

        sage: Sym = SymmetricFunctions(QQ['x','y','z'].fraction_field())
        sage: (x,y,z) = Sym.base_ring().gens()
        sage: Macxy = Sym.macdonald(q=x,t=y)
        sage: Macyz = Sym.macdonald(q=y,t=z)
        sage: Maczx = Sym.macdonald(q=z,t=x)
        sage: P1 = Macxy.P()
        sage: P2 = Macyz.P()
        sage: P3 = Maczx.P()
        sage: m(P1[2,1])
        -((2*x*y^2-x*y+y^2-x+y-2)/(-x*y^2+1))*m[1, 1, 1] + m[2, 1]
        sage: m(P2[2,1])
        -((2*y*z^2-y*z+z^2-y+z-2)/(-y*z^2+1))*m[1, 1, 1] + m[2, 1]
        sage: m(P1(P2(P3[2,1])))
        -((2*x^2*z+x^2-x*z+x-z-2)/(-x^2*z+1))*m[1, 1, 1] + m[2, 1]
        sage: P1(P2[2])
        -((x*y^2-2*x*y*z+y^2*z+x-2*y+z)/(x*y^2*z-x*y-y*z+1))*McdP[1, 1] + McdP[2]
        sage: m(z*P1[2]+x*P2[2])
        ((x^2*y^2*z+x*y^2*z^2-x^2*y^2+x^2*y*z-x*y*z^2+y^2*z^2-x^2*y-2*x*y*z-y*z^2+x*y-y*z+x+z)/(x*y^2*z-x*y-y*z+1))*m[1, 1] + (x+z)*m[2]

    [Python]

        >>> from sage.all import *
        >>> Sym = SymmetricFunctions(QQ['x','y','z'].fraction_field())
        >>> (x,y,z) = Sym.base_ring().gens()
        >>> Macxy = Sym.macdonald(q=x,t=y)
        >>> Macyz = Sym.macdonald(q=y,t=z)
        >>> Maczx = Sym.macdonald(q=z,t=x)
        >>> P1 = Macxy.P()
        >>> P2 = Macyz.P()
        >>> P3 = Maczx.P()
        >>> m(P1[Integer(2),Integer(1)])
        -((2*x*y^2-x*y+y^2-x+y-2)/(-x*y^2+1))*m[1, 1, 1] + m[2, 1]
        >>> m(P2[Integer(2),Integer(1)])
        -((2*y*z^2-y*z+z^2-y+z-2)/(-y*z^2+1))*m[1, 1, 1] + m[2, 1]
        >>> m(P1(P2(P3[Integer(2),Integer(1)])))
        -((2*x^2*z+x^2-x*z+x-z-2)/(-x^2*z+1))*m[1, 1, 1] + m[2, 1]
        >>> P1(P2[Integer(2)])
        -((x*y^2-2*x*y*z+y^2*z+x-2*y+z)/(x*y^2*z-x*y-y*z+1))*McdP[1, 1] + McdP[2]
        >>> m(z*P1[Integer(2)]+x*P2[Integer(2)])
        ((x^2*y^2*z+x*y^2*z^2-x^2*y^2+x^2*y*z-x*y*z^2+y^2*z^2-x^2*y-2*x*y*z-y*z^2+x*y-y*z+x+z)/(x*y^2*z-x*y-y*z+1))*m[1, 1] + (x+z)*m[2]

  Q()

    Return the Macdonald polynomials on the \(Q\) basis. These are dual to the Macdonald polynomials on the P basis with respect to the \(qt\)-Hall scalar product. The \(Q\) basis is defined to be a normalized form of the \(J\) basis.

    INPUT:

    - `self` – a family of Macdonald symmetric function bases

    OUTPUT: the \(Q\) Macdonald basis of symmetric functions

    EXAMPLES:

    Sage

        sage: Sym = SymmetricFunctions(FractionField(QQ['q','t']))
        sage: Q = Sym.macdonald().Q(); Q
        Symmetric Functions over Fraction Field of Multivariate Polynomial Ring in q, t over Rational Field in the Macdonald Q basis
        sage: P = Sym.macdonald().P()
        sage: Q([2]).scalar_qt(P([2]))
        1
        sage: Q([2]).scalar_qt(P([1,1]))
        0
        sage: Q([1,1]).scalar_qt(P([2]))
        0
        sage: Q([1,1]).scalar_qt(P([1,1]))
        1
        sage: Q(P([2]))
        ((q^3-q^2-q+1)/(q*t^2-q*t-t+1))*McdQ[2]
        sage: Q(P([1,1]))
        ((q^2*t-q*t-q+1)/(t^3-t^2-t+1))*McdQ[1, 1]

    Python

        >>> from sage.all import *
        >>> Sym = SymmetricFunctions(FractionField(QQ['q','t']))
        >>> Q = Sym.macdonald().Q(); Q
        Symmetric Functions over Fraction Field of Multivariate Polynomial Ring in q, t over Rational Field in the Macdonald Q basis
        >>> P = Sym.macdonald().P()
        >>> Q([Integer(2)]).scalar_qt(P([Integer(2)]))
        1
        >>> Q([Integer(2)]).scalar_qt(P([Integer(1),Integer(1)]))
        0
        >>> Q([Integer(1),Integer(1)]).scalar_qt(P([Integer(2)]))
        0
        >>> Q([Integer(1),Integer(1)]).scalar_qt(P([Integer(1),Integer(1)]))
        1
        >>> Q(P([Integer(2)]))
        ((q^3-q^2-q+1)/(q*t^2-q*t-t+1))*McdQ[2]
        >>> Q(P([Integer(1),Integer(1)]))
        ((q^2*t-q*t-q+1)/(t^3-t^2-t+1))*McdQ[1, 1]

    Coercions from the \(P\) and \(J\) basis (proportional) are implemented:

    Sage

        sage: P = Sym.macdonald().P()
        sage: Q = Sym.macdonald().Q()
        sage: J = Sym.macdonald().J()
        sage: s = Sym.schur()

    [Python]

        >>> from sage.all import *
        >>> P = Sym.macdonald().P()
        >>> Q = Sym.macdonald().Q()
        >>> J = Sym.macdonald().J()
        >>> s = Sym.schur()

    Sage

        sage: Q(J([2]))
        (q^3-q^2-q+1)*McdQ[2]

    Python

        >>> from sage.all import *
        >>> Q(J([Integer(2)]))
        (q^3-q^2-q+1)*McdQ[2]

    Sage

        sage: Q(P([2]))
        ((q^3-q^2-q+1)/(q*t^2-q*t-t+1))*McdQ[2]
        sage: P(Q(P([2])))
        McdP[2]
        sage: Q(P(Q([2])))
        McdQ[2]

    [Python]

        >>> from sage.all import *
        >>> Q(P([Integer(2)]))
        ((q^3-q^2-q+1)/(q*t^2-q*t-t+1))*McdQ[2]
        >>> P(Q(P([Integer(2)])))
        McdP[2]
        >>> Q(P(Q([Integer(2)])))
        McdQ[2]

    By transitivity, one gets coercions from the classical bases:

    Sage

        sage: Q(s([2]))
        ((q^2-q*t-q+t)/(t^3-t^2-t+1))*McdQ[1, 1] + ((q^3-q^2-q+1)/(q*t^2-q*t-t+1))*McdQ[2]

    Python

        >>> from sage.all import *
        >>> Q(s([Integer(2)]))
        ((q^2-q*t-q+t)/(t^3-t^2-t+1))*McdQ[1, 1] + ((q^3-q^2-q+1)/(q*t^2-q*t-t+1))*McdQ[2]

  S()

    Return the modified Schur functions defined by the plethystic substitution \(S_{\mu} = s_{\mu}[X(1-t)/(1-q)]\). When the Macdonald polynomials in the J basis are expressed in terms of the modified Schur functions at \(q=0\), the coefficients are \(qt\)-Kostka numbers.

    INPUT:

    - `self` – a family of Macdonald symmetric function bases

    OUTPUT: the \(S\) Macdonald basis of symmetric functions

    EXAMPLES:

    Sage

        sage: Sym = SymmetricFunctions(FractionField(QQ['q','t']))
        sage: S = Sym.macdonald().S(); S
        Symmetric Functions over Fraction Field of Multivariate Polynomial Ring in q, t
        over Rational Field in the Macdonald S basis
        sage: p = Sym.power()
        sage: p(S[2,1])
        ((1/3*t^3-t^2+t-1/3)/(q^3-3*q^2+3*q-1))*p[1, 1, 1] - ((1/3*t^3-1/3)/(q^3-1))*p[3]
        sage: J = Sym.macdonald().J()
        sage: S(J([2]))
        (q^3-q^2-q+1)*McdS[2]
        sage: S(J([1,1]))
        (q^2*t-q*t-q+1)*McdS[1, 1] + (q^2-q*t-q+t)*McdS[2]
        sage: S = Sym.macdonald(q=0).S()
        sage: S(J[1,1])
        McdS[1, 1] + t*McdS[2]
        sage: S(J[2])
        q*McdS[1, 1] + McdS[2]
        sage: p(S[2,1])
        -(1/3*t^3-t^2+t-1/3)*p[1, 1, 1] + (1/3*t^3-1/3)*p[3]

        sage: from sage.combinat.sf.macdonald import qt_kostka
        sage: qt_kostka([2],[1,1])
        t
        sage: qt_kostka([1,1],[2])
        q

    Python

        >>> from sage.all import *
        >>> Sym = SymmetricFunctions(FractionField(QQ['q','t']))
        >>> S = Sym.macdonald().S(); S
        Symmetric Functions over Fraction Field of Multivariate Polynomial Ring in q, t
        over Rational Field in the Macdonald S basis
        >>> p = Sym.power()
        >>> p(S[Integer(2),Integer(1)])
        ((1/3*t^3-t^2+t-1/3)/(q^3-3*q^2+3*q-1))*p[1, 1, 1] - ((1/3*t^3-1/3)/(q^3-1))*p[3]
        >>> J = Sym.macdonald().J()
        >>> S(J([Integer(2)]))
        (q^3-q^2-q+1)*McdS[2]
        >>> S(J([Integer(1),Integer(1)]))
        (q^2*t-q*t-q+1)*McdS[1, 1] + (q^2-q*t-q+t)*McdS[2]
        >>> S = Sym.macdonald(q=Integer(0)).S()
        >>> S(J[Integer(1),Integer(1)])
        McdS[1, 1] + t*McdS[2]
        >>> S(J[Integer(2)])
        q*McdS[1, 1] + McdS[2]
        >>> p(S[Integer(2),Integer(1)])
        -(1/3*t^3-t^2+t-1/3)*p[1, 1, 1] + (1/3*t^3-1/3)*p[3]

        >>> from sage.combinat.sf.macdonald import qt_kostka
        >>> qt_kostka([Integer(2)],[Integer(1),Integer(1)])
        t
        >>> qt_kostka([Integer(1),Integer(1)],[Integer(2)])
        q

    Coercions to/from the Schur basis are implemented:

    Sage

        sage: S = Sym.macdonald().S()
        sage: s = Sym.schur()
        sage: S(s([2]))
        ((q^2-q*t-q+t)/(t^3-t^2-t+1))*McdS[1, 1] - ((q^2*t-q*t-q+1)/(-t^3+t^2+t-1))*McdS[2]
        sage: s(S([1,1]))
        -((q*t^2-q*t-t+1)/(-q^3+q^2+q-1))*s[1, 1] + ((q*t-t^2-q+t)/(-q^3+q^2+q-1))*s[2]

    [Python]

        >>> from sage.all import *
        >>> S = Sym.macdonald().S()
        >>> s = Sym.schur()
        >>> S(s([Integer(2)]))
        ((q^2-q*t-q+t)/(t^3-t^2-t+1))*McdS[1, 1] - ((q^2*t-q*t-q+1)/(-t^3+t^2+t-1))*McdS[2]
        >>> s(S([Integer(1),Integer(1)]))
        -((q*t^2-q*t-t+1)/(-q^3+q^2+q-1))*s[1, 1] + ((q*t-t^2-q+t)/(-q^3+q^2+q-1))*s[2]

  base_ring()

    Return the base ring of the symmetric functions where the Macdonald symmetric functions live.

    INPUT:

    - `self` – a family of Macdonald symmetric function bases

    OUTPUT: the base ring associated to the corresponding symmetric function ring

    EXAMPLES:

    Sage

        sage: Sym = SymmetricFunctions(QQ['q'].fraction_field())
        sage: Mac = Sym.macdonald(t=0)
        sage: Mac.base_ring()
        Fraction Field of Univariate Polynomial Ring in q over Rational Field

    Python

        >>> from sage.all import *
        >>> Sym = SymmetricFunctions(QQ['q'].fraction_field())
        >>> Mac = Sym.macdonald(t=Integer(0))
        >>> Mac.base_ring()
        Fraction Field of Univariate Polynomial Ring in q over Rational Field

  symmetric_function_ring()

    Return the base ring of the symmetric functions where the Macdonald symmetric functions live.

    INPUT:

    - `self` – a family of Macdonald symmetric function bases

    OUTPUT: the symmetric function ring associated to the Macdonald bases

    EXAMPLES:

    Sage

        sage: Mac = SymmetricFunctions(QQ['q'].fraction_field()).macdonald(t=0)
        sage: Mac.symmetric_function_ring()
        Symmetric Functions over Fraction Field of Univariate Polynomial Ring in q over Rational Field

    Python

        >>> from sage.all import *
        >>> Mac = SymmetricFunctions(QQ['q'].fraction_field()).macdonald(t=Integer(0))
        >>> Mac.symmetric_function_ring()
        Symmetric Functions over Fraction Field of Univariate Polynomial Ring in q over Rational Field

class sage.combinat.sf.macdonald.MacdonaldPolynomials_generic(macdonald)

  Bases: `SymmetricFunctionAlgebra_generic`

  A class for methods for one of the Macdonald bases of the symmetric functions.

  INPUT:

  - `self` – a Macdonald basis

  - `macdonald` – a family of Macdonald symmetric function bases

  EXAMPLES:

  Sage

      sage: Sym = SymmetricFunctions(FractionField(QQ['q,t'])); Sym.rename('Sym'); Sym
      Sym
      sage: Sym.macdonald().P()
      Sym in the Macdonald P basis
      sage: Sym.macdonald(t=2).P()
      Sym in the Macdonald P with t=2 basis
      sage: Sym.rename()

  Python

      >>> from sage.all import *
      >>> Sym = SymmetricFunctions(FractionField(QQ['q,t'])); Sym.rename('Sym'); Sym
      Sym
      >>> Sym.macdonald().P()
      Sym in the Macdonald P basis
      >>> Sym.macdonald(t=Integer(2)).P()
      Sym in the Macdonald P with t=2 basis
      >>> Sym.rename()

  class Element

    Bases: `SymmetricFunctionAlgebra_generic_Element`

    nabla(q=None, t=None, power=1)

      Return the value of the nabla operator applied to `self`.

      The eigenvectors of the nabla operator are the Macdonald polynomials in the \(Ht\) basis. For more information see: [BGHT1999].

      The operator nabla acts on symmetric functions and has the Macdonald \(Ht\) basis as eigenfunctions and the eigenvalues are \(q^{n(\mu')} t^{n(\mu)}\) where \(n(\mu) = \sum_{i} (i-1) \mu_i\) and \(\mu'\) is the conjugate shape of \(\mu\).

      If the parameter `power` is an integer then it calculates nabla to that integer. The default value of `power` is 1.

      INPUT:

      - `self` – an element of a Macdonald basis

      - `q`, `t` – (optional) parameters to specialize

      - `power` – integer (default: 1)

      OUTPUT: the symmetric function of \(\nabla\) acting on `self`

      EXAMPLES:

      Sage

          sage: Sym = SymmetricFunctions(FractionField(QQ['q','t']))
          sage: P = Sym.macdonald().P()
          sage: P([1,1]).nabla()
          ((q^2*t+q*t^2-2*t)/(q*t-1))*McdP[1, 1] + McdP[2]
          sage: P([1,1]).nabla(t=1)
          ((q^2*t+q*t-t-1)/(q*t-1))*McdP[1, 1] + McdP[2]
          sage: H = Sym.macdonald().H()
          sage: H([1,1]).nabla()
          t*McdH[1, 1] - (t^2-1)*McdH[2]
          sage: H([1,1]).nabla(q=1)
          ((t^2+q-t-1)/(q*t-1))*McdH[1, 1] - ((t^3-t^2-t+1)/(q*t-1))*McdH[2]
          sage: H(0).nabla()
          0
          sage: H([2,2,1]).nabla(t=1/H.t)
          -(q^2/(-t^4))*McdH[2, 2, 1]
          sage: H([2,2,1]).nabla(t=1/H.t,power=-1)
          -(t^4/(-q^2))*McdH[2, 2, 1]

      Python

          >>> from sage.all import *
          >>> Sym = SymmetricFunctions(FractionField(QQ['q','t']))
          >>> P = Sym.macdonald().P()
          >>> P([Integer(1),Integer(1)]).nabla()
          ((q^2*t+q*t^2-2*t)/(q*t-1))*McdP[1, 1] + McdP[2]
          >>> P([Integer(1),Integer(1)]).nabla(t=Integer(1))
          ((q^2*t+q*t-t-1)/(q*t-1))*McdP[1, 1] + McdP[2]
          >>> H = Sym.macdonald().H()
          >>> H([Integer(1),Integer(1)]).nabla()
          t*McdH[1, 1] - (t^2-1)*McdH[2]
          >>> H([Integer(1),Integer(1)]).nabla(q=Integer(1))
          ((t^2+q-t-1)/(q*t-1))*McdH[1, 1] - ((t^3-t^2-t+1)/(q*t-1))*McdH[2]
          >>> H(Integer(0)).nabla()
          0
          >>> H([Integer(2),Integer(2),Integer(1)]).nabla(t=Integer(1)/H.t)
          -(q^2/(-t^4))*McdH[2, 2, 1]
          >>> H([Integer(2),Integer(2),Integer(1)]).nabla(t=Integer(1)/H.t,power=-Integer(1))
          -(t^4/(-q^2))*McdH[2, 2, 1]

  c1(part)

    Return the \(qt\)-Hall scalar product between `J(part)` and `P(part)`.

    INPUT:

    - `self` – a Macdonald basis

    - `part` – a partition

    OUTPUT:

    - returns the \(qt\)-Hall scalar product between `J(part)` and `P(part)`

    EXAMPLES:

    Sage

        sage: Sym = SymmetricFunctions(FractionField(QQ['q','t']))
        sage: P = Sym.macdonald().P()
        sage: P.c1(Partition([2,1]))
        -q^4*t + 2*q^3*t - q^2*t + q^2 - 2*q + 1

    Python

        >>> from sage.all import *
        >>> Sym = SymmetricFunctions(FractionField(QQ['q','t']))
        >>> P = Sym.macdonald().P()
        >>> P.c1(Partition([Integer(2),Integer(1)]))
        -q^4*t + 2*q^3*t - q^2*t + q^2 - 2*q + 1

  c2(part)

    Return the \(qt\)-Hall scalar product between `J(part)` and `Q(part)`.

    INPUT:

    - `self` – a Macdonald basis

    - `part` – a partition

    OUTPUT:

    - returns the \(qt\)-Hall scalar product between `J(part)` and `Q(part)`

    EXAMPLES:

    Sage

        sage: Sym = SymmetricFunctions(FractionField(QQ['q','t']))
        sage: P = Sym.macdonald().P()
        sage: P.c2(Partition([2,1]))
        -q*t^4 + 2*q*t^3 - q*t^2 + t^2 - 2*t + 1

    Python

        >>> from sage.all import *
        >>> Sym = SymmetricFunctions(FractionField(QQ['q','t']))
        >>> P = Sym.macdonald().P()
        >>> P.c2(Partition([Integer(2),Integer(1)]))
        -q*t^4 + 2*q*t^3 - q*t^2 + t^2 - 2*t + 1

  construction()

    Return a pair `(F, R)`, where `F` is a `SymmetricFunctionsFunctor` and \(R\) is a ring, such that `F(R)` returns `self`.

    EXAMPLES:

    Sage

        sage: Sym = SymmetricFunctions(FractionField(QQ['q']))
        sage: J = Sym.macdonald(t=2).J()
        sage: J.construction()
        (SymmetricFunctionsFunctor[Macdonald J with t=2],
         Fraction Field of Univariate Polynomial Ring in q over Rational Field)

    Python

        >>> from sage.all import *
        >>> Sym = SymmetricFunctions(FractionField(QQ['q']))
        >>> J = Sym.macdonald(t=Integer(2)).J()
        >>> J.construction()
        (SymmetricFunctionsFunctor[Macdonald J with t=2],
         Fraction Field of Univariate Polynomial Ring in q over Rational Field)

  macdonald_family()

    Return the family of Macdonald bases associated to the basis `self`.

    INPUT:

    - `self` – a Macdonald basis

    OUTPUT: the family of Macdonald symmetric functions associated to `self`

    EXAMPLES:

    Sage

        sage: MacP = SymmetricFunctions(QQ['q'].fraction_field()).macdonald(t=0).P()
        sage: MacP.macdonald_family()
        Macdonald polynomials with t=0 over Fraction Field of Univariate Polynomial Ring in q over Rational Field

    Python

        >>> from sage.all import *
        >>> MacP = SymmetricFunctions(QQ['q'].fraction_field()).macdonald(t=Integer(0)).P()
        >>> MacP.macdonald_family()
        Macdonald polynomials with t=0 over Fraction Field of Univariate Polynomial Ring in q over Rational Field

  product(left, right)

    Multiply an element of the Macdonald symmetric function basis `self` and another symmetric function

    Convert to the Schur basis, do the multiplication there, and convert back to `self` basis.

    INPUT:

    - `self` – a Macdonald symmetric function basis

    - `left` – an element of the basis `self`

    - `right` – another symmetric function

    OUTPUT: the product of `left` and `right` expanded in the basis `self`

    EXAMPLES:

    Sage

        sage: Mac = SymmetricFunctions(FractionField(QQ['q','t'])).macdonald()
        sage: H = Mac.H()
        sage: J = Mac.J()
        sage: P = Mac.P()
        sage: Q = Mac.Q()
        sage: Ht = Mac.Ht()
        sage: J([1])^2 #indirect doctest
        ((q-1)/(q*t-1))*McdJ[1, 1] + ((t-1)/(q*t-1))*McdJ[2]
        sage: J.product( J[1], J[2] )
        -((q^2-1)/(-q^2*t+1))*McdJ[2, 1] - ((t-1)/(-q^2*t+1))*McdJ[3]
        sage: H.product( H[1], H[2] )
        ((q^2-1)/(q^2*t-1))*McdH[2, 1] - ((t-1)/(-q^2*t+1))*McdH[3]
        sage: P.product( P[1], P[2] )
        -((q^3*t^2-q*t^2-q^2+1)/(-q^3*t^2+q^2*t+q*t-1))*McdP[2, 1] + McdP[3]
        sage: Q.product(Q[1],Q[2])
        McdQ[2, 1] + ((q^2*t-q^2+q*t-q+t-1)/(q^2*t-1))*McdQ[3]
        sage: Ht.product(Ht[1],Ht[2])
        ((q^2-1)/(q^2-t))*McdHt[2, 1] + ((t-1)/(-q^2+t))*McdHt[3]

    Python

        >>> from sage.all import *
        >>> Mac = SymmetricFunctions(FractionField(QQ['q','t'])).macdonald()
        >>> H = Mac.H()
        >>> J = Mac.J()
        >>> P = Mac.P()
        >>> Q = Mac.Q()
        >>> Ht = Mac.Ht()
        >>> J([Integer(1)])**Integer(2) #indirect doctest
        ((q-1)/(q*t-1))*McdJ[1, 1] + ((t-1)/(q*t-1))*McdJ[2]
        >>> J.product( J[Integer(1)], J[Integer(2)] )
        -((q^2-1)/(-q^2*t+1))*McdJ[2, 1] - ((t-1)/(-q^2*t+1))*McdJ[3]
        >>> H.product( H[Integer(1)], H[Integer(2)] )
        ((q^2-1)/(q^2*t-1))*McdH[2, 1] - ((t-1)/(-q^2*t+1))*McdH[3]
        >>> P.product( P[Integer(1)], P[Integer(2)] )
        -((q^3*t^2-q*t^2-q^2+1)/(-q^3*t^2+q^2*t+q*t-1))*McdP[2, 1] + McdP[3]
        >>> Q.product(Q[Integer(1)],Q[Integer(2)])
        McdQ[2, 1] + ((q^2*t-q^2+q*t-q+t-1)/(q^2*t-1))*McdQ[3]
        >>> Ht.product(Ht[Integer(1)],Ht[Integer(2)])
        ((q^2-1)/(q^2-t))*McdHt[2, 1] + ((t-1)/(-q^2+t))*McdHt[3]

class sage.combinat.sf.macdonald.MacdonaldPolynomials_h(macdonald)

  Bases: `MacdonaldPolynomials_generic`

  The \(H\) basis is defined as \(H_\mu = \sum_{\lambda} K_{\lambda\mu}(q,t) s_\lambda\) where \(K_{\lambda\mu}(q,t)\) are the Macdonald Kostka coefficients.

  In this implementation, it is calculated by using the Macdonald \(Ht\) basis and substituting \(t \rightarrow 1/t\) and multiplying by \(t^{n(\mu)}\).

  INPUT:

  - `self` – a Macdonald \(H\) basis

  - `macdonald` – a family of Macdonald bases

  class Element

    Bases: `Element`

class sage.combinat.sf.macdonald.MacdonaldPolynomials_ht(macdonald)

  Bases: `MacdonaldPolynomials_generic`

  The \(Ht\) basis is defined as \({\tilde H}_\mu = t^{n(\mu)} \sum_{\lambda} K_{\lambda\mu}(q,t^{-1}) s_\lambda\) where \(K_{\lambda\mu}(q,t)\) are the Macdonald \((q,t)\)-Kostka coefficients and \(n(\mu) = \sum_{i} (i-1) \mu_i\).

  It is implemented here by using a Pieri formula due to F. Bergeron and M. Haiman [BH2013].

  INPUT:

  - `self` – a Macdonald \(Ht\) basis

  - `macdonald` – a family of Macdonald bases

  class Element

    Bases: `Element`

    nabla(q=None, t=None, power=1)

      Return the value of the nabla operator applied to `self`. The eigenvectors of the \(nabla\) operator are the Macdonald polynomials in the \(Ht\) basis. For more information see: [BGHT1999].

      The operator \(nabla\) acts on symmetric functions and has the Macdonald \(Ht\) basis as eigenfunctions and the eigenvalues are \(q^{n(\mu')} t^{n(\mu)}\) where \(n(\mu) = \sum_{i} (i-1) \mu_i\).

      If the parameter `power` is an integer then it calculates nabla to that integer. The default value of `power` is 1.

      INPUT:

      - `self` – an element of the Macdonald \(Ht\) basis

      - `q`, `t` – (optional) parameters to specialize

      - `power` – integer (default: 1)

      OUTPUT: the symmetric function of \(\nabla\) acting on `self`

      EXAMPLES:

      Sage

          sage: Sym = SymmetricFunctions(FractionField(QQ['q','t']))
          sage: Ht = Sym.macdonald().Ht()
          sage: t = Ht.t; q = Ht.q
          sage: s = Sym.schur()
          sage: a = sum(Ht(p) for p in Partitions(3))
          sage: Ht(0).nabla()
          0
          sage: a.nabla() == t^3*Ht([1,1,1])+q*t*Ht([2,1]) + q^3*Ht([3])
          True
          sage: a.nabla(t=3) == 27*Ht([1,1,1])+3*q*Ht([2,1]) + q^3*Ht([3])
          True
          sage: a.nabla(q=3) == t^3*Ht([1,1,1])+3*t*Ht([2,1]) + 27*Ht([3])
          True
          sage: Ht[2,1].nabla(power=-1)
          1/(q*t)*McdHt[2, 1]
          sage: Ht[2,1].nabla(power=4)
          q^4*t^4*McdHt[2, 1]
          sage: s(a.nabla(q=3))
          (t^6+27*q^3+3*q*t^2)*s[1, 1, 1] + (t^5+t^4+27*q^2+3*q*t+3*t^2+27*q)*s[2, 1] + (t^3+3*t+27)*s[3]
          sage: Ht = Sym.macdonald(q=3).Ht()
          sage: a = sum(Ht(p) for p in Partitions(3))
          sage: s(a.nabla())
          (t^6+9*t^2+729)*s[1, 1, 1] + (t^5+t^4+3*t^2+9*t+324)*s[2, 1] + (t^3+3*t+27)*s[3]

      Python

          >>> from sage.all import *
          >>> Sym = SymmetricFunctions(FractionField(QQ['q','t']))
          >>> Ht = Sym.macdonald().Ht()
          >>> t = Ht.t; q = Ht.q
          >>> s = Sym.schur()
          >>> a = sum(Ht(p) for p in Partitions(Integer(3)))
          >>> Ht(Integer(0)).nabla()
          0
          >>> a.nabla() == t**Integer(3)*Ht([Integer(1),Integer(1),Integer(1)])+q*t*Ht([Integer(2),Integer(1)]) + q**Integer(3)*Ht([Integer(3)])
          True
          >>> a.nabla(t=Integer(3)) == Integer(27)*Ht([Integer(1),Integer(1),Integer(1)])+Integer(3)*q*Ht([Integer(2),Integer(1)]) + q**Integer(3)*Ht([Integer(3)])
          True
          >>> a.nabla(q=Integer(3)) == t**Integer(3)*Ht([Integer(1),Integer(1),Integer(1)])+Integer(3)*t*Ht([Integer(2),Integer(1)]) + Integer(27)*Ht([Integer(3)])
          True
          >>> Ht[Integer(2),Integer(1)].nabla(power=-Integer(1))
          1/(q*t)*McdHt[2, 1]
          >>> Ht[Integer(2),Integer(1)].nabla(power=Integer(4))
          q^4*t^4*McdHt[2, 1]
          >>> s(a.nabla(q=Integer(3)))
          (t^6+27*q^3+3*q*t^2)*s[1, 1, 1] + (t^5+t^4+27*q^2+3*q*t+3*t^2+27*q)*s[2, 1] + (t^3+3*t+27)*s[3]
          >>> Ht = Sym.macdonald(q=Integer(3)).Ht()
          >>> a = sum(Ht(p) for p in Partitions(Integer(3)))
          >>> s(a.nabla())
          (t^6+9*t^2+729)*s[1, 1, 1] + (t^5+t^4+3*t^2+9*t+324)*s[2, 1] + (t^3+3*t+27)*s[3]

class sage.combinat.sf.macdonald.MacdonaldPolynomials_j(macdonald)

  Bases: `MacdonaldPolynomials_generic`

  The \(J\) basis is calculated using determinantal formulas of Lapointe-Lascoux-Morse giving the action on the \(S\)-basis.

  INPUT:

  - `self` – a Macdonald \(J\) basis

  - `macdonald` – a family of Macdonald bases

  class Element

    Bases: `Element`

class sage.combinat.sf.macdonald.MacdonaldPolynomials_p(macdonald)

  Bases: `MacdonaldPolynomials_generic`

  The \(P\) basis is defined here as the \(J\) basis times a normalizing coefficient \(c2\).

  INPUT:

  - `self` – a Macdonald \(P\) basis

  - `macdonald` – a family of Macdonald bases

  class Element

    Bases: `Element`

  scalar_qt_basis(part1, part2=None)

    Return the scalar product of \(P(part1)\) and \(P(part2)\) This scalar product formula is given in equation (4.11) p.323 and (6.19) p.339 of Macdonald’s book [Mac1995].

    INPUT:

    - `self` – a Macdonald \(P\) basis

    - `part1`, `part2` – partitions

    OUTPUT:

    - returns the scalar product of `P(part1)` and `P(part2)`

    EXAMPLES:

    Sage

        sage: Sym = SymmetricFunctions(FractionField(QQ['q','t']))
        sage: P = Sym.macdonald().P()
        sage: P.scalar_qt_basis(Partition([2,1]), Partition([1,1,1]))
        0
        sage: f = P.scalar_qt_basis(Partition([3,2,1]), Partition([3,2,1]))
        sage: factor(f.numerator())
        (q - 1)^3 * (q^2*t - 1)^2 * (q^3*t^2 - 1)
        sage: factor(f.denominator())
        (t - 1)^3 * (q*t^2 - 1)^2 * (q^2*t^3 - 1)

    Python

        >>> from sage.all import *
        >>> Sym = SymmetricFunctions(FractionField(QQ['q','t']))
        >>> P = Sym.macdonald().P()
        >>> P.scalar_qt_basis(Partition([Integer(2),Integer(1)]), Partition([Integer(1),Integer(1),Integer(1)]))
        0
        >>> f = P.scalar_qt_basis(Partition([Integer(3),Integer(2),Integer(1)]), Partition([Integer(3),Integer(2),Integer(1)]))
        >>> factor(f.numerator())
        (q - 1)^3 * (q^2*t - 1)^2 * (q^3*t^2 - 1)
        >>> factor(f.denominator())
        (t - 1)^3 * (q*t^2 - 1)^2 * (q^2*t^3 - 1)

    With a single argument, takes \(part2 = part1\):

    Sage

        sage: P.scalar_qt_basis(Partition([2,1]), Partition([2,1]))
        (-q^4*t + 2*q^3*t - q^2*t + q^2 - 2*q + 1)/(-q*t^4 + 2*q*t^3 - q*t^2 + t^2 - 2*t + 1)

    [Python]

        >>> from sage.all import *
        >>> P.scalar_qt_basis(Partition([Integer(2),Integer(1)]), Partition([Integer(2),Integer(1)]))
        (-q^4*t + 2*q^3*t - q^2*t + q^2 - 2*q + 1)/(-q*t^4 + 2*q*t^3 - q*t^2 + t^2 - 2*t + 1)

class sage.combinat.sf.macdonald.MacdonaldPolynomials_q(macdonald)

  Bases: `MacdonaldPolynomials_generic`

  The \(Q\) basis is defined here as the \(J\) basis times a normalizing coefficient.

  INPUT:

  - `self` – a Macdonald \(Q\) basis

  - `macdonald` – a family of Macdonald bases

  class Element

    Bases: `Element`

class sage.combinat.sf.macdonald.MacdonaldPolynomials_s(macdonald)

  Bases: `MacdonaldPolynomials_generic`

  An implementation of the basis \(s_\lambda[(1-t)X/(1-q)]\).

  This is perhaps misnamed as a ‘Macdonald’ basis for the symmetric functions but is used in the calculation of the Macdonald \(J\) basis (see method ‘creation’ below) but does use both of the two parameters and can be specialized to \(s_\lambda[(1-t)X]\) and \(s_\lambda[X/(1-t)]\).

  INPUT:

  - `self` – a Macdonald \(S\) basis

  - `macdonald` – a family of Macdonald bases

  class Element

    Bases: `Element`

    creation(k)

      This function is a creation operator for the J-basis for which the action is known on the ‘Macdonald’ S-basis by formula from [LLM1998].

      INPUT:

      - `self` – an element of the Macdonald \(S\) basis

      - `k` – positive integer

      OUTPUT: the column adding operator on the \(J\) basis on `self`

      EXAMPLES:

      Sage

          sage: Sym = SymmetricFunctions(FractionField(QQ['q','t']))
          sage: S = Sym.macdonald().S()
          sage: a = S(1)
          sage: a.creation(1)
          -(q-1)*McdS[1]
          sage: a.creation(2)
          (q^2*t-q*t-q+1)*McdS[1, 1] + (q^2-q*t-q+t)*McdS[2]

      Python

          >>> from sage.all import *
          >>> Sym = SymmetricFunctions(FractionField(QQ['q','t']))
          >>> S = Sym.macdonald().S()
          >>> a = S(Integer(1))
          >>> a.creation(Integer(1))
          -(q-1)*McdS[1]
          >>> a.creation(Integer(2))
          (q^2*t-q*t-q+1)*McdS[1, 1] + (q^2-q*t-q+t)*McdS[2]

  product(left, right)

    The multiplication of the modified Schur functions behaves the same as the multiplication of the Schur functions.

    INPUT:

    - `self` – a Macdonald \(S\) basis

    - `left`, `right` – a symmetric functions

    OUTPUT: the product of `left` and `right`

    EXAMPLES:

    Sage

        sage: Sym = SymmetricFunctions(FractionField(QQ['q','t']))
        sage: S = Sym.macdonald().S()
        sage: S([2])^2 #indirect doctest
        McdS[2, 2] + McdS[3, 1] + McdS[4]

    Python

        >>> from sage.all import *
        >>> Sym = SymmetricFunctions(FractionField(QQ['q','t']))
        >>> S = Sym.macdonald().S()
        >>> S([Integer(2)])**Integer(2) #indirect doctest
        McdS[2, 2] + McdS[3, 1] + McdS[4]

sage.combinat.sf.macdonald.c1(part, q, t)

  This function returns the qt-Hall scalar product between `J(part)` and `P(part)`.

  This coefficient is \(c_\lambda\) in equation (8.1’) p. 352 of Macdonald’s book [Mac1995].

  INPUT:

  - `part` – a partition

  - `q`, `t` – parameters

  OUTPUT: a polynomial of the scalar product between the \(J\) and \(P\) bases

  EXAMPLES:

  Sage

      sage: from sage.combinat.sf.macdonald import c1
      sage: R.<q,t> = QQ[]
      sage: c1(Partition([2,1]),q,t)
      -q^4*t + 2*q^3*t - q^2*t + q^2 - 2*q + 1
      sage: c1(Partition([1,1]),q,t)
      q^2*t - q*t - q + 1

  Python

      >>> from sage.all import *
      >>> from sage.combinat.sf.macdonald import c1
      >>> R = QQ['q, t']; (q, t,) = R._first_ngens(2)
      >>> c1(Partition([Integer(2),Integer(1)]),q,t)
      -q^4*t + 2*q^3*t - q^2*t + q^2 - 2*q + 1
      >>> c1(Partition([Integer(1),Integer(1)]),q,t)
      q^2*t - q*t - q + 1

sage.combinat.sf.macdonald.c2(part, q, t)

  This function returns the qt-Hall scalar product between J(part) and Q(part).

  This coefficient is \(c_\lambda\) in equation (8.1) p. 352 of Macdonald’s book [Mac1995].

  INPUT:

  - `part` – a partition

  - `q`, `t` – parameters

  OUTPUT: a polynomial of the scalar product between the \(J\) and \(P\) bases

  EXAMPLES:

  Sage

      sage: from sage.combinat.sf.macdonald import c2
      sage: R.<q,t> = QQ[]
      sage: c2(Partition([1,1]),q,t)
      t^3 - t^2 - t + 1
      sage: c2(Partition([2,1]),q,t)
      -q*t^4 + 2*q*t^3 - q*t^2 + t^2 - 2*t + 1

  Python

      >>> from sage.all import *
      >>> from sage.combinat.sf.macdonald import c2
      >>> R = QQ['q, t']; (q, t,) = R._first_ngens(2)
      >>> c2(Partition([Integer(1),Integer(1)]),q,t)
      t^3 - t^2 - t + 1
      >>> c2(Partition([Integer(2),Integer(1)]),q,t)
      -q*t^4 + 2*q*t^3 - q*t^2 + t^2 - 2*t + 1

sage.combinat.sf.macdonald.cmunu(nu)

  Return the coefficient of \({\tilde H}_\nu\) in \(h_r^\perp {\tilde H}_\mu\).

  Proposition 5 of F. Bergeron and M. Haiman [BH2013] states

  \[c_{\mu\nu} = \sum_{\alpha \leftarrow \nu} c_{\mu\alpha} c_{\alpha\nu} B_{\alpha/\nu}/B_{\mu/\nu}\]

  where \(c_{\mu\nu}\) is the coefficient of \({\tilde H}_\nu\) in \(h_r^\perp {\tilde H}_\mu\) and \(B_{\mu/\nu}\) is the bi-exponent generator implemented in the function `sage.combinat.sf.macdonald.Bmu()`.

  INPUT:

  - `mu`, `nu` – partitions with `nu` contained in `mu`

  OUTPUT: an element of the fraction field of polynomials in \(q\) and \(t\)

  EXAMPLES:

  Sage

      sage: from sage.combinat.sf.macdonald import cmunu
      sage: cmunu(Partition([2,1]),Partition([1]))
      q + t + 1
      sage: cmunu(Partition([2,2]),Partition([1,1]))
      (-q^3 - q^2 + q*t + t)/(-q + t)
      sage: Sym = SymmetricFunctions(QQ['q','t'].fraction_field())
      sage: h = Sym.h()
      sage: Ht = Sym.macdonald().Ht()
      sage: all(Ht[2,2].skew_by(h[r]).coefficient(nu)
      ....:     == cmunu(Partition([2,2]),nu)
      ....:     for r in range(1,5) for nu in Partitions(4-r))
      True

  Python

      >>> from sage.all import *
      >>> from sage.combinat.sf.macdonald import cmunu
      >>> cmunu(Partition([Integer(2),Integer(1)]),Partition([Integer(1)]))
      q + t + 1
      >>> cmunu(Partition([Integer(2),Integer(2)]),Partition([Integer(1),Integer(1)]))
      (-q^3 - q^2 + q*t + t)/(-q + t)
      >>> Sym = SymmetricFunctions(QQ['q','t'].fraction_field())
      >>> h = Sym.h()
      >>> Ht = Sym.macdonald().Ht()
      >>> all(Ht[Integer(2),Integer(2)].skew_by(h[r]).coefficient(nu)
      ...     == cmunu(Partition([Integer(2),Integer(2)]),nu)
      ...     for r in range(Integer(1),Integer(5)) for nu in Partitions(Integer(4)-r))
      True

sage.combinat.sf.macdonald.cmunu1(nu)

  Return the coefficient of \({\tilde H}_\nu\) in \(h_1^\perp {\tilde H}_\mu\).

  INPUT:

  - `mu`, `nu` – partitions with `nu` precedes `mu`

  OUTPUT: an element of the fraction field of polynomials in \(q\) and \(t\)

  EXAMPLES:

  Sage

      sage: from sage.combinat.sf.macdonald import cmunu1
      sage: cmunu1(Partition([2,1]),Partition([2]))
      (-t^2 + q)/(q - t)
      sage: cmunu1(Partition([2,1]),Partition([1,1]))
      (-q^2 + t)/(-q + t)
      sage: Sym = SymmetricFunctions(QQ['q','t'].fraction_field())
      sage: h = Sym.h()
      sage: Ht = Sym.macdonald().Ht()
      sage: all(Ht[3,2,1].skew_by(h[1]).coefficient(nu)
      ....:     == cmunu1(Partition([3,2,1]),nu)
      ....:     for nu in Partition([3,2,1]).down_list())
      True

  Python

      >>> from sage.all import *
      >>> from sage.combinat.sf.macdonald import cmunu1
      >>> cmunu1(Partition([Integer(2),Integer(1)]),Partition([Integer(2)]))
      (-t^2 + q)/(q - t)
      >>> cmunu1(Partition([Integer(2),Integer(1)]),Partition([Integer(1),Integer(1)]))
      (-q^2 + t)/(-q + t)
      >>> Sym = SymmetricFunctions(QQ['q','t'].fraction_field())
      >>> h = Sym.h()
      >>> Ht = Sym.macdonald().Ht()
      >>> all(Ht[Integer(3),Integer(2),Integer(1)].skew_by(h[Integer(1)]).coefficient(nu)
      ...     == cmunu1(Partition([Integer(3),Integer(2),Integer(1)]),nu)
      ...     for nu in Partition([Integer(3),Integer(2),Integer(1)]).down_list())
      True

sage.combinat.sf.macdonald.qt_kostka(lam, mu)

  Return the \(K_{\lambda\mu}(q,t)\) by computing the change of basis from the Macdonald H basis to the Schurs.

  INPUT:

  - `lam`, `mu` – partitions of the same size

  OUTPUT:

  - returns the \(q,t\)-Kostka polynomial indexed by the partitions `lam` and `mu`

  EXAMPLES:

  Sage

      sage: from sage.combinat.sf.macdonald import qt_kostka
      sage: qt_kostka([2,1,1],[1,1,1,1])
      t^3 + t^2 + t
      sage: qt_kostka([1,1,1,1],[2,1,1])
      q
      sage: qt_kostka([1,1,1,1],[3,1])
      q^3
      sage: qt_kostka([1,1,1,1],[1,1,1,1])
      1
      sage: qt_kostka([2,1,1],[2,2])
      q^2*t + q*t + q
      sage: qt_kostka([2,2],[2,2])
      q^2*t^2 + 1
      sage: qt_kostka([4],[3,1])
      t
      sage: qt_kostka([2,2],[3,1])
      q^2*t + q
      sage: qt_kostka([3,1],[2,1,1])
      q*t^3 + t^2 + t
      sage: qt_kostka([2,1,1],[2,1,1])
      q*t^2 + q*t + 1
      sage: qt_kostka([2,1],[1,1,1,1])
      0

  Python

      >>> from sage.all import *
      >>> from sage.combinat.sf.macdonald import qt_kostka
      >>> qt_kostka([Integer(2),Integer(1),Integer(1)],[Integer(1),Integer(1),Integer(1),Integer(1)])
      t^3 + t^2 + t
      >>> qt_kostka([Integer(1),Integer(1),Integer(1),Integer(1)],[Integer(2),Integer(1),Integer(1)])
      q
      >>> qt_kostka([Integer(1),Integer(1),Integer(1),Integer(1)],[Integer(3),Integer(1)])
      q^3
      >>> qt_kostka([Integer(1),Integer(1),Integer(1),Integer(1)],[Integer(1),Integer(1),Integer(1),Integer(1)])
      1
      >>> qt_kostka([Integer(2),Integer(1),Integer(1)],[Integer(2),Integer(2)])
      q^2*t + q*t + q
      >>> qt_kostka([Integer(2),Integer(2)],[Integer(2),Integer(2)])
      q^2*t^2 + 1
      >>> qt_kostka([Integer(4)],[Integer(3),Integer(1)])
      t
      >>> qt_kostka([Integer(2),Integer(2)],[Integer(3),Integer(1)])
      q^2*t + q
      >>> qt_kostka([Integer(3),Integer(1)],[Integer(2),Integer(1),Integer(1)])
      q*t^3 + t^2 + t
      >>> qt_kostka([Integer(2),Integer(1),Integer(1)],[Integer(2),Integer(1),Integer(1)])
      q*t^2 + q*t + 1
      >>> qt_kostka([Integer(2),Integer(1)],[Integer(1),Integer(1),Integer(1),Integer(1)])
      0