Skip to content

Commit 85f6557

Browse files
author
Release Manager
committed
gh-40795: Fixing a bug in permuted basement NS Macdonalds and some cleanup <!-- ^ Please provide a concise and informative title. --> <!-- ^ Don't put issue numbers in the title, do this in the PR description below. --> <!-- ^ For example, instead of "Fixes #12345" use "Introduce new method to calculate 1 + 2". --> <!-- v Describe your changes below in detail. --> <!-- v Why is this change required? What problem does it solve? --> <!-- v If this PR resolves an open issue, please link to it here. For example, "Fixes #12345". --> Permuted basement nonsymmetric Macdonald polynomials had an error in the power of $t$ with how the coinversion formulas was computed. This fixes that, a documentation error, and some other minor doc issues. ### 📝 Checklist <!-- Put an `x` in all the boxes that apply. --> - [x] The title is concise and informative. - [x] The description explains in detail what this PR is about. - [x] I have linked a relevant issue or discussion. - [x] I have created tests covering the changes. - [x] I have updated the documentation and checked the documentation preview. ### ⌛ Dependencies <!-- List all open PRs that this PR logically depends on. For example, --> <!-- - #12345: short description why this is a dependency --> <!-- - #34567: ... --> URL: #40795 Reported by: Travis Scrimshaw Reviewer(s): Frédéric Chapoton
2 parents 5eebf97 + c86e24e commit 85f6557

File tree

2 files changed

+92
-48
lines changed

2 files changed

+92
-48
lines changed

src/sage/combinat/root_system/non_symmetric_macdonald_polynomials.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -309,7 +309,7 @@ class NonSymmetricMacdonaldPolynomials(CherednikOperatorsEigenvectors):
309309
(where `a=1` except for `i=0` in type `BC` where `a=a_0=2`) which
310310
satisfy the following skew commutation relations:
311311
312-
.. MATH:: \tau_i Y_\lambda = \tau_i Y_{s_i\lambda} \,.
312+
.. MATH:: \tau_i Y_\lambda = Y_{s_i\lambda} \tau_i \,.
313313
314314
If `s_i \mu \ne \mu`, applying `\tau_i` on an eigenvector `E_\mu`
315315
produces a new eigenvector (essentially `E_{s_i\mu}`) with a

src/sage/combinat/sf/ns_macdonald.py

Lines changed: 91 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ def __getitem__(self, i):
6060

6161
def leg(self, i, j):
6262
"""
63-
Return the leg of the box ``(i,j)`` in ``self``.
63+
Return the leg of the box ``(i, j)`` in ``self``.
6464
6565
EXAMPLES::
6666
@@ -72,7 +72,7 @@ def leg(self, i, j):
7272

7373
def arm_left(self, i, j):
7474
"""
75-
Return the left arm of the box ``(i,j)`` in ``self``.
75+
Return the left arm of the box ``(i, j)`` in ``self``.
7676
7777
EXAMPLES::
7878
@@ -84,7 +84,7 @@ def arm_left(self, i, j):
8484

8585
def arm_right(self, i, j):
8686
"""
87-
Return the right arm of the box ``(i,j)`` in ``self``.
87+
Return the right arm of the box ``(i, j)`` in ``self``.
8888
8989
EXAMPLES::
9090
@@ -97,7 +97,7 @@ def arm_right(self, i, j):
9797

9898
def arm(self, i, j):
9999
"""
100-
Return the arm of the box ``(i,j)`` in ``self``.
100+
Return the arm of the box ``(i, j)`` in ``self``.
101101
102102
EXAMPLES::
103103
@@ -121,7 +121,7 @@ def l(self, i, j):
121121

