###
### This program finds all symmetry classes of the 1002
### initial ideals for the toric ideal on H_4. For each
### symmetry class, a representative is output, along
### with the number of ideals in its entire G-orbit.
###
monomial_order = 'deglex'
R.<x1,x2,x3,x4,y1,y2,y3,y4,z1,z2,z3,z4> = PolynomialRing(QQ, 12, ['x1','x2','x3','x4','y1','y2','y3','y4','z1','z2','z3','z4'], order=monomial_order)
x = [x1, x2, x3, x4]
y = [y1, y2, y3, y4]
z = [z1, z2, z3, z4]
R_gens = x+y+z
###
### Set up the permutation group.
###
#x1=1; x2=2; x3=3; x4=4; y1=5; y2=6; y3=7; y4=8; z1=9; z2=10; z3=11; z4=12
#permute the copies of P^2
perm_coords = ['(1,2)(5,6)(9,10)', '(1,3)(5,7)(9,11)', '(1,4)(5,8)(9,12)',\
'(2,3)(6,7)(10,11)', '(2,4)(6,8)(10,12)', '(3,4)(7,8)(11,12)']
perm_p1 = ['(1,5)', '(1,9)', '(5,9)'] #permute the first copy of P^2
perm_p2 = ['(2,6)', '(2,10)', '(6,10)'] #permute the second copy of P^2
perm_p3 = ['(3,7)', '(3,11)', '(7,11)'] #permute the third copy of P^2
perm_p4 = ['(4,8)', '(4,12)', '(8,12)'] #permute the fourth copy of P^2
G = PermutationGroup(perm_coords + perm_p1 + perm_p2 + perm_p3 + perm_p4)
#INPUT : g = an element of the permutation group G
# m = a monomial in R
#OUTPUT : the monomial returned when g acts on m
def act(g,m):
permuted = [R_gens[g(i+1)-1] for i in range(len(R_gens))]
n = 1
for var in m.variables():
n = n*(permuted[R_gens.index(var)]^(m.degree(var)))
return n
###
### Read in the 1002 initial ideals
###
#Each element of mon_ideals is a frozenset which contains the
#generators for the different monomial ideals. We use the frozenset
#data type because it speeds up the computation.
mon_ideals = set()
filename = DATA + 'toric_4_initials.txt'
infile = open(filename, 'r')
str_data = infile.readline()
while str_data != '' and str_data != '\n':
data = str_data.split(',')
#remove the beginning and ending brackets
data[0] = data[0][1:]
data[-1] = data[-1][:len(data[-1])-2]
I = set()
for m in data:
I.add(R(m))
I = frozenset(I)
mon_ideals.add(I)
str_data = infile.readline()
print 'Finished populating mon_ideals.'
print 'There are', len(mon_ideals), 'distinct initial ideals in the input file.\n'
|
|
Finished populating mon_ideals.
There are 1002 distinct initial ideals in the input file.
Finished populating mon_ideals.
There are 1002 distinct initial ideals in the input file.
|