{{{id=1| ## Calculate the Hamming distance between two lists of equal length, ## that is, the number of entries in which they differ. def HammingDistance(A,B): h = 0 for i in range(len(A)): if A[i] != B[i]: h = h+1 return h ## Constructs the simplicial rook graph SR(d,n) whose vertices are lattice points ## in the nth dilate of the standard simplex in R^n, with two vertices ## adjacent iff their Hamming distance is 2. ## This graph has binomial(n+d-1, d-1) vertices and is regular of degree (d-1)n. def SimplicialRookGraph(d,n): V = [p for p in IntegerListsLex(n, length=d)] G = Graph() for i in range(len(V)): for j in range(len(V)): if HammingDistance(V[i],V[j]) == 2: G.add_edge(i,j) return G ## Calculates the spectrum (i.e., list of eigenvalues) of SR(d,n). ## The spectrum is integral for d=3 and we (Jeremy Martin and Jennifer Wagner) ## conjecture that it is integral for all d and n. def SR_Spectrum(d,n): return SimplicialRookGraph(d,n).adjacency_matrix().eigenvalues() ## What follows is some data, in the form of generating functions for eigenvalues. /// }}} {{{id=507| q = var('q') d = 3 for n in range(10): print(n, add(q^x for x in Spectrum(d,n))) /// (0, 0) (1, q^2 + 2/q) (2, q^4 + 2/q^2 + 3) (3, q^6 + 3*q + 3/q^2 + 1/q^3 + 2) (4, q^8 + 3*q^2 + 3*q + 2/q + 3/q^2 + 3/q^3) (5, q^10 + 3*q^3 + 3*q^2 + 2*q + 3/q + 3/q^2 + 6/q^3) (6, q^12 + 3*q^4 + 3*q^3 + 3*q^2 + 3/q + 3/q^2 + 10/q^3 + 2) (7, q^14 + 3*q^5 + 3*q^4 + 3*q^3 + 2*q^2 + 3/q + 3/q^2 + 15/q^3 + 3) (8, q^16 + 3*q^6 + 3*q^5 + 3*q^4 + 3*q^3 + 2*q + 3/q + 3/q^2 + 21/q^3 + 3) (9, q^18 + 3*q^7 + 3*q^6 + 3*q^5 + 3*q^4 + 2*q^3 + 3*q + 3/q + 3/q^2 + 28/q^3 + 3) }}} {{{id=504| q = var('q') d = 4 for n in range(10): print(n, add(q^x for x in Spectrum(d,n))) /// (0, 0) (1, q^3 + 3/q) (2, q^6 + 4*q + 5/q^2) (3, q^9 + 4*q^3 + 3*q + 6/q + 6/q^3) (4, q^12 + 4*q^5 + 4*q^3 + 6/q^2 + 4/q^3 + 5/q^4 + 11) (5, q^15 + 4*q^7 + 4*q^5 + 3*q^3 + 12*q + 9/q + 8/q^2 + 4/q^3 + 8/q^4 + 3/q^5) (6, q^18 + 4*q^9 + 4*q^7 + 4*q^5 + 17*q^2 + 16/q + 3/q^2 + 12/q^3 + 8/q^4 + 8/q^5 + 1/q^6 + 6) (7, q^21 + 4*q^11 + 4*q^9 + 4*q^7 + 3*q^5 + 18*q^3 + 9*q + 18/q + 21/q^3 + 8/q^4 + 14/q^5 + 4/q^6 + 12) (8, q^24 + 4*q^13 + 4*q^11 + 4*q^9 + 4*q^7 + 23*q^4 + 6*q^2 + 16*q + 12/q + 8/q^2 + 24/q^3 + 11/q^4 + 20/q^5 + 10/q^6 + 18) (9, q^27 + 4*q^15 + 4*q^13 + 4*q^11 + 4*q^9 + 3*q^7 + 24*q^5 + 9*q^3 + 12*q^2 + 22*q + 7/q + 20/q^2 + 24/q^3 + 16/q^4 + 26/q^5 + 20/q^6 + 20) }}} {{{id=505| d = 5 for n in range(10): print(n, add(q^x for x in Spectrum(d,n))) /// (0, 0) (1, q^4 + 4/q) (2, q^8 + 5*q^2 + 9/q^2) (3, q^12 + 5*q^5 + 4*q^2 + 15/q^3 + 10) (4, q^16 + 5*q^8 + 5*q^5 + 10*q^2 + 9*q + 10/q + 10/q^2 + 20/q^4) (5, q^20 + 5*q^11 + 5*q^8 + 4*q^5 + 10*q^4 + 10*q^3 + 10*q + 25/q + 20/q^3 + 5/q^4 + 22/q^5 + 9) (6, q^24 + 5*q^14 + 5*q^11 + 5*q^8 + 10*q^6 + 10*q^5 + 9*q^4 + 10*q^3 + 30*q + 10/q + 45/q^2 + 25/q^4 + 15/q^5 + 20/q^6 + 10) (7, q^28 + 5*q^17 + 5*q^14 + 5*q^11 + 14*q^8 + 10*q^7 + 10*q^6 + 10*q^5 + 29*q^3 + 10*q^2 + 35*q + 55/q + 16/q^2 + 35/q^3 + 25/q^4 + 25/q^5 + 25/q^6 + 15/q^7) (8, q^32 + 5*q^20 + 5*q^17 + 5*q^14 + 5*q^11 + 10*q^10 + 10*q^9 + 10*q^8 + 19*q^7 + 20*q^5 + 10*q^4 + 40*q^3 + 14*q^2 + 15*q + 25/q + 20/q^2 + 72/q^3 + 15/q^4 + 55/q^5 + 25/q^6 + 30/q^7 + 9/q^8 + 75) (9, q^36 + 5*q^23 + 5*q^20 + 5*q^17 + 5*q^14 + 10*q^12 + 14*q^11 + 10*q^10 + 20*q^9 + 20*q^7 + 9*q^6 + 40*q^5 + 10*q^4 + 45*q^3 + 5*q^2 + 86*q + 40/q + 50/q^2 + 65/q^3 + 51/q^4 + 60/q^5 + 45/q^6 + 40/q^7 + 25/q^8 + 4/q^9 + 45) }}} {{{id=506| /// }}}