{{{id=1| K.=NumberField(x^2-x-1) f=open('/home/psharaba/CCLU.txt') /// }}} {{{id=2| 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=4| 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/CCLU1k.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=5| broken /// [] }}} {{{id=6| g=open('/home/psharaba/CCLU1k.txt') /// }}} {{{id=12| g.readline().split() /// ['225', '15', '[a+1,a,a+1,-50*a-50,46*a+47]', '0', '0', '+,+', '4', '4,14', '4,8', '2,4', 'I4,I8*', 'matrix(10,[0,2,2,2,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,2,0,0,0,2,2,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,2,0,0,2,2,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,2,0,0,2,2,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,2,0,0])', 'CLI'] }}} {{{id=9| k=0 /// }}} {{{id=7| for s in g.readlines(): k+=1 /// }}} {{{id=10| k /// 48 }}} {{{id=11| /// }}}