CopyofCurveDataReadIn1

328 days ago by Ben.LeVeque

K.<a>=NumberField(x^2-x-1) 
       
%hide def InvariantCalculator(EL): K.<a>=NumberField(x^2-x-1) N=EL.conductor() embs=K.embeddings(RR) print 'a invariants: ', EL.a_invariants() print '|T|: ', EL.torsion_order() for m in embs: e=m(EL.discriminant()) if e != abs(e): print 's: -' else: print 's: +' fac=K(EL.discriminant()).factor() k=[e for p,e in fac] print 'ord(disc): ', k i=0 l=[] denfac=K(EL.j_invariant().denominator_ideal().gens_reduced()[0]).factor() l=[e for p,e in denfac] print 'ord_(j): ', l print 'Tamagawa Numbers: ', EL.tamagawa_numbers() pe=K.prime_factors(N) n=0 for i in pe: print 'kodaira symbol: ', EL.kodaira_symbol(pe[n]) n+=1 
       
f=open('/Users/bleveque/Sage/matched.txt') #opens the file matched.txt for reading 
       
K.<a>=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(s): s=s[:-1] #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,grabber(s)) 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 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)] if K(E.j_invariant())==0: denfac = [(1,1)] else: denfac = K(E.j_invariant()).denominator_ideal().factor() if denfac == []: denfac = [(0,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 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' 
       
data=[] for s in f.readlines(): data.append(list_maker(s)) 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('/Users/bleveque/Sage/newellipticcurvedatafile3.txt','w') for curr_data in data: g.write(output_string(curr_data)) #writes data to new file g ^^ f.close() g.close() 
       
Traceback (click to the left of this block for traceback)
...
__SAGE__
^CTraceback (most recent call last):        for i,e in enumerate(cur_data):
  File "", line 1, in <module>
    
  File "/private/var/folders/+3/+3+bRf7bGhaMk-2vvrWEvU+++TI/-Tmp-/tmp3DZTE8/___code___.py", line 5, in <module>
    data.append(list_maker(s))
  File "/private/var/folders/+3/+3+bRf7bGhaMk-2vvrWEvU+++TI/-Tmp-/tmpGkKfiG/___code___.py", line 17, in list_maker
    T = E.torsion_subgroup()                      #calculations for rank bounds
  File "/Applications/sage/local/lib/python2.6/site-packages/sage/schemes/elliptic_curves/ell_number_field.py", line 1457, in torsion_subgroup
    self.__torsion_subgroup = ell_torsion.EllipticCurveTorsionSubgroup(self)
  File "/Applications/sage/local/lib/python2.6/site-packages/sage/schemes/elliptic_curves/ell_torsion.py", line 196, in __init__
    bound = E._torsion_bound(number_of_places=20)
  File "/Applications/sage/local/lib/python2.6/site-packages/sage/schemes/elliptic_curves/ell_number_field.py", line 1388, in _torsion_bound
    f = K.primes_above(p)
  File "/Applications/sage/local/lib/python2.6/site-packages/sage/rings/number_field/number_field.py", line 2201, in primes_above
    facs = [ (id.residue_class_degree(), id.absolute_norm(), id) for id in self.prime_factors(x) ]
^C
__SAGE__
h = open('/Users/bleveque/Sage/newgoodellipticcurvedatafile3.txt','w') 
       
f = open('/Users/bleveque/Sage/matched.txt') h = open('/Users/bleveque/Sage/newgoodellipticcurvedatafile3.txt','w') for line in f.readlines(): if len(line.split()) == 36: h.write(line) else: h.write(line[0:153] + '0' + line[155:186]) f.close() h.close() 
       
Traceback (click to the left of this block for traceback)
...
ValueError: I/O operation on closed file
Traceback (most recent call last):    f.close()
  File "", line 1, in <module>
    
  File "/private/var/folders/+3/+3+bRf7bGhaMk-2vvrWEvU+++TI/-Tmp-/tmpS4zlgM/___code___.py", line 3, in <module>
    for line in f.readlines():
ValueError: I/O operation on closed file
a = [] a == [] 
       
True
True
 
       

ISOGENIES

f=open('/Users/bleveque/Sage/matched.txt') 
       
def line_choose(N,ainv): possiblelines=[line for line in f.readlines() if line.split()[0] == N] def line_parser(s): r=s[24:100];r t=r.split() return [modified_eval(i) for i in t] def modified_eval(s): if s == '?': return s else: return eval(s) 
       