122122
def a(self, i, j):
123123
"""
124-
Return the length of the arm of the box ``(i,j)`` in ``self``.
124+
Return the length of the arm of the box ``(i, j)`` in ``self``.
125125
126126
EXAMPLES::
127127
@@ -144,9 +144,11 @@ def size(self):
144144
return sum(self._list)
145145

146146
def flip(self):
147-
"""
148-
Return the flip of ``self``, where flip is defined as follows. Let
149-
``r = max(self)``. Then ``self.flip()[i] = r - self[i]``.
147+
r"""
148+
Return the flip of ``self``.
149+
150+
The flip map is defined as follows. Let ``r = max(self)``.
151+
Then ``self.flip()[i] = r - self[i]``.
150152
151153
EXAMPLES::
152154
@@ -243,24 +245,26 @@ def shape(self):
243245
for i in range(1, len(self) + 1)])
244246

245247
def __contains__(self, ij):
246-
"""
247-
Return ``True`` if the box ``(i,j) (= ij)`` is in ``self``. Note that this
248-
does not include the basement row.
248+
r"""
249+
Return ``True`` if the box ``(i, j) (= ij)`` is in ``self``.
250+
251+
Note that this does not include the basement row.
249252
250253
EXAMPLES::
251254
252255
sage: a = AugmentedLatticeDiagramFilling([[1,6],[2],[3,4,2],[],[],[5,5]])
253-
sage: (1,1) in a
256+
sage: (1, 1) in a
254257
True
255-
sage: (1,0) in a
258+
sage: (1, 0) in a
256259
False
257260
"""
258261
i, j = ij
259262
return 0 < i <= len(self) and 0 < j <= len(self[i])
260263

261264
def are_attacking(self, i, j, ii, jj):
262-
"""
263-
Return ``True`` if the boxes ``(i,j)`` and ``(ii,jj)`` in ``self`` are attacking.
265+
r"""
266+
Return ``True`` if the boxes ``(i, j)`` and ``(ii, jj)`` in ``self``
267+
are attacking.
264268
265269
EXAMPLES::
266270
@@ -476,24 +480,30 @@ def inversions(self):
476480
return res
477481

478482
def _inv_aux(self):
479-
"""
483+
r"""
480484
EXAMPLES::
481485
482486
sage: a = AugmentedLatticeDiagramFilling([[1,6],[2],[3,4,2],[],[],[5,5]])
483487
sage: a._inv_aux()
484488
7
489+
490+
sage: data = [[1,6],[],[3,4,2],[5,5]]
491+
sage: [AugmentedLatticeDiagramFilling(data, pi=pi)._inv_aux()
492+
....: for pi in Permutations(4)]
493+
[4, 4, 3, 3, 2, 2, 4, 4, 2, 2, 1, 1,
494+
3, 3, 2, 2, 0, 0, 2, 2, 1, 1, 0, 0]
485495
"""
486496
res = 0
487497
shape = self.shape()
488498
for i in range(1, len(self) + 1):
489-
for j in range(i + 1, len(self) + 1):
490-
if shape[i] <= shape[j]:
491-
res += 1
499+
a = self._list[i-1][0]
500+
res += sum(1 for j in range(i + 1, len(self) + 1)
501+
if shape[i] <= shape[j] and a < self._list[j-1][0])
492502
return res
493503

494504
def inv(self):
495-
"""
496-
Return ``self``'s inversion statistic.
505+
r"""
506+
Return the inversion statistic of ``self``.
497507
498508
EXAMPLES::
499509
@@ -508,7 +518,7 @@ def inv(self):
508518

509519
def coinv(self):
510520
"""
511-
Return ``self``'s co-inversion statistic.
521+
Return the co-inversion statistic of ``self``.
512522
513523
EXAMPLES::
514524
@@ -520,10 +530,10 @@ def coinv(self):
520530
return sum(shape.a(i, j) for i, j in shape.boxes()) - self.inv()
521531

