On Thursday, 14 May 2015 04:06:16 UTC+1, Phoenix wrote: > > > This is really weird that SAGE output that I copy pasted here can't be > copy-pasted back into SAGE as an input! >
no, not at all. It's very typical that the human-readable output (e.g. think of formulae with indices, inegrals, etc) is not the same as machine-readable output > > So here it is again written differently! > > rep = [ matrix ([[1, 0, 0, 0], [0, 0, 0, 1], [0, 1, 0, 0], [0, 0, 1, 0]] > ), matrix ([[1, 0, 0, 0], [0, 0, 0, 1], [0, 0, 1, 0], [0, 1, 0, 0]] ) , > matrix ([[1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 0, 1], [0, 0, 1, 0]] ) , > matrix ( [[1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]] ) , > matrix ( [[1, 0, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1], [0, 1, 0, 0]]) , > matrix ([[1, 0, 0, 0], [0, 0, 1, 0], [0, 1, 0, 0], [0, 0, 0, 1]] ) ] > > > Edge = [(0, 2), (0, 3), (1, 2), (1, 3)] > > > > > BTW, just curious : isn't there a way by which you could have just randomly > generated a set of q^3 permutation matrices each of dimension q^2 instead of > looking for a specific example? Can't SAGE randomly generate one such set? > > > > > > > > > > > > > > > > > > > > > > > > On Wednesday, May 13, 2015 at 9:03:31 PM UTC-5, David Joyner wrote: >> >> On Wed, May 13, 2015 at 9:54 PM, Phoenix <[email protected]> wrote: >> > >> > >> > For the q=2 , n =2 (the smallest test case) we have, >> > >> > Edge = [(0, 2), (0, 3), (1, 2), (1, 3)] >> > >> > rep = >> > >> > [ >> > [1 0 0 0] [1 0 0 0] [1 0 0 0] [1 0 0 0] [1 0 0 0] [1 0 0 0] >> > [0 0 1 0] [0 0 1 0] [0 1 0 0] [0 1 0 0] [0 0 0 1] [0 0 0 1] >> > [0 1 0 0] [0 0 0 1] [0 0 1 0] [0 0 0 1] [0 0 1 0] [0 1 0 0] >> > [0 0 0 1], [0 1 0 0], [0 0 0 1], [0 0 1 0], [0 1 0 0], [0 0 1 0] >> > ] >> > >> > >> >> This cannot be copy+pasted into Sage. >> Please type it in so that someone who wants to help you can copy+paste. >> >> > >> > >> > >> > >> > >> > >> > >> > >> > >> > >> > >> > >> > On Wednesday, May 13, 2015 at 8:51:08 PM UTC-5, David Joyner wrote: >> >> >> >> On Wed, May 13, 2015 at 9:43 PM, Phoenix <[email protected]> >> wrote: >> >> > >> >> > I am not sure how to include "rep". >> >> >> >> Can you type in a short example of what it could be? >> >> >> >> > Its a list generated by a set of operations somewhere else. >> >> > I am generating "Edge" by extracting the edges of the graph K_{n,n} >> >> > >> >> >> >> Can you type in a short example of what it could be? >> >> >> >> > >> >> > >> >> > >> >> > On Wednesday, May 13, 2015 at 8:28:57 PM UTC-5, David Joyner wrote: >> >> >> >> >> >> On Wed, May 13, 2015 at 9:13 PM, Phoenix <[email protected]> >> wrote: >> >> >> > >> >> >> > >> >> >> > So I have this SAGE code which takes in two integers q and n and >> it >> >> >> > generates ~ (q^3)^(n^2) 0/1 matrices and does a sum of their >> >> >> > characteristic >> >> >> > polynomials. >> >> >> > >> >> >> > I got answers for (q = 3, n = 2), (q =2 , n = 3) and (q=2, n=2) >> >> >> > >> >> >> > For any higher number the code runs for ~1hr and then it says, >> >> >> > >> >> >> > " >> >> >> > >> >> >> > Traceback (most recent call last): >> >> >> > File "<stdin>", line 1, in <module> >> >> >> > File "_sage_input_2.py", line 10, in <module> >> >> >> > exec compile(u'open("___code___.py","w").write("# -*- coding: >> >> >> > utf-8 >> >> >> > -*-\\n" + >> >> >> > >> >> >> > >> >> >> > >> _support_.preparse_worksheet_cell(base64.b64decode("UA=="),globals())+"\\n"); >> >> >> >> >> > execfile(os.path.abspath("___code___.py")) >> >> >> > File "", line 1, in <module> >> >> >> > >> >> >> > File "/tmp/tmpPiPIoq/___code___.py", line 2, in <module> >> >> >> > exec compile(u'P >> >> >> > File "", line 1, in <module> >> >> >> > >> >> >> > " >> >> >> > >> >> >> > >> >> >> > Can someone help understand what is going on? >> >> >> > >> >> >> > Like any suggestion about how to go about it? >> >> >> > >> >> >> > >> >> >> > >> >> >> > EDIT: >> >> >> > >> >> >> > This is basically the main time-consuming step. >> >> >> > >> >> >> > At this point "rep" comes in as a ~q^3 size list of q^2 >> dimensional >> >> >> > 0/1 >> >> >> > permutation matrices. >> >> >> > And "Edge" is a list of integer tuples where each tuple is of the >> >> >> > form >> >> >> > (a,b) >> >> >> > with a,b being from the set {0,1,2,3...,(2n-1)} >> >> >> > >> >> >> > P = 0 >> >> >> > from itertools import product >> >> >> > from itertools import izip >> >> >> > >> >> >> > for X in product(rep,repeat = len (Edge)): >> >> >> > k = izip(Edge,X) >> >> >> > M = [[matrix(q^2, q^2, 0)]*(2*n) for _ in range(2*n)] >> >> >> > for ((a,b),Y) in k: >> >> >> > M [a][b] = Y >> >> >> > M [b][a] = Y.inverse() >> >> >> > Z = block_matrix(M) >> >> >> > P = P + Z.charpoly(x) >> >> >> > >> >> >> >> >> >> Please include rep and Edge, if if it's in a simple case. >> >> >> >> >> >> >> >> >> > The polynomial P is the final expected answer. >> >> >> > >> >> >> > (and for any larger value of q and n than the 3 cases mentioned >> the >> >> >> > program >> >> >> > basically stops with no output for P and with the above pasted >> >> >> > message) >> >> >> > >> >> >> > -- >> >> >> > You received this message because you are subscribed to the >> Google >> >> >> > Groups >> >> >> > "sage-support" group. >> >> >> > To unsubscribe from this group and stop receiving emails from it, >> >> >> > send >> >> >> > an >> >> >> > email to [email protected]. >> >> >> > To post to this group, send email to [email protected]. >> >> >> > Visit this group at http://groups.google.com/group/sage-support. >> >> >> > For more options, visit https://groups.google.com/d/optout. >> >> > >> >> > -- >> >> > You received this message because you are subscribed to the Google >> >> > Groups >> >> > "sage-support" group. >> >> > To unsubscribe from this group and stop receiving emails from it, >> send >> >> > an >> >> > email to [email protected]. >> >> > To post to this group, send email to [email protected]. >> >> > Visit this group at http://groups.google.com/group/sage-support. >> >> > For more options, visit https://groups.google.com/d/optout. >> > >> > -- >> > You received this message because you are subscribed to the Google >> Groups >> > "sage-support" group. >> > To unsubscribe from this group and stop receiving emails from it, send >> an >> > email to [email protected]. >> > To post to this group, send email to [email protected]. >> > Visit this group at http://groups.google.com/group/sage-support. >> > For more options, visit https://groups.google.com/d/optout. >> > -- You received this message because you are subscribed to the Google Groups "sage-support" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/sage-support. For more options, visit https://groups.google.com/d/optout.
