Contact
CoCalc Logo Icon
StoreFeaturesDocsShareSupport News AboutSign UpSign In
| Download
Project: Test
Views: 72
load('func_strip_zero_matrix.sage') # the Turan graph T(5,3) has 5 vertices, and # and independent set of size 3 # create the graph object, just for fun g = Graph(); g.add_edges([(0,2),(0,3),(0,4),(1,2),(1,3),(1,4),(2,4),(3,4)]); show(g) # A is 56 x 99 A = matrix(QQ, 56, 99); row = 0; # 0: 1 A[row,30]=4;row = row + 1; # 1: x[0] A[row,30]=1;A[row,31]=4;A[row,0]=-1;row = row + 1; # 2: x[1] A[row,30]=1;A[row,32]=4;A[row,6]=-1;row = row + 1; # 3: x[2] A[row,30]=1;A[row,12]=-1;A[row,33]=4;row = row + 1; # 4: x[3] A[row,30]=1;A[row,34]=4;A[row,18]=-1;row = row + 1; # 5: x[4] A[row,30]=1;A[row,35]=4;A[row,24]=-1;row = row + 1; # 6: x[0]^2 #A[row,1]=-1;A[row,36]=4;A[row,0]=1;A[row,31]=1;row = row + 1; # 7: x[0]*x[1] independent set A[row,7]=-1;A[row,2]=-1;A[row,37]=4;A[row,32]=1;A[row,31]=1;row = row + 1; # 8: x[0]*x[2] edge #A[row,31]=1;A[row,13]=-1;A[row,33]=1;A[row,3]=-1;A[row,38]=4;A[row,51]=1;row = row + 1; # 9: x[0]*x[3] edge #A[row,34]=1;A[row,4]=-1;A[row,39]=4;A[row,31]=1;A[row,57]=1;A[row,19]=-1;row = row + 1; # 10: x[0]*x[4] edge #A[row,35]=1;A[row,5]=-1;A[row,40]=4;A[row,31]=1;A[row,63]=1;A[row,25]=-1;row = row + 1; # 11: x[1]^2 #A[row,8]=-1;A[row,32]=1;A[row,41]=4;A[row,6]=1;row = row + 1; # 12: x[1]*x[2] edge #A[row,69]=1;A[row,9]=-1;A[row,33]=1;A[row,42]=4;A[row,14]=-1;A[row,32]=1;row = row + 1; # 13: x[1]*x[3] edge #A[row,20]=-1;A[row,10]=-1;A[row,34]=1;A[row,43]=4;A[row,75]=1;A[row,32]=1;row = row + 1; # 14: x[1]*x[4] edge #A[row,26]=-1;A[row,11]=-1;A[row,35]=1;A[row,44]=4;A[row,81]=1;A[row,32]=1;row = row + 1; # 15: x[2]^2 #A[row,15]=-1;A[row,33]=1;A[row,45]=4;A[row,12]=1;row = row + 1; # 16: x[2]*x[3] independent set A[row,33]=1;A[row,16]=-1;A[row,34]=1;A[row,46]=4;A[row,21]=-1;row = row + 1; # 17: x[2]*x[4] edge #A[row,17]=-1;A[row,35]=1;A[row,47]=4;A[row,27]=-1;A[row,87]=1;A[row,33]=1;row = row + 1; # 18: x[3]^2 #A[row,18]=1;A[row,34]=1;A[row,22]=-1;A[row,48]=4;row = row + 1; # 19: x[3]*x[4] edge #A[row,28]=-1;A[row,34]=1;A[row,35]=1;A[row,23]=-1;A[row,49]=4;A[row,93]=1;row = row + 1; # 20: x[4]^2 #A[row,29]=-1;A[row,35]=1;A[row,50]=4;A[row,24]=1;row = row + 1; # 21: x[0]^3 #A[row,1]=1;A[row,36]=1;row = row + 1; # 22: x[0]^2*x[1] #A[row,36]=1;A[row,2]=1;A[row,37]=1;row = row + 1; # 23: x[0]^2*x[2] edge #A[row,52]=1;A[row,36]=1;A[row,3]=1;A[row,38]=1;row = row + 1; # 24: x[0]^2*x[3] edge #A[row,58]=1;A[row,36]=1;A[row,4]=1;A[row,39]=1;row = row + 1; # 25: x[0]^2*x[4] edge #A[row,64]=1;A[row,36]=1;A[row,5]=1;A[row,40]=1;row = row + 1; # 26: x[0]*x[1]^2 #A[row,7]=1;A[row,37]=1;A[row,41]=1;row = row + 1; # 27: x[0]*x[1]*x[2] edge #A[row,53]=1;A[row,70]=1;A[row,37]=1;A[row,38]=1;A[row,42]=1;row = row + 1; # 28: x[0]*x[1]*x[3] edge #A[row,76]=1;A[row,59]=1;A[row,37]=1;A[row,39]=1;A[row,43]=1;row = row + 1; # 29: x[0]*x[1]*x[4] edge #A[row,82]=1;A[row,37]=1;A[row,65]=1;A[row,40]=1;A[row,44]=1;row = row + 1; # 30: x[0]*x[2]^2 edge #A[row,54]=1;A[row,38]=1;A[row,13]=1;A[row,45]=1;row = row + 1; # 31: x[0]*x[2]*x[3] edge #A[row,60]=1;A[row,38]=1;A[row,55]=1;A[row,39]=1;A[row,46]=1;row = row + 1; # 32: x[0]*x[2]*x[4] edge #A[row,88]=1;A[row,38]=1;A[row,47]=1;A[row,66]=1;A[row,56]=1;A[row,40]=1;row = row + 1; # 33: x[0]*x[3]^2 edge #A[row,19]=1;A[row,61]=1;A[row,39]=1;A[row,48]=1;row = row + 1; # 34: x[0]*x[3]*x[4] edge #A[row,94]=1;A[row,67]=1;A[row,40]=1;A[row,49]=1;A[row,39]=1;A[row,62]=1;row = row + 1; # 35: x[0]*x[4]^2 edge #A[row,25]=1;A[row,68]=1;A[row,50]=1;A[row,40]=1;row = row + 1; # 36: x[1]^3 #A[row,41]=1;A[row,8]=1;row = row + 1; # 37: x[1]^2*x[2] edge #A[row,41]=1;A[row,42]=1;A[row,9]=1;A[row,71]=1;row = row + 1; # 38: x[1]^2*x[3] edge #A[row,41]=1;A[row,43]=1;A[row,10]=1;A[row,77]=1;row = row + 1; # 39: x[1]^2*x[4] edge #A[row,83]=1;A[row,44]=1;A[row,11]=1;A[row,41]=1;row = row + 1; # 40: x[1]*x[2]^2 edge #A[row,72]=1;A[row,45]=1;A[row,14]=1;A[row,42]=1;row = row + 1; # 41: x[1]*x[2]*x[3] edge #A[row,42]=1;A[row,73]=1;A[row,43]=1;A[row,78]=1;A[row,46]=1;row = row + 1; # 42: x[1]*x[2]*x[4] edge #A[row,42]=1;A[row,74]=1;A[row,47]=1;A[row,89]=1;A[row,44]=1;A[row,84]=1;row = row + 1; # 43: x[1]*x[3]^2 edge #A[row,79]=1;A[row,20]=1;A[row,43]=1;A[row,48]=1;row = row + 1; # 44: x[1]*x[3]*x[4] edge #A[row,43]=1;A[row,95]=1;A[row,44]=1;A[row,49]=1;A[row,85]=1;A[row,80]=1;row = row + 1; # 45: x[1]*x[4]^2 edge #A[row,44]=1;A[row,50]=1;A[row,86]=1;A[row,26]=1;row = row + 1; # 46: x[2]^3 #A[row,15]=1;A[row,45]=1;row = row + 1; # 47: x[2]^2*x[3] #A[row,45]=1;A[row,16]=1;A[row,46]=1;row = row + 1; # 48: x[2]^2*x[4] edge #A[row,90]=1;A[row,45]=1;A[row,17]=1;A[row,47]=1;row = row + 1; # 49: x[2]*x[3]^2 #A[row,21]=1;A[row,48]=1;A[row,46]=1;row = row + 1; # 50: x[2]*x[3]*x[4] edge #A[row,96]=1;A[row,49]=1;A[row,47]=1;A[row,46]=1;A[row,91]=1;row = row + 1; # 51: x[2]*x[4]^2 edge #A[row,27]=1;A[row,47]=1;A[row,92]=1;A[row,50]=1;row = row + 1; # 52: x[3]^3 #A[row,22]=1;A[row,48]=1;row = row + 1; # 53: x[3]^2*x[4] edge #A[row,97]=1;A[row,23]=1;A[row,49]=1;A[row,48]=1;row = row + 1; # 54: x[3]*x[4]^2 edge #A[row,98]=1;A[row,50]=1;A[row,28]=1;A[row,49]=1;row = row + 1; # 55: x[4]^3 #A[row,29]=1;A[row,50]=1; L = strip_zero_matrix(A) M = L['M']; M # A is 56 x 99 diff 43 # M is 38 x 67 diff 29 #M is 39 x 69 diff 30 #M is 17 x 22 diff 5 #M is 18 x 23 diff 5 b = matrix(QQ, 8, 1); b[0,0] = 1; x = M.solve_right(b) print "printing solution..." x # for i in range(0, x.nrows()): # print "x[" + str(i) + "] = " + str(x[i]); print "Checking eigenvalues for positive semi-definite" M.eigenvalues() # MM = A*A.transpose() # print "Checking eigenvalues for positive semi-definite" # MM.eigenvalues() # MM.det() # MM.trace() # sum(MM.eigenvalues())
d3-based renderer not yet implemented
A is 56 x 99 M is 8 x 8 [4 0 0 0 0 0 0 0] [1 4 0 0 0 0 0 0] [1 0 4 0 0 0 0 0] [1 0 0 4 0 0 0 0] [1 0 0 0 4 0 0 0] [1 0 0 0 0 4 0 0] [0 1 1 0 0 0 4 0] [0 0 0 1 1 0 0 4] printing solution... [ 1/4] [-1/16] [-1/16] [-1/16] [-1/16] [-1/16] [ 1/32] [ 1/32] Checking eigenvalues for positive semi-definite [4, 4, 4, 4, 4, 4, 4, 4]
load('func_strip_zero_matrix.sage') # 5-cycle has 5 vertices and an independent set of size 2 #G := [[0,1],[0,4],[1,2],[2,3],[3,4]]; # create the graph object, just for fun g = Graph(); g.add_edges([(0,1),(0,4),(1,2),(2,3),(3,4)]); show(g) # indepedent sets are # 02, 03, 13, 14, 24 # A is 56 x 81 A = matrix(QQ, 56, 81); row = 0; # 0: 1 A[row,30]=3;row = row + 1; # 1: x[0] A[row,30]=1;A[row,0]=-1;A[row,31]=3;row = row + 1; # 2: x[1] A[row,30]=1;A[row,6]=-1;A[row,32]=3;row = row + 1; # 3: x[2] A[row,30]=1;A[row,12]=-1;A[row,33]=3;row = row + 1; # 4: x[3] A[row,30]=1;A[row,18]=-1;A[row,34]=3;row = row + 1; # 5: x[4] A[row,30]=1;A[row,24]=-1;A[row,35]=3;row = row + 1; # 6: x[0]^2 #A[row,0]=1;A[row,1]=-1;A[row,31]=1;A[row,36]=3;row = row + 1; # 7: x[0]*x[1] #A[row,7]=-1;A[row,2]=-1;A[row,32]=1;A[row,37]=3;A[row,51]=1;A[row,31]=1;row = row + 1; # 8: x[0]*x[2] A[row,13]=-1;A[row,31]=1;A[row,3]=-1;A[row,38]=3;A[row,33]=1;row = row + 1; # 9: x[0]*x[3] A[row,19]=-1;A[row,31]=1;A[row,4]=-1;A[row,39]=3;A[row,34]=1;row = row + 1; # 10: x[0]*x[4] #A[row,25]=-1;A[row,5]=-1;A[row,40]=3;A[row,35]=1;A[row,57]=1;A[row,31]=1;row = row + 1; # 11: x[1]^2 #A[row,6]=1;A[row,32]=1;A[row,41]=3;A[row,8]=-1;row = row + 1; # 12: x[1]*x[2] #A[row,14]=-1;A[row,33]=1;A[row,42]=3;A[row,9]=-1;A[row,63]=1;A[row,32]=1;row = row + 1; # 13: x[1]*x[3] A[row,32]=1;A[row,20]=-1;A[row,34]=1;A[row,10]=-1;A[row,43]=3;row = row + 1; # 14: x[1]*x[4] A[row,32]=1;A[row,35]=1;A[row,11]=-1;A[row,44]=3;A[row,26]=-1;row = row + 1; # 15: x[2]^2 #A[row,33]=1;A[row,12]=1;A[row,15]=-1;A[row,45]=3;row = row + 1; # 16: x[2]*x[3] #A[row,69]=1;A[row,33]=1;A[row,34]=1;A[row,16]=-1;A[row,46]=3;A[row,21]=-1;row = row + 1; # 17: x[2]*x[4] A[row,27]=-1;A[row,47]=3;A[row,33]=1;A[row,35]=1;A[row,17]=-1;row = row + 1; # 18: x[3]^2 #A[row,18]=1;A[row,22]=-1;A[row,34]=1;A[row,48]=3;row = row + 1; # 19: x[3]*x[4] #A[row,34]=1;A[row,28]=-1;A[row,23]=-1;A[row,35]=1;A[row,49]=3;A[row,75]=1;row = row + 1; # 20: x[4]^2 #A[row,24]=1;A[row,35]=1;A[row,29]=-1;A[row,50]=3;row = row + 1; # 21: x[0]^3 #A[row,36]=1;A[row,1]=1;row = row + 1; # 22: x[0]^2*x[1] #A[row,52]=1;A[row,37]=1;A[row,2]=1;A[row,36]=1;row = row + 1; # 23: x[0]^2*x[2] #A[row,36]=1;A[row,38]=1;A[row,3]=1;row = row + 1; # 24: x[0]^2*x[3] #A[row,39]=1;A[row,4]=1;A[row,36]=1;row = row + 1; # 25: x[0]^2*x[4] #A[row,58]=1;A[row,40]=1;A[row,5]=1;A[row,36]=1;row = row + 1; # 26: x[0]*x[1]^2 #A[row,53]=1;A[row,41]=1;A[row,7]=1;A[row,37]=1;row = row + 1; # 27: x[0]*x[1]*x[2] #A[row,64]=1;A[row,54]=1;A[row,38]=1;A[row,37]=1;A[row,42]=1;row = row + 1; # 28: x[0]*x[1]*x[3] #A[row,55]=1;A[row,39]=1;A[row,43]=1;A[row,37]=1;row = row + 1; # 29: x[0]*x[1]*x[4] #A[row,56]=1;A[row,40]=1;A[row,44]=1;A[row,59]=1;A[row,37]=1;row = row + 1; # 30: x[0]*x[2]^2 #A[row,45]=1;A[row,13]=1;A[row,38]=1;row = row + 1; # 31: x[0]*x[2]*x[3] #A[row,38]=1;A[row,46]=1;A[row,39]=1;A[row,70]=1;row = row + 1; # 32: x[0]*x[2]*x[4] #A[row,47]=1;A[row,40]=1;A[row,38]=1;A[row,60]=1;row = row + 1; # 33: x[0]*x[3]^2 #A[row,39]=1;A[row,48]=1;A[row,19]=1;row = row + 1; # 34: x[0]*x[3]*x[4] #A[row,39]=1;A[row,61]=1;A[row,49]=1;A[row,76]=1;A[row,40]=1;row = row + 1; # 35: x[0]*x[4]^2 #A[row,40]=1;A[row,62]=1;A[row,25]=1;A[row,50]=1;row = row + 1; # 36: x[1]^3 #A[row,41]=1;A[row,8]=1;row = row + 1; # 37: x[1]^2*x[2] #A[row,41]=1;A[row,42]=1;A[row,9]=1;A[row,65]=1;row = row + 1; # 38: x[1]^2*x[3] #A[row,41]=1;A[row,43]=1;A[row,10]=1;row = row + 1; # 39: x[1]^2*x[4] #A[row,41]=1;A[row,44]=1;A[row,11]=1;row = row + 1; # 40: x[1]*x[2]^2 #A[row,42]=1;A[row,66]=1;A[row,45]=1;A[row,14]=1;row = row + 1; # 41: x[1]*x[2]*x[3] #A[row,43]=1;A[row,67]=1;A[row,46]=1;A[row,42]=1;A[row,71]=1;row = row + 1; # 42: x[1]*x[2]*x[4] #A[row,42]=1;A[row,44]=1;A[row,47]=1;A[row,68]=1;row = row + 1; # 43: x[1]*x[3]^2 #A[row,20]=1;A[row,43]=1;A[row,48]=1;row = row + 1; # 44: x[1]*x[3]*x[4] #A[row,43]=1;A[row,77]=1;A[row,44]=1;A[row,49]=1;row = row + 1; # 45: x[1]*x[4]^2 #A[row,26]=1;A[row,44]=1;A[row,50]=1;row = row + 1; # 46: x[2]^3 #A[row,45]=1;A[row,15]=1;row = row + 1; # 47: x[2]^2*x[3] #A[row,45]=1;A[row,72]=1;A[row,46]=1;A[row,16]=1;row = row + 1; # 48: x[2]^2*x[4] #A[row,45]=1;A[row,47]=1;A[row,17]=1;row = row + 1; # 49: x[2]*x[3]^2 #A[row,46]=1;A[row,48]=1;A[row,73]=1;A[row,21]=1;row = row + 1; # 50: x[2]*x[3]*x[4] #A[row,78]=1;A[row,74]=1;A[row,46]=1;A[row,49]=1;A[row,47]=1;row = row + 1; # 51: x[2]*x[4]^2 #A[row,27]=1;A[row,50]=1;A[row,47]=1;row = row + 1; # 52: x[3]^3 #A[row,48]=1;A[row,22]=1;row = row + 1; # 53: x[3]^2*x[4] #A[row,79]=1;A[row,49]=1;A[row,23]=1;A[row,48]=1;row = row + 1; # 54: x[3]*x[4]^2 #A[row,80]=1;A[row,50]=1;A[row,28]=1;A[row,49]=1;row = row + 1; # 55: x[4]^3 #A[row,29]=1;A[row,50]=1; #cert := (1/12+1/15*x[1]-1/30*x[2]-1/30*x[3]-1/30*x[4])*(x[0]^2-x[0]) + (1/12+1/15*x[0]+1/15*x[2]-1/30*x[3]-1/30*x[4])*(x[1]^2-x[1]) + (1/12-1/30*x[0]+1/15*x[1]-1/30*x[3]-1/30*x[4])*(x[2]^2-x[2]) + (1/12-1/30*x[0]-1/30*x[1]-1/30*x[2]+1/15*x[4])*(x[3]^2-x[3]) + (1/12-1/30*x[0]-1/30*x[1]-1/30*x[2]+1/15*x[3])*(x[4]^2-x[4]) + (1/3-1/12*x[0]-1/12*x[1]-1/12*x[2]-1/12*x[3]-1/12*x[4]-1/15*x[0]*x[1]+1/30*x[0]*x[2]+1/30*x[0]*x[3]+1/30*x[0]*x[4]-1/15*x[1]*x[2]+1/30*x[1]*x[3]+1/30*x[1]*x[4]+1/30*x[2]*x[3]+1/30*x[2]*x[4]-1/15*x[3]*x[4])*(x[0]+x[1]+x[2]+x[3]+x[4]+3) + (1/2+1/10*x[2])*(x[0]*x[1]) + (-1/10*x[2])*(x[0]*x[4]) + (1/2)*(x[1]*x[2]) + (-1/10*x[0])*(x[2]*x[3]) + (1/2)*(x[3]*x[4]); L = strip_zero_matrix(A) M = L['M']; M #b = matrix(QQ, 8, 1); #b[0,0] = 1; #x = M.solve_right(b) #print "printing solution..." #x # for i in range(0, x.nrows()): # print "x[" + str(i) + "] = " + str(x[i]); print "Checking eigenvalues for positive semi-definite" M.eigenvalues() # MM = A*A.transpose() # print "Checking eigenvalues for positive semi-definite" # MM.eigenvalues() # MM.det() # MM.trace() # sum(MM.eigenvalues())
d3-based renderer not yet implemented
A is 56 x 81 M is 11 x 11 [3 0 0 0 0 0 0 0 0 0 0] [1 3 0 0 0 0 0 0 0 0 0] [1 0 3 0 0 0 0 0 0 0 0] [1 0 0 3 0 0 0 0 0 0 0] [1 0 0 0 3 0 0 0 0 0 0] [1 0 0 0 0 3 0 0 0 0 0] [0 1 0 1 0 0 3 0 0 0 0] [0 1 0 0 1 0 0 3 0 0 0] [0 0 1 0 1 0 0 0 3 0 0] [0 0 1 0 0 1 0 0 0 3 0] [0 0 0 1 0 1 0 0 0 0 3] Checking eigenvalues for positive semi-definite [3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3]