{{{id=1| K.=NumberField(x^2-x-1) f=open('/home/psharaba/QTFList.txt') /// }}} {{{id=4| K.=NumberField(x^2-x-1) embs=K.embeddings(RR) #def grabber(s): # return eval('['+s.split('[')[1].split(']')[0]+']') #returns a-invariants def list_maker(N,cond,eqn): ret = [N,cond,eqn] # #we want to add new text to each line, so we take off # ret = [s] #\n first and define our list to eventually be returned #now we create the elliptic curve over K defined by the a-invariants E = EllipticCurve(K,eval(eqn)) T = E.torsion_subgroup() # calculations for rank bounds TI = T.invariants() # t2 = len([a for a in TI if a%2 == 0]) # simon = E.simon_two_descent() # ret.append(str(simon[0])) #append upper rank bound ret.append(str(simon[1] - t2)) #append lower rank bound D=K(E.discriminant()) #calculate discriminant t='' #create string to add + or - for m in embs: e=m(D) if sgn(e)<0: t+='-' else: t+='+' t+=',' ret.append(t[:-1]) #append disc signs tor=E.torsion_order() ret.append(tor) fac=D.factor() k=[str(e) for p,e in fac] #calculate disc ord ret.append(','.join(k)) #append disc ord #the next section adds ord_(j). There are certain curves (eg N=729 #2) which have #j-invariant 0. The denominator_ideal function is not defined for j=0, so we set #the value to be 1 if this is the case. # try: # denfac = K(E.j_invariant()).denominator_ideal().factor() # except ValueError: # denfac = [(1,1)] z=K(E.j_invariant()) if z: denfac=z.denominator_ideal().factor() if denfac: ret.append(','.join([str(e) for p,e in denfac])) else: ret.append('0') else: ret.append('0') #we still want a value for the table if denfac == [] # l=[str(e) for p,e in denfac] # ret.append(','.join(l)) #append j-ord ret.append(','.join([str(e) for e in E.tamagawa_numbers()])) #append tamagawa z = E.conductor().factor() ret.append(','.join([str(E.kodaira_symbol(p)) for p,e in z])) #append kodaira ret.append(B[3]) ret.append(B[4]) return ret #output_string takes in the current line of data to be written to the new file #it adds the correct spacing after each entry which is defined below def output_string(curr_data): ret = '' for i,s in enumerate(curr_data): ret += s ret += (2+width[i]-len(s))*' ' return ret+'\n' /// }}} {{{id=23| f.readline().split() /// ['145', '11*a-8', '[18*a-28,-105*a+170,-105*a+170,0,0]', 'matrix(2,[0,7,7,0])', 'TF'] }}} {{{id=6| data=[] broken=[] for s in f.readlines(): B=s.split() try: data.append(list_maker(B[0],B[1],B[2])) except TypeError: broken.append(B) #width = [0 for i in range(8)] #sets uniform width for each column #for cur_data in data: # for i,e in enumerate(cur_data): # t = len(e) # if t > width[i]: # width[i] = t g = open('/home/psharaba/QTFListU.txt','w') for curr_data in data: for i,thing in enumerate(curr_data): curr_data[i] = str(thing) g.write(' '.join(curr_data)+'\n') #writes data to new file g ^^ f.close() g.close() /// }}} {{{id=21| for curr_data in data: if isinstance(curr_data, Integer /// }}} {{{id=22| broken /// [] }}} {{{id=18| list_maker(2591, -7*a-48,'[1,a,0,-857317*a-529851,-377562052*a-233346181]') /// [2591, -7*a - 48, '[1,a,0,-857317*a-529851,-377562052*a-233346181]', '0', '0', '-,+', 1, '3', '3', '1', 'I3'] }}} {{{id=7| E=EllipticCurve(K,[a,a+1,a,211*a+130,-1930*a-1193]) /// }}} {{{id=20| E.global_minimal_model() /// }}} {{{id=19| 1421 7*a+35 [a,a+1,a,211*a+130, -1930*a-1193] 0 0 +,- 3,3 3,3 1,3 I3,I3 /// }}} {{{id=16| broken /// [['1421', '7*a+35', '[a,a+1,a,211*a+130,-1930*a-1193]', '121.797626019']] }}} {{{id=9| E.simon_two_descent() /// (1, 1, []) }}} {{{id=10| B = '1421 7*a+35 [a,a+1,a,211*a+130,-1930*a-1193]'.split() data.append(list_maker(B[0],B[1],eval(B[2]))) /// }}} {{{id=15| s /// '1421 7*a+35 [a,a+1,a,211*a+130,-1930*a-1193] 121.797626019\n' }}} {{{id=11| B /// ['1421', '7*a+35', '[a,a+1,a,211*a+130,-1930*a-1193]', '121.797626019'] }}} {{{id=12| data.append(list_maker(B[0],B[1],eval(B[2]))) /// }}} {{{id=13| data[-2:] /// [['1421', '7*a+35', [a, a + 1, a, 211*a + 130, -1930*a - 1193], '1', '1', '+,-', '3,3', '3,3', '1,3', 'I3,I3'], ['1421', '7*a+35', [a, a + 1, a, 211*a + 130, -1930*a - 1193], '1', '1', '+,-', '3,3', '3,3', '1,3', 'I3,I3']] }}} {{{id=14| /// }}}