522532
def coeff(self, q, t):
523-
"""
533+
r"""
524534
Return the coefficient in front of ``self`` in the HHL formula for the
525535
expansion of the non-symmetric Macdonald polynomial
526-
E(self.shape()).
536+
``E(self.shape())``.
527537
528538
EXAMPLES::
529539
@@ -532,19 +542,15 @@ def coeff(self, q, t):
532542
sage: a.coeff(q,t) # needs sage.symbolic
533543
(t - 1)^4/((q^2*t^3 - 1)^2*(q*t^2 - 1)^2)
534544
"""
535-
res = 1
536545
shape = self.shape()
537-
for i, j in shape.boxes():
538-
if self[i, j] != self[i, j - 1]:
539-
res *= (1 - t) / (1 - q**(shape.l(i, j) + 1)
540-
* t**(shape.a(i, j) + 1))
541-
return res
546+
return prod((1 - t) / (1 - q**(shape.l(i, j) + 1) * t**(shape.a(i, j) + 1))
547+
for i, j in shape.boxes() if self[i, j] != self[i, j - 1])
542548

543549
def coeff_integral(self, q, t):
544-
"""
550+
r"""
545551
Return the coefficient in front of ``self`` in the HHL formula for the
546552
expansion of the integral non-symmetric Macdonald polynomial
547-
E(self.shape())
553+
``E(self.shape())``.
548554
549555
EXAMPLES::
550556
@@ -565,24 +571,26 @@ def coeff_integral(self, q, t):
565571

566572
def permuted_filling(self, sigma):
567573
"""
574+
Return the filling given by permuting the entries of ``self``
575+
by ``sigma``.
576+
568577
EXAMPLES::
569578
570-
sage: pi=Permutation([2,1,4,3]).to_permutation_group_element()
571-
sage: fill=[[2],[1,2,3],[],[3,1]]
579+
sage: pi = Permutation([2,1,4,3]).to_permutation_group_element()
580+
sage: fill = [[2],[1,2,3],[],[3,1]]
572581
sage: AugmentedLatticeDiagramFilling(fill).permuted_filling(pi)
573582
[[2, 1], [1, 2, 1, 4], [4], [3, 4, 2]]
574583
"""
575584
new_filling = []
576585
for col in self:
577-
nc = [sigma(x) for x in col]
578-
nc.pop(0)
586+
nc = [sigma(x) for x in col[1:]]
579587
new_filling.append(nc)
580588
return AugmentedLatticeDiagramFilling(new_filling, sigma)
581589

582590

583591
def NonattackingFillings(shape, pi=None):
584592
"""
585-
Returning the finite set of nonattacking fillings of a
593+
Return the finite set of nonattacking fillings of a
586594
given shape.
587595
588596
EXAMPLES::
@@ -617,17 +625,16 @@ def __init__(self, shape, pi=None):
617625
"""
618626
self.pi = pi
619627
self._shape = LatticeDiagram(shape)
620-
self._name = "Nonattacking fillings of %s" % list(shape)
621628
Parent.__init__(self, category=FiniteEnumeratedSets())
622629

623-
def __repr__(self):
630+
def _repr_(self):
624631
"""
625632
EXAMPLES::
626633
627634
sage: NonattackingFillings([0,1,2])
628635
Nonattacking fillings of [0, 1, 2]
629636
"""
630-
return self._name
637+
return "Nonattacking fillings of %s" % list(self._shape)
631638

632639
def flip(self):
633640
"""
@@ -830,7 +837,7 @@ def _check_muqt(mu, q, t, pi=None):
830837

831838

