def Ht(mu, q=None, t=None, pi=None): """ Returns the symmetric Macdonald polynomial using the Haiman, Haglund, and Loehr formula. Note that if both `q` and `t` are specified, then they must have the same parent. REFERENCE: - 'A combinatorial formula for non-symmetric Macdonald polynomials'. Haiman, Haglund, and Loehr. http://arxiv.org/abs/math/0601693 EXAMPLES:: sage: from sage.combinat.sf.ns_macdonald import Ht sage: HHt = SymmetricFunctions(QQ['q','t'].fraction_field()).macdonald().Ht() sage: Ht([0,0,1]) x0 + x1 + x2 sage: HHt([1]).expand(3) x0 + x1 + x2 sage: Ht([0,0,2]) x0^2 + (q + 1)*x0*x1 + x1^2 + (q + 1)*x0*x2 + (q + 1)*x1*x2 + x2^2 sage: HHt([2]).expand(3) x0^2 + (q + 1)*x0*x1 + x1^2 + (q + 1)*x0*x2 + (q + 1)*x1*x2 + x2^2 """ P, q, t, n, R, x = _check_muqt(mu, q, t, pi) res = 0 for a in n: weight = a.weight() res += q**a.maj() * t**a.inv() * prod(x[i]**weight[i] for i in range(len(weight))) return res
def _equation(self, var_mapping): """ Returns the right hand side of an algebraic equation satisfied by this species. This is a utility function called by the algebraic_equation_system method. EXAMPLES:: sage: X = species.SingletonSpecies() sage: S = X * X sage: S.algebraic_equation_system() [node0 - z^2] """ from sage.rings.all import prod return prod(var_mapping[operand] for operand in self._state_info)
def __pow__(self, n): """ EXAMPLES:: sage: L = LazyPowerSeriesRing(QQ) sage: f = L([1,1,0]) # 1+x sage: g = f^3 sage: g.coefficients(4) [1, 3, 3, 1] :: sage: f^0 1 """ if not isinstance(n, (int, Integer)) or n < 0: raise ValueError, "n must be a nonnegative integer" return prod([self]*n, self.parent().identity_element())
def E(mu, q=None, t=None, pi=None): """ Returns the non-symmetric Macdonald polynomial in type A corresponding to a shape ``mu``, with basement permuted according to ``pi``. Note that if both `q` and `t` are specified, then they must have the same parent. REFERENCE: - 'A combinatorial formula for non-symmetric Macdonald polynomials'. Haiman, Haglund, and Loehr. http://arxiv.org/abs/math/0601693 EXAMPLES:: sage: from sage.combinat.sf.ns_macdonald import E sage: E([0,0,0]) 1 sage: E([1,0,0]) x0 sage: E([0,1,0]) ((-t + 1)/(-q*t^2 + 1))*x0 + x1 sage: E([0,0,1]) ((-t + 1)/(-q*t + 1))*x0 + ((-t + 1)/(-q*t + 1))*x1 + x2 sage: E([1,1,0]) x0*x1 sage: E([1,0,1]) ((-t + 1)/(-q*t^2 + 1))*x0*x1 + x0*x2 sage: E([0,1,1]) ((-t + 1)/(-q*t + 1))*x0*x1 + ((-t + 1)/(-q*t + 1))*x0*x2 + x1*x2 sage: E([2,0,0]) x0^2 + ((-q*t + q)/(-q*t + 1))*x0*x1 + ((-q*t + q)/(-q*t + 1))*x0*x2 sage: E([0,2,0]) ((-t + 1)/(-q^2*t^2 + 1))*x0^2 + ((-q^2*t^3 + q^2*t^2 - q*t^2 + 2*q*t - q + t - 1)/(-q^3*t^3 + q^2*t^2 + q*t - 1))*x0*x1 + x1^2 + ((q*t^2 - 2*q*t + q)/(q^3*t^3 - q^2*t^2 - q*t + 1))*x0*x2 + ((-q*t + q)/(-q*t + 1))*x1*x2 """ P, q, t, n, R, x = _check_muqt(mu, q, t, pi) res = 0 for a in n: weight = a.weight() res += q**a.maj() * t**a.coinv() * a.coeff(q, t) * prod( x[i]**weight[i] for i in range(len(weight))) return res
def E_integral(mu, q=None, t=None, pi=None): """ Returns the integral form for the non-symmetric Macdonald polynomial in type A corresponding to a shape mu. Note that if both q and t are specified, then they must have the same parent. REFERENCE: - 'A combinatorial formula for non-symmetric Macdonald polynomials'. Haiman, Haglund, and Loehr. http://arxiv.org/abs/math/0601693 EXAMPLES:: sage: from sage.combinat.sf.ns_macdonald import E_integral sage: E_integral([0,0,0]) 1 sage: E_integral([1,0,0]) (-t + 1)*x0 sage: E_integral([0,1,0]) (-q*t^2 + 1)*x0 + (-t + 1)*x1 sage: E_integral([0,0,1]) (-q*t + 1)*x0 + (-q*t + 1)*x1 + (-t + 1)*x2 sage: E_integral([1,1,0]) (t^2 - 2*t + 1)*x0*x1 sage: E_integral([1,0,1]) (q*t^3 - q*t^2 - t + 1)*x0*x1 + (t^2 - 2*t + 1)*x0*x2 sage: E_integral([0,1,1]) (q^2*t^3 + q*t^4 - q*t^3 - q*t^2 - q*t - t^2 + t + 1)*x0*x1 + (q*t^2 - q*t - t + 1)*x0*x2 + (t^2 - 2*t + 1)*x1*x2 sage: E_integral([2,0,0]) (t^2 - 2*t + 1)*x0^2 + (q^2*t^2 - q^2*t - q*t + q)*x0*x1 + (q^2*t^2 - q^2*t - q*t + q)*x0*x2 sage: E_integral([0,2,0]) (q^2*t^3 - q^2*t^2 - t + 1)*x0^2 + (q^4*t^3 - q^3*t^2 - q^2*t + q*t^2 - q*t + q - t + 1)*x0*x1 + (t^2 - 2*t + 1)*x1^2 + (q^4*t^3 - q^3*t^2 - q^2*t + q)*x0*x2 + (q^2*t^2 - q^2*t - q*t + q)*x1*x2 """ P, q, t, n, R, x = _check_muqt(mu, q, t, pi) res = 0 for a in n: weight = a.weight() res += q**a.maj() * t**a.coinv() * a.coeff_integral(q, t) * prod( x[i]**weight[i] for i in range(len(weight))) return res
def change_support(perm, support, change_perm=None): """ Changes the support of a permutation defined on [1, ..., n] to support. EXAMPLES:: sage: from sage.combinat.species.misc import change_support sage: p = PermutationGroupElement((1,2,3)); p (1,2,3) sage: change_support(p, [3,4,5]) (3,4,5) """ if change_perm is None: change_perm = prod([PermutationGroupElement((i+1,support[i])) for i in range(len(support)) if i+1 != support[i]], PermutationGroupElement([], SymmetricGroup(support))) if isinstance(perm, PermutationGroup_generic): return PermutationGroup([change_support(g, support, change_perm) for g in perm.gens()]) return change_perm*perm*~change_perm