Contact
CoCalc Logo Icon
StoreFeaturesDocsShareSupport News AboutSign UpSign In
| Download

All published worksheets from http://sagenb.org

Views: 168742
Image: ubuntu2004
def invpoly2(w): bb=Permutation(w).bruhat_smaller().list() rangelist=range(len(bb)) p=0 for i in rangelist: p=p+x^(binomial(len(w),2)-len(Permutation(bb[i]).inversions())) return p
def invpoly(w): bb=Permutation(w).bruhat_smaller().list() rangelist=range(len(bb)) p=0 for i in rangelist: p=p+x^len(Permutation(bb[i]).inversions()) return p
invpoly([3,5,1,2,4])
x^5 + 5*x^4 + 9*x^3 + 8*x^2 + 4*x + 1
invpoly([4,2,5,1,3])
x^6 + 5*x^5 + 11*x^4 + 13*x^3 + 9*x^2 + 4*x + 1
P5=Permutations([1,2,3,4,5])
r=range(len(P5.list()))
for i in r: if len(Permutation(P5[i]).inversions())==6: invpoly(P5[i])
x^6 + 3*x^5 + 5*x^4 + 6*x^3 + 5*x^2 + 3*x + 1 x^6 + 4*x^5 + 8*x^4 + 10*x^3 + 8*x^2 + 4*x + 1 x^6 + 5*x^5 + 10*x^4 + 11*x^3 + 8*x^2 + 4*x + 1 x^6 + 4*x^5 + 8*x^4 + 10*x^3 + 8*x^2 + 4*x + 1 x^6 + 4*x^5 + 8*x^4 + 10*x^3 + 8*x^2 + 4*x + 1 x^6 + 4*x^5 + 8*x^4 + 10*x^3 + 8*x^2 + 4*x + 1 x^6 + 6*x^5 + 12*x^4 + 13*x^3 + 9*x^2 + 4*x + 1 x^6 + 5*x^5 + 11*x^4 + 13*x^3 + 9*x^2 + 4*x + 1 x^6 + 4*x^5 + 8*x^4 + 10*x^3 + 8*x^2 + 4*x + 1 x^6 + 4*x^5 + 8*x^4 + 10*x^3 + 8*x^2 + 4*x + 1 x^6 + 5*x^5 + 10*x^4 + 11*x^3 + 8*x^2 + 4*x + 1 x^6 + 5*x^5 + 11*x^4 + 13*x^3 + 9*x^2 + 4*x + 1 x^6 + 4*x^5 + 8*x^4 + 10*x^3 + 8*x^2 + 4*x + 1 x^6 + 3*x^5 + 5*x^4 + 6*x^3 + 5*x^2 + 3*x + 1 x^6 + 6*x^5 + 12*x^4 + 13*x^3 + 9*x^2 + 4*x + 1 x^6 + 5*x^5 + 10*x^4 + 11*x^3 + 8*x^2 + 4*x + 1 x^6 + 4*x^5 + 8*x^4 + 10*x^3 + 8*x^2 + 4*x + 1 x^6 + 4*x^5 + 8*x^4 + 10*x^3 + 8*x^2 + 4*x + 1 x^6 + 5*x^5 + 10*x^4 + 11*x^3 + 8*x^2 + 4*x + 1 x^6 + 4*x^5 + 8*x^4 + 10*x^3 + 8*x^2 + 4*x + 1
p=invpoly2([5,3,6,4,1,2])
len(Permutation([5,6,3,4,1,2]).inversions())
12
P6=Permutations([1,2,3,4,5,6])
r2=range(len(P6.list()))
for i in r2: if len(Permutation(P6[i]).inversions())==12 and invpoly2(P6[i])==p1: print(P6[i])
for i in r2: if invpoly2(P6[i])==pp: print(P6[i])
[4, 6, 3, 5, 1, 2] [5, 3, 6, 4, 1, 2] [5, 6, 2, 4, 1, 3] [5, 6, 3, 1, 4, 2]
invpoly2([5,6,3,4,1,2])
x^15 + 5*x^14 + 14*x^13 + 29*x^12 + 49*x^11 + 69*x^10 + 82*x^9 + 83*x^8 + 71*x^7 + 50*x^6 + 26*x^5 + 8*x^4 + x^3
p1=1+4*x+14*x^2+68*x^7+49*x^8+29*x^9+14*x^10+x^12+5*x^11+33*x^3+78*x^6+74*x^5+56*x^4
pp=invpoly2([5,3,6,4,1,2])