{{{id=1| var('x') K.=NumberField(x^2-x-1) import nosqlite db=nosqlite.Client('/home/psharaba/table/ECdb').db from psage.ellcurve.minmodel.sqrt5 import canonical_model /// }}} {{{id=10| from nosqlite import Client def local_db(): return Client(DATA+'localdb').db def network_db(): raise NotImplementedError def create_local_db(): db = local_db() c = db.curves # collection c.ensure_index(unique=True, weq=1) for X in open('/home/psharaba/table/CLlist.txt').readlines(): v = X.split() E=EllipticCurve(K,eval(v[2])) E=canonical_model(E.global_minimal_model()) d = {'N':int(v[0]), 'cond':v[1], 'weq':str(E)} c.insert(d) /// }}} {{{id=11| create_local_db() /// Traceback (most recent call last): File "", line 1, in File "_sage_input_27.py", line 10, in exec compile(u'open("___code___.py","w").write("# -*- coding: utf-8 -*-\\n" + _support_.preparse_worksheet_cell(base64.b64decode("Y3JlYXRlX2xvY2FsX2RiKCk="),globals())+"\\n"); execfile(os.path.abspath("___code___.py"))' + '\n', '', 'single') File "", line 1, in File "/tmp/tmpFxBvHn/___code___.py", line 2, in exec compile(u'create_local_db()' + '\n', '', 'single') File "", line 1, in File "/tmp/tmpFzqZMs/___code___.py", line 23, in create_local_db c.insert(d) File "/home/wstein/nosqlite/nosqlite.py", line 845, in insert self.database(_insert_statement(self.name, d.keys(), on_conflict), d.values(), coerce=coerce) File "/home/wstein/nosqlite/nosqlite.py", line 592, in __call__ return self.client(cmds, t, file=self.name, many=many, coerce=coerce) File "/home/wstein/nosqlite/nosqlite.py", line 467, in __call__ return self.server.execute(cmd, t, file, many) File "/home/wstein/nosqlite/nosqlite.py", line 348, in execute o = cursor.executemany(*c) if many else cursor.execute(*c) sqlite3.IntegrityError: column weq is not unique }}} {{{id=3| X=db("select ainv1 from N1k WHERE found='CL' ORDER BY N,eta") /// }}} {{{id=4| c /// Traceback (most recent call last): File "", line 1, in File "_sage_input_20.py", line 10, in exec compile(u'open("___code___.py","w").write("# -*- coding: utf-8 -*-\\n" + _support_.preparse_worksheet_cell(base64.b64decode("Yw=="),globals())+"\\n"); execfile(os.path.abspath("___code___.py"))' + '\n', '', 'single') File "", line 1, in File "/tmp/tmpOJbqPT/___code___.py", line 2, in exec compile(u'c' + '\n', '', 'single') File "", line 1, in NameError: name 'c' is not defined }}} {{{id=8| test=[] /// }}} {{{id=20| E=EllipticCurve(K,[a,a,a+1,19*a-24,-13*a+21]) /// }}} {{{id=21| E.conductor().norm() /// 84609727705 }}} {{{id=22| X=db("select ainv1 from N1k WHERE Lstar=100 ORDER BY N,eta") X[0] print type(eval(X[0][0])) /// }}} {{{id=2| c = db.N1k X=db('select ainv1 from N1k WHERE Lstar=100 ORDER BY N,eta') @parallel(8) def comp(ainv): E=EllipticCurve(K,eval(ainv)) E=canonical_model(E.global_minimal_model()) F=EllipticCurve(K,list(E.short_weierstrass_model().a_invariants())) v=F.lseries().dokchitser() f=v.taylor_series(1,6) r_an=0 while abs(f[r_an])<1e-10: r_an += 1 if r_an == 6: raise RuntimeError Lstar=float(f[r_an]) d = {'Lstar':Lstar} c.update(d, ainv1=ainv) print d for s in range(len(X)): A=X[s][0] comp(A) print A /// {'Lstar': 1.6601602274532463} [a+1,-a,a,4*a-8,6*a-11] {'Lstar': 1.2663734650443368} [0,0,0,-a+1,a-2] {'Lstar': 1.4423431483767097} [1,1,0,4*a-7,7*a-12] {'Lstar': 1.40058926314229} [a,1,1,6*a-9,-6*a+10] {'Lstar': 1.4690761070275693} [a+1,-a+1,a+1,3*a-8,-4*a+5] {'Lstar': 0.92996118822906293} [a+1,0,a+1,9*a-17,-19*a+29] }}} {{{id=24| 7 curves left to find Lstar /// }}} {{{id=27| db.N1k.columns() /// [u'rhi', u'ordD', u'cond1', u'ainv2', u'ainv1', u'cond2', u'tor', u'tama', u'kod', u'sign', u'rlow', u'eta', u'found', u'N', u'ordj', u'nh', u'Lstar', u'fh', u'mtrx', u'label'] }}} {{{id=9| test=db("select N,eta,ainv1,Lstar,found from N1k ORDER BY N,eta,Lstar") /// }}} {{{id=19| test2=[] for t in range(len(test)): if type(test[t][3]) != type(float(2)): print test[t][2],test[t][3],test[t][4] /// }}} {{{id=28| list(db.N1k.find('N=836')) /// [{u'nh': 39.506714554756989, u'rlow': 1, u'tama': u'2,1,1', u'cond1': u'-2*a-28', u'ainv2': u'[a,0,a+1,-a,0]', u'ainv1': u'[a+1,-a,a,-a,-a+1]', u'cond2': u'2*a-30', u'tor': 1, u'Lstar': 1.27875348749, u'ordD': u'2,1,1', u'kod': u'I2,I1,I1', u'sign': u'-,-', u'rhi': 1, u'eta': 1692, u'label': u'836a2a', u'fh': -0.93545108014062595, u'found': u'J', u'N': 836, u'mtrx': u'matrix(1,[0])', u'ordj': u'2,1,1'}, {u'nh': 41.836555066281122, u'rlow': 0, u'tama': u'1,1,1', u'cond1': u'-2*a-28', u'ainv2': u'[a+1,-a,1,-1,0]', u'ainv1': u'[a,0,1,-a,0]', u'cond2': u'2*a-30', u'tor': 3, u'Lstar': 1.5108562088699999, u'ordD': u'1,1,1', u'kod': u'I1,I1,I1', u'sign': u'-,-', u'rhi': 0, u'eta': 1692, u'label': u'836a3a', u'fh': -1.0227461202109687, u'found': u'J', u'N': 836, u'mtrx': u'matrix(3,[0,3,0,3,0,3,0,3,0])', u'ordj': u'1,1,1'}, {u'nh': 53.356844089872212, u'rlow': 0, u'tama': u'1,3,3', u'cond1': u'-2*a-28', u'ainv2': u'[a+1,-a,1,-5*a+4,-2*a-4]', u'ainv1': u'[a,0,1,4*a,2*a-6]', u'cond2': u'2*a-30', u'tor': 3, u'Lstar': 1.5108562088745863, u'ordD': u'3,3,3', u'kod': u'I3,I3,I3', u'sign': u'-,-', u'rhi': 0, u'eta': 1692, u'label': u'836a1a', u'fh': -0.47343997587691361, u'found': u'CL', u'N': 836, u'ordj': u'3,3,3'}, {u'rlow': 0, u'tama': u'1,3,3', u'cond1': u'-2*a-28', u'ainv2': u'[a+1,a+1,a+1,-18*a-4,-11*a-10]', u'ainv1': u'[a,a,a+1,19*a-24,-13*a+21]', u'cond2': u'2*a-30', u'tor': 3, u'Lstar': u'REMOVE THIS CURVE', u'ordD': u'3,3,3', u'kod': u'I3,I3,I3', u'sign': u'-,-', u'rhi': 0, u'eta': 1692, u'label': u'836a1b', u'found': u'CL', u'N': 836, u'ordj': u'3,3,3'}, {u'rlow': 1, u'tama': u'3,1,2', u'cond1': u'26*a-10', u'ainv2': u'[1,a,0,-3*a-4,-7*a-3]', u'ainv1': u'[1,-a+1,0,3*a-7,7*a-10]', u'cond2': u'-26*a+16', u'tor': 2, u'Lstar': 1.3043748959826422, u'ordD': u'3,1,4', u'kod': u'I3,I1,I4', u'sign': u'+,+', u'rhi': 1, u'eta': 1708, u'label': u'836b1a', u'found': u'J', u'N': 836, u'ordj': u'3,1,4'}, {u'nh': 77.013517221962417, u'rlow': 0, u'tama': u'1,1,1', u'cond1': u'-2*a-28', u'ainv2': u'[a+1,-a,1,-105*a-206,-946*a-1272]', u'ainv1': u'[a,0,1,104*a-310,946*a-2218]', u'cond2': u'2*a-30', u'tor': 1, u'Lstar': 1.5108562088699999, u'ordD': u'9,1,1', u'kod': u'I9,I1,I1', u'sign': u'-,-', u'rhi': 0, u'eta': 1692, u'label': u'836a3b', u'fh': 0.07586616845714117, u'found': u'JI', u'N': 836, u'mtrx': u'matrix(3,[0,3,0,3,0,3,0,3,0])', u'ordj': u'9,1,1'}, {u'nh': 63.644586994565771, u'rlow': 1, u'tama': u'6,2,2', u'cond1': u'26*a-10', u'ainv2': u'[1,a,0,-23*a-24,69*a+33]', u'ainv1': u'[1,-a+1,0,23*a-47,-69*a+102]', u'cond2': u'-26*a+16', u'tor': 4, u'Lstar': 1.3043748959799999, u'ordD': u'6,2,2', u'kod': u'I6,I2,I2', u'sign': u'+,+', u'rhi': 1, u'eta': 1708, u'label': u'836b2a', u'fh': -0.28665957301952821, u'found': u'JI', u'N': 836, u'mtrx': u'matrix(4,[0,2,0,0,2,0,2,2,0,2,0,0,0,2,0,0])', u'ordj': u'6,2,2'}, {u'nh': 67.176983276444886, u'rlow': 1, u'tama': u'12,1,1', u'cond1': u'26*a-10', u'ainv2': u'[1,a,0,7*a+16,327*a+149]', u'ainv1': u'[1,-a+1,0,-7*a+23,-327*a+476]', u'cond2': u'-26*a+16', u'tor': 2, u'Lstar': 1.3043748959799999, u'ordD': u'12,1,1', u'kod': u'I12,I1,I1', u'sign': u'-,-', u'rhi': 1, u'eta': 1708, u'label': u'836b2c', u'fh': 0.059914017260444402, u'found': u'JI', u'N': 836, u'mtrx': u'matrix(4,[0,2,0,0,2,0,2,2,0,2,0,0,0,2,0,0])', u'ordj': u'12,1,1'}, {u'nh': 80.17912639899437, u'rlow': 1, u'tama': u'3,2,1', u'cond1': u'26*a-10', u'ainv2': u'[1,a,0,-373*a-384,5395*a+2621]', u'ainv1': u'[1,-a+1,0,373*a-757,-5395*a+8016]', u'cond2': u'-26*a+16', u'tor': 2, u'Lstar': 1.3043748959799999, u'ordD': u'3,4,1', u'kod': u'I3,I4,I1', u'sign': u'+,+', u'rhi': 1, u'eta': 1708, u'label': u'836b2b', u'fh': 0.05991401726044434, u'found': u'JI', u'N': 836, u'mtrx': u'matrix(4,[0,2,0,0,2,0,2,2,0,2,0,0,0,2,0,0])', u'ordj': u'3,4,1'}] }}} {{{id=26| db.N1k.delete(ainv1='[a,a,a+1,19*a-24,-13*a+21]') /// }}} {{{id=25| db.N1k.update({'Lstar':'REMOVE THIS CURVE'},ainv1='[a,a,a+1,19*a-24,-13*a+21]') /// }}} {{{id=18| for x in range(len(test)): print type(test[x][3]) /// }}} {{{id=17| len(test) /// 0 }}} {{{id=13| k=0 for s in range(len(test)): if type(test[s][3]) != type(float(2)): print test[s][3] /// 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 }}} {{{id=15| def f_height(ainv): E=EllipticCurve(K,ainv) phi1=K.embeddings(RR)[0] A1=E.period_lattice(phi1).basis() B1=sqrt(matrix(2,2,(A1[0].real(),A1[0].imag(),A1[1].real(),A1[1].imag())).determinant()) phi2=K.embeddings(RR)[1] A2=E.period_lattice(phi2).basis() B2=sqrt(matrix(2,2,(A2[0].real(),A2[0].imag(),A2[1].real(),A2[1].imag())).determinant()) C=(-1/2)*log(B1*B2) return C def n_height(E): A=EllipticCurve(K,E).short_weierstrass_model().a_invariants() B=log(max(4*(abs(A[3].norm())^3),27*((A[4].norm())^2))) return B /// }}} {{{id=29| test=db('select ainv1 from N1k ORDER BY N,eta') /// }}} {{{id=30| eval(test[0][0]) /// [1, a + 1, a, a, 0] }}} {{{id=31| len(test) /// 721 }}} {{{id=32| def f_height(ainv): E=EllipticCurve(K,ainv) phi1=K.embeddings(RR)[0] A1=E.period_lattice(phi1).basis() B1=sqrt(matrix(2,2,(A1[0].real(),A1[0].imag(),A1[1].real(),A1[1].imag())).determinant()) phi2=K.embeddings(RR)[1] A2=E.period_lattice(phi2).basis() B2=sqrt(matrix(2,2,(A2[0].real(),A2[0].imag(),A2[1].real(),A2[1].imag())).determinant()) C=(-1/2)*log(B1*B2) return C def n_height(E): A=EllipticCurve(K,E).short_weierstrass_model().a_invariants() B=log(max(4*(abs(A[3].norm())^3),27*((A[4].norm())^2))) return B /// }}} {{{id=14| k=0 for t in range(len(test)): A=test[t] h=f_height(eval(A[0])) n=n_height(eval(A[0])) db.N1k.update({'fh':float(h), 'nh':float(n)}, ainv1=test[t][0]) k+=1 print k /// WARNING: Output truncated! full_output.txt 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 ... 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 }}} {{{id=33| f /// }}} {{{id=34| temp=db('select N,eta,Lstar,fh,nh,ainv1 from N1k ORDER BY N,eta,Lstar,fh,nh') /// }}} {{{id=35| for t in range(len(temp)): if type(temp[t][4]) != type(float(2)): print temp[t][3],temp[t][4], temp[5] /// }}} {{{id=16| temp=db("select N,eta,Lstar,fh,nh,ainv1 from N1k ORDER BY N,eta,Lstar,fh,nh") /// }}} {{{id=36| %time N=0 lastchar1=ord('a') L=1 lastchar2=ord('a') test=[] for s in range(len(temp)): A=temp[s] if temp[s][0] != temp[s-1][0]: #this instance is a curve with a new norm than the previous entry N=int(temp[s][0]) lastchar1=ord('a') L=1 lastchar2=ord('a') else: if temp[s][1]==temp[s-1][1]: if temp[s][2]==temp[s-1][2]: lastchar2+=1 else: L+=1 lastchar2=ord('a') else: lastchar1+=1 L=1 lastchar2=ord('a') key=str(N)+chr(lastchar1)+str(L)+chr(lastchar2) db.N1k.update({'label': key},ainv1=A[5]) /// CPU time: 3.44 s, Wall time: 20.62 s }}} {{{id=37| temp2=db('select label,N,eta,Lstar,fh,nh,cond1,cond2,ainv1,ainv2,rlow,rhi,tor,sign,ordD,ordj,tama,kod from N1k ORDER BY N,eta,Lstar,fh,nh') /// }}} {{{id=39| len(temp2) /// 721 }}} {{{id=12| def printer(): J=open('/home/psharaba/ECD/Fulllist2.txt','w') for y in temp2: S=[] for entry in y: s=str(entry) s.replace(' ','') S.append(s) J.write(' '.join(S)+'\n') /// }}} {{{id=38| printer() /// }}} {{{id=40| /// }}}