@@ -60,7 +60,7 @@ def __getitem__(self, i):
60
60
61
61
def leg (self , i , j ):
62
62
"""
63
- Return the leg of the box ``(i,j)`` in ``self``.
63
+ Return the leg of the box ``(i, j)`` in ``self``.
64
64
65
65
EXAMPLES::
66
66
@@ -72,7 +72,7 @@ def leg(self, i, j):
72
72
73
73
def arm_left (self , i , j ):
74
74
"""
75
- Return the left arm of the box ``(i,j)`` in ``self``.
75
+ Return the left arm of the box ``(i, j)`` in ``self``.
76
76
77
77
EXAMPLES::
78
78
@@ -84,7 +84,7 @@ def arm_left(self, i, j):
84
84
85
85
def arm_right (self , i , j ):
86
86
"""
87
- Return the right arm of the box ``(i,j)`` in ``self``.
87
+ Return the right arm of the box ``(i, j)`` in ``self``.
88
88
89
89
EXAMPLES::
90
90
@@ -97,7 +97,7 @@ def arm_right(self, i, j):
97
97
98
98
def arm (self , i , j ):
99
99
"""
100
- Return the arm of the box ``(i,j)`` in ``self``.
100
+ Return the arm of the box ``(i, j)`` in ``self``.
101
101
102
102
EXAMPLES::
103
103
@@ -121,7 +121,7 @@ def l(self, i, j):
121
121
122
122
def a (self , i , j ):
123
123
"""
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``.
125
125
126
126
EXAMPLES::
127
127
@@ -144,9 +144,11 @@ def size(self):
144
144
return sum (self ._list )
145
145
146
146
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]``.
150
152
151
153
EXAMPLES::
152
154
@@ -243,24 +245,26 @@ def shape(self):
243
245
for i in range (1 , len (self ) + 1 )])
244
246
245
247
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.
249
252
250
253
EXAMPLES::
251
254
252
255
sage: a = AugmentedLatticeDiagramFilling([[1,6],[2],[3,4,2],[],[],[5,5]])
253
- sage: (1,1) in a
256
+ sage: (1, 1) in a
254
257
True
255
- sage: (1,0) in a
258
+ sage: (1, 0) in a
256
259
False
257
260
"""
258
261
i , j = ij
259
262
return 0 < i <= len (self ) and 0 < j <= len (self [i ])
260
263
261
264
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.
264
268
265
269
EXAMPLES::
266
270
@@ -476,24 +480,30 @@ def inversions(self):
476
480
return res
477
481
478
482
def _inv_aux (self ):
479
- """
483
+ r """
480
484
EXAMPLES::
481
485
482
486
sage: a = AugmentedLatticeDiagramFilling([[1,6],[2],[3,4,2],[],[],[5,5]])
483
487
sage: a._inv_aux()
484
488
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]
485
495
"""
486
496
res = 0
487
497
shape = self .shape ()
488
498
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 ])
492
502
return res
493
503
494
504
def inv (self ):
495
- """
496
- Return ``self``'s inversion statistic .
505
+ r """
506
+ Return the inversion statistic of ``self``.
497
507
498
508
EXAMPLES::
499
509
@@ -508,7 +518,7 @@ def inv(self):
508
518
509
519
def coinv (self ):
510
520
"""
511
- Return ``self``'s co-inversion statistic.
521
+ Return the co-inversion statistic of ``self`` .
512
522
513
523
EXAMPLES::
514
524
@@ -520,10 +530,10 @@ def coinv(self):
520
530
return sum (shape .a (i , j ) for i , j in shape .boxes ()) - self .inv ()
521
531
522
532
def coeff (self , q , t ):
523
- """
533
+ r """
524
534
Return the coefficient in front of ``self`` in the HHL formula for the
525
535
expansion of the non-symmetric Macdonald polynomial
526
- E(self.shape()).
536
+ `` E(self.shape())`` .
527
537
528
538
EXAMPLES::
529
539
@@ -532,19 +542,15 @@ def coeff(self, q, t):
532
542
sage: a.coeff(q,t) # needs sage.symbolic
533
543
(t - 1)^4/((q^2*t^3 - 1)^2*(q*t^2 - 1)^2)
534
544
"""
535
- res = 1
536
545
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 ])
542
548
543
549
def coeff_integral (self , q , t ):
544
- """
550
+ r """
545
551
Return the coefficient in front of ``self`` in the HHL formula for the
546
552
expansion of the integral non-symmetric Macdonald polynomial
547
- E(self.shape())
553
+ `` E(self.shape())``.
548
554
549
555
EXAMPLES::
550
556
@@ -565,24 +571,26 @@ def coeff_integral(self, q, t):
565
571
566
572
def permuted_filling (self , sigma ):
567
573
"""
574
+ Return the filling given by permuting the entries of ``self``
575
+ by ``sigma``.
576
+
568
577
EXAMPLES::
569
578
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]]
572
581
sage: AugmentedLatticeDiagramFilling(fill).permuted_filling(pi)
573
582
[[2, 1], [1, 2, 1, 4], [4], [3, 4, 2]]
574
583
"""
575
584
new_filling = []
576
585
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 :]]
579
587
new_filling .append (nc )
580
588
return AugmentedLatticeDiagramFilling (new_filling , sigma )
581
589
582
590
583
591
def NonattackingFillings (shape , pi = None ):
584
592
"""
585
- Returning the finite set of nonattacking fillings of a
593
+ Return the finite set of nonattacking fillings of a
586
594
given shape.
587
595
588
596
EXAMPLES::
@@ -617,17 +625,16 @@ def __init__(self, shape, pi=None):
617
625
"""
618
626
self .pi = pi
619
627
self ._shape = LatticeDiagram (shape )
620
- self ._name = "Nonattacking fillings of %s" % list (shape )
621
628
Parent .__init__ (self , category = FiniteEnumeratedSets ())
622
629
623
- def __repr__ (self ):
630
+ def _repr_ (self ):
624
631
"""
625
632
EXAMPLES::
626
633
627
634
sage: NonattackingFillings([0,1,2])
628
635
Nonattacking fillings of [0, 1, 2]
629
636
"""
630
- return self ._name
637
+ return "Nonattacking fillings of %s" % list ( self ._shape )
631
638
632
639
def flip (self ):
633
640
"""
@@ -830,7 +837,7 @@ def _check_muqt(mu, q, t, pi=None):
830
837
831
838
832
839
def E (mu , q = None , t = None , pi = None ):
833
- """
840
+ r """
834
841
Return the non-symmetric Macdonald polynomial in type A
835
842
corresponding to a shape ``mu``, with basement permuted according to
836
843
``pi``.
@@ -872,21 +879,36 @@ def E(mu, q=None, t=None, pi=None):
872
879
x0^2 + (q*t - q)/(q*t - 1)*x0*x1 + (q*t - q)/(q*t - 1)*x0*x2
873
880
sage: E([0,2,0])
874
881
(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
875
897
"""
876
898
P , q , t , n , R , x = _check_muqt (mu , q , t , pi )
877
- res = 0
899
+ res = R . zero ()
878
900
for a in n :
879
901
weight = a .weight ()
880
902
res += q ** a .maj () * t ** a .coinv () * a .coeff (q , t ) * prod (x [i ]** weight [i ] for i in range (len (weight )))
881
903
return res
882
904
883
905
884
906
def E_integral (mu , q = None , t = None , pi = None ):
885
- """
907
+ r """
886
908
Return the integral form for the non-symmetric Macdonald
887
909
polynomial in type A corresponding to a shape mu.
888
910
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
890
912
same parent.
891
913
892
914
REFERENCE:
@@ -916,17 +938,32 @@ def E_integral(mu, q=None, t=None, pi=None):
916
938
(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
917
939
sage: E_integral([0,2,0])
918
940
(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
919
956
"""
920
957
P , q , t , n , R , x = _check_muqt (mu , q , t , pi )
921
- res = 0
958
+ res = R . zero ()
922
959
for a in n :
923
960
weight = a .weight ()
924
961
res += q ** a .maj () * t ** a .coinv () * a .coeff_integral (q , t ) * prod (x [i ]** weight [i ] for i in range (len (weight )))
925
962
return res
926
963
927
964
928
965
def Ht (mu , q = None , t = None , pi = None ):
929
- """
966
+ r """
930
967
Return the symmetric Macdonald polynomial using the Haiman,
931
968
Haglund, and Loehr formula.
932
969
@@ -951,9 +988,16 @@ def Ht(mu, q=None, t=None, pi=None):
951
988
x0^2 + (q + 1)*x0*x1 + x1^2 + (q + 1)*x0*x2 + (q + 1)*x1*x2 + x2^2
952
989
sage: HHt([2]).expand(3)
953
990
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
954
998
"""
955
999
P , q , t , n , R , x = _check_muqt (mu , q , t , pi )
956
- res = 0
1000
+ res = R . zero ()
957
1001
for a in n :
958
1002
weight = a .weight ()
959
1003
res += q ** a .maj () * t ** a .inv () * prod (x [i ]** weight [i ] for i in range (len (weight )))
0 commit comments