Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
Download

Code Samples

169 views
unlisted
ubuntu2204
#take two complexes, matrix or otherwise # if poly, turn into matrix pls and ty # append the row [B,C,D……P] on top of each matrix m_a= matrix ([ #B sub [1,1, 1,0,0,0,0,0,0,0,0,0,0], [1,0,0,1, 1,0,0,0,0,0,0,0,0], [1,0,0,0,0,1, 1,0,0,0,0,0,0], [1,0,0,0,0,0,0, 1,1,0,0,0,0], [1,0,0,0,0,0,0,0,0, 1,1,0,0], [1,0,0,0,0,0,0,0,0,0,0, 1,1], ]) m_b= matrix ([ #C sub [1,1, 1,0,0,0,0,0,0,0,0,0,0,0,0], [0,1,0, 1,0, 1,0,0,0,0,0,0,0,0,0], [0,1,0,0, 1,0, 1,0,0,0,0,0,0,0,0], [0,1,0,0,0,0,0, 1,0, 1,0,0,0,0,0], [0,1,0,0,0,0,0,0, 1,0, 1,0,0,0,0], [0,1,0,0,0,0,0,0,0,0,0, 1,0,1,0], [0,1,0,0,0,0,0,0,0,0,0,0,1,0,1], ]) #the following is the modified "not" C matrix! #m_b= matrix ([ #C sub #[1,1, 1,0,0,0,0,0,0,0,0,0,0,0,0], #[0,1,0, 1,0, 1,0,0,0,0,0,0,0,0,0], #[0,1,0,0, 1,0, 1,0,0,0,0,0,0,0,0], #[0,1,0,0,0,0,0, 1,0, 1,0,0,0,0,0], #[0,1,0,0,0,0,0,0, 1,0, 1,0,0,0,0], #[0,1,0,0,0,0,0,0,0,0,0, 1,0,1,0], #[0,1,0,0,0,0,0,0,0,0,0, 1,0,1,0]]) # check to see if the ranks are the same bc if htey’re not then they got redundancies that don’t match nicely! if m_a.rank() != m_b.rank(): print('These bitches don’t have the same rank (number of points)! Booooo.') if m_a.nrows() != m_b.nrows(): print('These bitches don’t even have the same number of lines!') # then kill the code # this is how you find the incidence/frequency matrix # pull the number of columns of a # col_a = m_a.ncols() # phi_a = matrix(QQ, 1, col_a, lambda i, j=1) # inc_a= m_a*phi_a # col_b = m_b.ncols() # phi_b = matrix(QQ, 1, col_b, lambda i, j=1) # inc_b = m_b*phi_b # import incident code # import incident sorting code , file name “INCIDENT SORTING” # reduce the matrices by removing all columns completely filled with 0 # take the column summation, which i named inc, from the 2nd row and beyond (because the first row is just naming) # organize in numerical order, greatest to least, using entries in second row. Make sure to move first row with it as that’s the name of hte points! # else: L=length(inc_a) # for i in[1,L] # call on index of inc matrices, line by line # if inc_a[i]==inc_b[i], i=i+1 # else: print (“These complexes are not isomorphic because the incident counts aren’t the same, so there cannot be an isomorphism between the two”) # print out both matrices, then kill the code # now we’re going to make the original matrix without the 0 padding. This bad boy should have the same number of rows and columns, and their incident matrix is also the same # what we’ll do now is we’ll take the ordered inc_a and move the columns around on m_a until the letters in the first row of m_a matches the letters on the first row of inc_a. This will give you incident from greatest to least. Repeat for m_b # we’re going to do this by way of duplicating our matrices, not by assignment, but by like actual projection so we don’t fuck with our original matrix # m_a2 = copy(m_a) # m_b2 = copy(m_b) # let’s organize m_a2 with accordance of inc_a # now is the time we’ll build an isomorphism between m_b2 back to m_a2