[-1, -2, 0, -4, 0, 0, 2, -4, 6, -6, 2, 8, 6, 12, -12, 6, -4, -10, '?',
'?', 14, -4, 6, 18]
[-1, -2, 0, -4, 0, 0, -4, 2, -6, 6, 8, 2, 12, 6, 6, -12, -10, -4, '?',
'?', -4, 14, 18, 6]
['?', 1, -3, -4, -6, 3, '?', '?', -6, 3, 5, 5, 6, 6, 6, -12, 8, 8, -9,
0, -1, -1, 9, 0]
['?', 1, -3, -4, 3, -6, '?', '?', 3, -6, 5, 5, 6, 6, -12, 6, 8, 8, 0,
-9, -1, -1, 0, 9]
['?', -5, 1, 0, 2, -3, '?', '?', -10, 5, -3, 7, 2, 2, 10, 0, 12, -8, 7,
-8, 15, 5, -15, 0]
[-1, -2, 0, -4, 0, 0, 2, -4, 6, -6, 2, 8, 6, 12, -12, 6, -4, -10, '?', '?', 14, -4, 6, 18]
[-1, -2, 0, -4, 0, 0, -4, 2, -6, 6, 8, 2, 12, 6, 6, -12, -10, -4, '?', '?', -4, 14, 18, 6]
['?', 1, -3, -4, -6, 3, '?', '?', -6, 3, 5, 5, 6, 6, 6, -12, 8, 8, -9, 0, -1, -1, 9, 0]
['?', 1, -3, -4, 3, -6, '?', '?', 3, -6, 5, 5, 6, 6, -12, 6, 8, 8, 0, -9, -1, -1, 0, 9]
['?', -5, 1, 0, 2, -3, '?', '?', -10, 5, -3, 7, 2, 2, 10, 0, 12, -8, 7, -8, 15, 5, -15, 0]
def isogenies_appender(s): s=s[:-1] 
       
g=open('/Users/bleveque/Sage/IsogenyOutputData.txt','w') 
       
K.<a>=NumberField(x^2-x-1) E=EllipticCurve(K,[1,a+1,a,a,0]) 
       
Traceback (click to the left of this block for traceback)
...
AttributeError: 'sage.rings.integer.Integer' object has no attribute
'residue_field'
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "_sage_input_16.py", line 10, in <module>
    exec compile(u'open("___code___.py","w").write("# -*- coding: utf-8 -*-\\n" + _support_.preparse_worksheet_cell(base64.b64decode("Sy48YT49TnVtYmVyRmllbGQoeF4yLXgtMSkKCkU9RWxsaXB0aWNDdXJ2ZShLLFsxLGErMSxhLGEsMF0pCmFwKEUsMik="),globals())+"\\n"); execfile(os.path.abspath("___code___.py"))
  File "", line 1, in <module>
    
  File "/private/var/folders/+3/+3+bRf7bGhaMk-2vvrWEvU+++TI/-Tmp-/tmp6ZlG6n/___code___.py", line 6, in <module>
    exec compile(u'ap(E,_sage_const_2 )
  File "", line 1, in <module>
    
  File "/private/var/folders/+3/+3+bRf7bGhaMk-2vvrWEvU+++TI/-Tmp-/tmp3owULj/___code___.py", line 4, in ap
    return E.change_ring(p.residue_field()).trace_of_frobenius()
  File "element.pyx", line 306, in sage.structure.element.Element.__getattr__ (sage/structure/element.c:2666)
  File "parent.pyx", line 272, in sage.structure.parent.getattr_from_other_class (sage/structure/parent.c:2840)
  File "parent.pyx", line 170, in sage.structure.parent.raise_attribute_error (sage/structure/parent.c:2611)
AttributeError: 'sage.rings.integer.Integer' object has no attribute 'residue_field'
def getap( def frob(E, p): R.<x> = ZZ[] t = ap(E, p) return x^2 - t*x + p.norm() def isogeny_primes(E, norm_bound, isog_degree_bound): P = [p for p in sqrt5.ideals_of_bounded_norm(norm_bound) if p.is_prime() and E.has_good_reduction(p)] w = set(primes(isog_degree_bound+1)) i = 0 while len(w) > 0 and i < len(P): f = frob(E, P[i]) w = [ell for ell in w if not f.change_ring(GF(ell)).is_irreducible()] i += 1 return w 
       
ap(E,K.ideal(K.primes_above(11)[1])) 
       
-4
-4
eval(f.readline().split()[0]) == 41 
       
True
True
a=3 a[0] 
       
Traceback (click to the left of this block for traceback)
...
TypeError: 'sage.rings.integer.Integer' object does not support indexing
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "_sage_input_40.py", line 10, in <module>
    exec compile(u'open("___code___.py","w").write("# -*- coding: utf-8 -*-\\n" + _support_.preparse_worksheet_cell(base64.b64decode("YT0zCmFbMF0="),globals())+"\\n"); execfile(os.path.abspath("___code___.py"))
  File "", line 1, in <module>
    
  File "/private/var/folders/+3/+3+bRf7bGhaMk-2vvrWEvU+++TI/-Tmp-/tmpdEn9ws/___code___.py", line 4, in <module>
    exec compile(u'a[_sage_const_0 ]
  File "", line 1, in <module>
    
TypeError: 'sage.rings.integer.Integer' object does not support indexing
a=[] b=a.append(3) 
       
       
       
3
3