Contact
CoCalc Logo Icon
StoreFeaturesDocsShareSupport News AboutSign UpSign In
| Download
Project: SageDays78
Views: 431

Intro to research based coding in Sage

Create the set (list?) of 3x3 alternating sign matrices

A3 = AlternatingSignMatrices(3)
A3

Use a for loop to display all the 3x3 alternating sign matrices

for a in A3: print a
#tab complete and define 4x4 alternating sign matrices A4 = Altern

unrank(28) gives us the 28th (starting at 0) alternating sign matrix in A4

asm = A4.unrank(28); asm
asm.height_function()

In the below block, put your cursor at the end and hit tab to see what alternating sign matrix methods start with 'to'

asm.to
asm.to_fully_packed_loop()
asm
asm.gyration()
asm.gyration??
animate(a2.to_fully_packed_loop() for a2 in asm.gyration_orbit())

Construct the lattice of 4x4 alternating sign matrices

l4 = A4.lattice()
l4.cardinality()
l4.plot(label_elements = False)
j4 = l4.join_irreducibles_poset()
plot(j4)

Construct the same poset using the tetrahedral poset code, then test it is isomorphic to our previous construction

a4 = posets.TetrahedralPoset(4, 'green','yellow','blue','orange') a4.is_isomorphic(j4)

Construct the TSSCPP tetrahedral poset

t4 = posets.TetrahedralPoset(4, 'green','yellow','red','orange') t4.plot()
oit4 = t4.order_ideals_lattice() oit4.cardinality()
ll = [len(orb) for orb in j4.rowmotion_orbits()]
sorted(ll)
A4.gyration_orbit_sizes()
def row_gyr_orb_size(n): A = AlternatingSignMatrices(n) lat = A.lattice() j = lat.join_irreducibles_poset() rowlist = [len(orb) for orb in j.rowmotion_orbits()] rowlist = sorted(rowlist) gyrlist = A.gyration_orbit_sizes() gyrlist.sort() print gyrlist return rowlist==gyrlist
for i in [1..5]: row_gyr_orb_size(i)
myasm = AlternatingSignMatrix([[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 1, 0, 0, 0, -1, 0, 1, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 1, -1, 0, 0, 0, 0, 1, -1, 1, 0, 0, 0, 0, 0, 0], [0, 0, 0,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ck_word(algorithm = 'last_diagonal')
print(ld)
lp = myasm.to_dyck_word??
type(lp)
myasm.to_monotone_triangle().pp()
myasm.to_fully_packed_loop()
myasm.
print(fpl)
def random_asm(n): toprow = [n-i for i in range(n)] gt = GelfandTsetlinPatterns(top_row = toprow, strict = True) randomgt = gt.random_element() A = AlternatingSignMatrices(n) return A.from_monotone_triangle(randomgt)
random_asm(14)