832839
def E(mu, q=None, t=None, pi=None):
833-
"""
840+
r"""
834841
Return the non-symmetric Macdonald polynomial in type A
835842
corresponding to a shape ``mu``, with basement permuted according to
836843
``pi``.
@@ -872,21 +879,36 @@ def E(mu, q=None, t=None, pi=None):
872879
x0^2 + (q*t - q)/(q*t - 1)*x0*x1 + (q*t - q)/(q*t - 1)*x0*x2
873880
sage: E([0,2,0])
874881
(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
882+
883+
sage: [E([1,0,1], pi=pi) for pi in Permutations(3)]
884+
[(t - 1)/(q*t^2 - 1)*x0*x1 + x0*x2,
885+
x0*x1 + (q*t^2 - q*t)/(q*t^2 - 1)*x0*x2,
886+
(t^2 - t)/(q*t^2 - 1)*x0*x1 + x1*x2,
887+
x0*x1 + (q*t - q)/(q*t^2 - 1)*x1*x2,
888+
(t - 1)/(q*t^2 - 1)*x0*x2 + x1*x2,
889+
x0*x2 + (q*t^2 - q*t)/(q*t^2 - 1)*x1*x2]
890+
891+
TESTS::
892+
893+
sage: from sage.combinat.sf.ns_macdonald import E
894+
sage: E([]).parent()
895+
Multivariate Polynomial Ring in no variables over Fraction Field
896+
of Multivariate Polynomial Ring in q, t over Rational Field
875897
"""
876898
P, q, t, n, R, x = _check_muqt(mu, q, t, pi)
877-
res = 0
899+
res = R.zero()
878900
for a in n:
879901
weight = a.weight()
880902
res += q**a.maj() * t**a.coinv() * a.coeff(q, t) * prod(x[i]**weight[i] for i in range(len(weight)))
881903
return res
882904

883905

884906
def E_integral(mu, q=None, t=None, pi=None):
885-
"""
907+
r"""
886908
Return the integral form for the non-symmetric Macdonald
887909
polynomial in type A corresponding to a shape mu.
888910
889-
Note that if both q and t are specified, then they must have the
911+
Note that if both `q` and `t` are specified, then they must have the
890912
same parent.
891913
892914
REFERENCE:
@@ -916,17 +938,32 @@ def E_integral(mu, q=None, t=None, pi=None):
916938
(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
917939
sage: E_integral([0,2,0])
918940
(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
941+
942+
sage: [E_integral([1,0,1], pi=pi) for pi in Permutations(3)]
943+
[(q*t^3 - q*t^2 - t + 1)*x0*x1 + (t^2 - 2*t + 1)*x0*x2,
944+
(t^2 - 2*t + 1)*x0*x1 + (q^2*t^4 - q^2*t^3 - q*t^2 + q*t)*x0*x2,
945+
(q*t^4 - q*t^3 - t^2 + t)*x0*x1 + (t^2 - 2*t + 1)*x1*x2,
946+
(t^2 - 2*t + 1)*x0*x1 + (q^2*t^3 - q^2*t^2 - q*t + q)*x1*x2,
947+
(q*t^3 - q*t^2 - t + 1)*x0*x2 + (t^2 - 2*t + 1)*x1*x2,
948+
(t^2 - 2*t + 1)*x0*x2 + (q^2*t^4 - q^2*t^3 - q*t^2 + q*t)*x1*x2]
949+
950+
TESTS::
951+
952+
sage: from sage.combinat.sf.ns_macdonald import E_integral
953+
sage: E_integral([]).parent()
954+
Multivariate Polynomial Ring in no variables over Fraction Field
955+
of Multivariate Polynomial Ring in q, t over Rational Field
919956
"""
920957
P, q, t, n, R, x = _check_muqt(mu, q, t, pi)
921-
res = 0
958+
res = R.zero()
922959
for a in n:
923960
weight = a.weight()
924961
res += q**a.maj() * t**a.coinv() * a.coeff_integral(q, t) * prod(x[i]**weight[i] for i in range(len(weight)))
925962
return res
926963

927964

928965
def Ht(mu, q=None, t=None, pi=None):
929-
"""
966+
r"""
930967
Return the symmetric Macdonald polynomial using the Haiman,
931968
Haglund, and Loehr formula.
932969
@@ -951,9 +988,16 @@ def Ht(mu, q=None, t=None, pi=None):
951988
x0^2 + (q + 1)*x0*x1 + x1^2 + (q + 1)*x0*x2 + (q + 1)*x1*x2 + x2^2
952989
sage: HHt([2]).expand(3)
953990
x0^2 + (q + 1)*x0*x1 + x1^2 + (q + 1)*x0*x2 + (q + 1)*x1*x2 + x2^2
991+
992+
TESTS::
993+
994+
sage: from sage.combinat.sf.ns_macdonald import Ht
995+
sage: Ht([]).parent()
996+
Multivariate Polynomial Ring in no variables over Fraction Field
997+
of Multivariate Polynomial Ring in q, t over Rational Field
954998
"""
955999
P, q, t, n, R, x = _check_muqt(mu, q, t, pi)
956-
res = 0
1000+
res = R.zero()
9571001
for a in n:
9581002
weight = a.weight()
9591003
res += q**a.maj() * t**a.inv() * prod(x[i]**weight[i] for i in range(len(weight)))

0 commit comments

Comments
 (0)