def projective_group(self): gapid = self._data['Proj_GAP'] smallg = None if gapid[0]: smallg = db.gps_small.lookup('%s.%s' % (gapid[0], gapid[1])) if smallg: return small_group_display_knowl(gapid[0], gapid[1]) ntj = self._data['Proj_nTj'] if ntj[1]: return group_display_knowl(ntj[0], ntj[1]) if smallg: return 'Group with GAP id [%s, %s]' % (gapid[0], gapid[1]) return 'data not computed'
def getgroup(m1, ell): pind = {2: 0, 3: 1, 5: 2, 7: 3, 11: 4, 13: 5} if not m1[3][2]: return [m1[2], m1[0]] myA = m1[3][0] myB = m1[3][1] if not myA and not myB: # myA = myB = [] return [small_group_display_knowl(1, 1), 1] mono = db.hgm_families.lucky({'A': myA, 'B': myB}, projection="mono") if mono is None: return ['??', 1] newthing = mono[pind[ell]] newthing = dogapthing(newthing[1]) return [newthing[2], newthing[0]]
def getgroup(m1, ell): pind = {2: 0, 3: 1, 5: 2, 7: 3, 11: 4, 13: 5} if len(m1[3][2]) == 0: return [m1[2], m1[0]] myA = list2string(m1[3][0]) myB = list2string(m1[3][1]) if len(myA) == 0 and len(myB) == 0: return [small_group_display_knowl(1, 1), 1] mono = db.hgm_families.lucky({'A': myA, 'B': myB}, projection="mono") if mono is None: return ['??', 1] newthing = mono[pind[ell]] newthing = dogapthing(newthing[1]) return [newthing[2], newthing[0]]
def getgroup(m1,ell): pind = {2: 0,3:1,5:2,7:3,11:4,13:5} if len(m1[3][2])==0: return [m1[2], m1[0]] myA = list2string(m1[3][0]) myB = list2string(m1[3][1]) if len(myA)==0 and len(myB)==0: return [small_group_display_knowl(1,1), 1] mono = db.hgm_families.lucky({'A': myA, 'B': myB}, projection="mono") if mono is None: return ['??', 1] newthing = mono[pind[ell]] newthing = dogapthing(newthing[1]) return [newthing[2], newthing[0]]
def dogapthing(m1): mnew = str(m1[2]) mnew = mnew.replace(' ', '') if GAP_ID_RE.match(mnew): mnew = mnew[1:-1] two = mnew.split(',') two = [int(j) for j in two] try: m1[2] = small_group_display_knowl(two[0], two[1]) except TypeError: m1[2] = 'Gap[%d,%d]' % (two[0], two[1]) else: # Fix multiple backslashes m1[2] = re.sub(r'\\+', r'\\', m1[2]) m1[2] = '$%s$' % m1[2] return m1
def dogapthing(m1): mnew = str(m1[2]) mnew = mnew.replace(' ','') if GAP_ID_RE.match(mnew): mnew = mnew[1:-1] two = mnew.split(',') two = [int(j) for j in two] try: m1[2] = small_group_display_knowl(two[0],two[1]) except TypeError: m1[2] = 'Gap[%d,%d]' % (two[0],two[1]) else: # Fix multiple backslashes m1[2] = re.sub(r'\\+', r'\\', m1[2]) m1[2] = '$%s$'% m1[2] return m1
def render_hgm_family_webpage(label): data = None info = {} data = db.hgm_families.lookup(label) if data is None: abort( 404, "Hypergeometric motive family " + label + " was not found in the database.") title = 'Hypergeometric Motive Family:' + label A = data['A'] B = data['B'] hodge = data['famhodge'] mydet = data['det'] detexp = QQ(data['weight'] * data['degree']) detexp = -detexp / 2 mydet = r'\Q(%s)\otimes\Q(\sqrt{' % str(detexp) if int(data['det'][0]) != 1: mydet += str(data['det'][0]) if len(data['det'][1]) > 0: mydet += data['det'][1] if int(data['det'][0]) == 1 and len(data['det'][1]) == 0: mydet += '1' mydet += '})' bezoutmat = matrix(data['bezout']) bezoutdet = bezoutmat.det() bezoutmat = latex(bezoutmat) snf = data['snf'] snf = list2Cnstring(snf) typee = 'Orthogonal' if (data['weight'] % 2) == 1 and (data['degree'] % 2) == 0: typee = 'Symplectic' ppart = [[2, [data['A2'], data['B2'], data['C2']]], [3, [data['A3'], data['B3'], data['C3']]], [5, [data['A5'], data['B5'], data['C5']]], [7, [data['A7'], data['B7'], data['C7']]]] prop2 = [('Degree', '\(%s\)' % data['degree']), ('Weight', '\(%s\)' % data['weight'])] mono = [m for m in data['mono'] if m[1] != 0] mono = [[ m[0], dogapthing(m[1]), getgroup(m[1], m[0]), latex(ZZ(m[1][0]).factor()) ] for m in mono] mono = [[m[0], m[1], m[2][0], splitint(m[1][0] / m[2][1], m[0]), m[3]] for m in mono] info.update({ 'A': A, 'B': B, 'degree': data['degree'], 'weight': data['weight'], 'hodge': hodge, 'det': mydet, 'snf': snf, 'bezoutmat': bezoutmat, 'bezoutdet': bezoutdet, 'mono': mono, 'imprim': data['imprim'], 'ppart': ppart, 'type': typee, 'junk': small_group_display_knowl(18, 2), 'showlist': showlist }) friends = [('Motives in the family', url_for('hypergm.index') + "?A=%s&B=%s" % (str(A), str(B)))] # if unramfriend != '': # friends.append(('Unramified subfield', unramfriend)) # if rffriend != '': # friends.append(('Discriminant root field', rffriend)) info.update({ "plotcircle": url_for(".hgm_family_circle_image", AB="A" + ".".join(map(str, A)) + "_B" + ".".join(map(str, B))) }) info.update({ "plotlinear": url_for(".hgm_family_linear_image", AB="A" + ".".join(map(str, A)) + "_B" + ".".join(map(str, B))) }) info.update({ "plotconstant": url_for(".hgm_family_constant_image", AB="A" + ".".join(map(str, A)) + "_B" + ".".join(map(str, B))) }) bread = get_bread([(label, ' ')]) return render_template("hgm-show-family.html", credit=HGM_credit, title=title, bread=bread, info=info, properties2=prop2, friends=friends, learnmore=learnmore_list())
def compformatter(comp): n, k = compdata(comp) return small_group_display_knowl(n, k, cache=compcache())
def render_hgm_family_webpage(label): data = None info = {} data = db.hgm_families.lookup(label) if data is None: abort(404, "Hypergeometric motive family " + label + " was not found in the database.") title = 'Hypergeometric Motive Family:' + label A = data['A'] B = data['B'] hodge = data['famhodge'] mydet = data['det'] detexp = QQ(data['weight']*data['degree']) detexp = -detexp/2 mydet = r'\Q(%s)\otimes\Q(\sqrt{'%str(detexp) if int(data['det'][0]) != 1: mydet += str(data['det'][0]) if len(data['det'][1])>0: mydet += data['det'][1] if int(data['det'][0]) == 1 and len(data['det'][1])==0: mydet += '1' mydet += '})' bezoutmat = matrix(data['bezout']) bezoutdet = bezoutmat.det() bezoutmat = latex(bezoutmat) snf = data['snf'] snf = list2Cnstring(snf) typee = 'Orthogonal' if (data['weight'] % 2) == 1 and (data['degree'] % 2) == 0: typee = 'Symplectic' ppart = [[2, [data['A2'],data['B2'],data['C2']]], [3, [data['A3'],data['B3'],data['C3']]], [5, [data['A5'],data['B5'],data['C5']]], [7, [data['A7'],data['B7'],data['C7']]]] prop2 = [ ('Degree', '\(%s\)' % data['degree']), ('Weight', '\(%s\)' % data['weight']) ] mono = [m for m in data['mono'] if m[1] != 0] mono = [[m[0], dogapthing(m[1]), getgroup(m[1],m[0]), latex(ZZ(m[1][0]).factor())] for m in mono] mono = [[m[0], m[1], m[2][0], splitint(m[1][0]/m[2][1],m[0]), m[3]] for m in mono] info.update({ 'A': A, 'B': B, 'degree': data['degree'], 'weight': data['weight'], 'hodge': hodge, 'det': mydet, 'snf': snf, 'bezoutmat': bezoutmat, 'bezoutdet': bezoutdet, 'mono': mono, 'imprim': data['imprim'], 'ppart': ppart, 'type': typee, 'junk': small_group_display_knowl(18,2), 'showlist': showlist }) friends = [('Motives in the family', url_for('hypergm.index')+"?A=%s&B=%s" % (str(A), str(B)))] # if unramfriend != '': # friends.append(('Unramified subfield', unramfriend)) # if rffriend != '': # friends.append(('Discriminant root field', rffriend)) info.update({"plotcircle": url_for(".hgm_family_circle_image", AB = "A"+".".join(map(str,A))+"_B"+".".join(map(str,B)))}) info.update({"plotlinear": url_for(".hgm_family_linear_image", AB = "A"+".".join(map(str,A))+"_B"+".".join(map(str,B)))}) info.update({"plotconstant": url_for(".hgm_family_constant_image", AB = "A"+".".join(map(str,A))+"_B"+".".join(map(str,B)))}) bread = get_bread([(label, ' ')]) return render_template("hgm-show-family.html", credit=HGM_credit, title=title, bread=bread, info=info, properties2=prop2, friends=friends, learnmore=learnmore_list())
def render_field_webpage(args): data = None info = {} if 'label' in args: label = clean_input(args['label']) data = db.lf_fields.lookup(label) if data is None: if re.match(r'^\d+\.\d+\.\d+\.\d+$', label): flash_error("Field %s was not found in the database.", label) else: flash_error("%s is not a valid label for a $p$-adic field.", label) return redirect(url_for(".index")) title = '$p$-adic field ' + prettyname(data) titletag = 'p-adic field ' + prettyname(data) polynomial = coeff_to_poly(data['coeffs']) p = data['p'] Qp = r'\Q_{%d}' % p e = data['e'] f = data['f'] cc = data['c'] gt = int(data['galois_label'].split('T')[1]) gn = data['n'] the_gal = WebGaloisGroup.from_nt(gn, gt) isgal = ' Galois' if the_gal.order() == gn else ' not Galois' abelian = ' and abelian' if the_gal.is_abelian() else '' galphrase = 'This field is' + isgal + abelian + r' over $\Q_{%d}.$' % p autstring = r'\Gal' if the_gal.order() == gn else r'\Aut' prop2 = [ ('Label', label), ('Base', r'\(%s\)' % Qp), ('Degree', r'\(%s\)' % data['n']), ('e', r'\(%s\)' % e), ('f', r'\(%s\)' % f), ('c', r'\(%s\)' % cc), ('Galois group', group_pretty_and_nTj(gn, gt)), ] # Look up the unram poly so we can link to it unramlabel = db.lf_fields.lucky({'p': p, 'n': f, 'c': 0}, projection=0) if unramlabel is None: logger.fatal("Cannot find unramified field!") unramfriend = '' else: unramfriend = url_for_label(unramlabel) unramdata = db.lf_fields.lookup(unramlabel) Px = PolynomialRing(QQ, 'x') Pt = PolynomialRing(QQ, 't') Ptx = PolynomialRing(Pt, 'x') if data['f'] == 1: unramp = r'$%s$' % Qp eisenp = Ptx(str(data['eisen']).replace('y', 'x')) eisenp = raw_typeset(eisenp, web_latex(eisenp)) else: unramp = data['unram'].replace('t', 'x') unramp = raw_typeset(unramp, web_latex(Px(str(unramp)))) unramp = prettyname( unramdata ) + ' $\\cong ' + Qp + '(t)$ where $t$ is a root of ' + unramp eisenp = Ptx(str(data['eisen']).replace('y', 'x')) eisenp = raw_typeset(str(eisenp), web_latex(eisenp), extra=r'$\ \in' + Qp + '(t)[x]$') rflabel = db.lf_fields.lucky( { 'p': p, 'n': { '$in': [1, 2] }, 'rf': data['rf'] }, projection=0) if rflabel is None: logger.fatal("Cannot find discriminant root field!") rffriend = '' else: rffriend = url_for_label(rflabel) gsm = data['gsm'] if gsm == [0]: gsm = 'Not computed' elif gsm == [-1]: gsm = 'Does not exist' else: gsm = lf_formatfield(','.join(str(b) for b in gsm)) if 'wild_gap' in data: wild_inertia = small_group_display_knowl(data['wild_gap'][0], data['wild_gap'][1]) else: wild_inertia = 'data not computed' info.update({ 'polynomial': raw_typeset(polynomial), 'n': data['n'], 'p': p, 'c': data['c'], 'e': data['e'], 'f': data['f'], 't': data['t'], 'u': data['u'], 'rf': lf_display_knowl(rflabel, name=printquad(data['rf'], p)), 'base': lf_display_knowl(str(p) + '.1.0.1', name='$%s$' % Qp), 'hw': data['hw'], 'slopes': show_slopes(data['slopes']), 'gal': group_pretty_and_nTj(gn, gt, True), 'gt': gt, 'inertia': group_display_inertia(data['inertia']), 'wild_inertia': wild_inertia, 'unram': unramp, 'eisen': eisenp, 'gms': data['gms'], 'gsm': gsm, 'galphrase': galphrase, 'autstring': autstring, 'subfields': format_subfields(data['subfields'], p), 'aut': data['aut'], }) friends = [('Galois group', "/GaloisGroup/%dT%d" % (gn, gt))] if unramfriend != '': friends.append(('Unramified subfield', unramfriend)) if rffriend != '': friends.append(('Discriminant root field', rffriend)) if db.nf_fields.exists({'local_algs': {'$contains': label}}): friends.append( ('Number fields with this completion', url_for('number_fields.number_field_render_webpage') + "?completions={}".format(label))) bread = get_bread([(label, ' ')]) return render_template( "lf-show-field.html", title=title, titletag=titletag, bread=bread, info=info, properties=prop2, friends=friends, learnmore=learnmore_list(), KNOWL_ID="lf.%s" % label, )