示例#1
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,db()), 1]
    newthing = familydb().find_one({'A': myA, 'B': myB})
    if newthing is None:
        return ['??', 1]
    newthing = newthing['mono'][pind[ell]]
    newthing[1] = dogapthing(newthing[1])
    return [newthing[1][2], newthing[1][0]]
示例#2
0
文件: main.py 项目: sanni85/lmfdb
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]]
示例#3
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],db())
        except TypeError:
            m1[2] = 'Gap[%d,%d]' % (two[0],two[1])
    else:
        m1[2] = '$%s$'% m1[2]
    return m1
示例#4
0
文件: main.py 项目: sanni85/lmfdb
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:
        m1[2] = '$%s$'% m1[2]
    return m1
示例#5
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,db()), 1]
    newthing = familydb().find_one({'A': myA, 'B': myB})
    if newthing is None:
        return ['??', 1]
    newthing = newthing['mono'][pind[ell]]
    newthing[1] = dogapthing(newthing[1])
    return [newthing[1][2], newthing[1][0]]
示例#6
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
示例#7
0
def render_group_webpage(args):
    data = None
    info = {}
    if 'label' in args:
        label = clean_input(args['label'])
        label = label.replace('t', 'T')
        C = base.getDBConnection()
        data = C.transitivegroups.groups.find_one({'label': label})
        if data is None:
            bread = get_bread([("Search Error", ' ')])
            info['err'] = "Group " + label + " was not found in the database."
            info['label'] = label
            return search_input_error(info, bread)
        data['label_raw'] = label.lower()
        title = 'Galois Group: ' + label
        wgg = WebGaloisGroup.from_data(data)
        n = data['n']
        t = data['t']
        data['yesno'] = yesno
        order = data['order']
        data['orderfac'] = latex(ZZ(order).factor())
        orderfac = latex(ZZ(order).factor())
        data['ordermsg'] = "$%s=%s$" % (order, latex(orderfac))
        if order == 1:
            data['ordermsg'] = "$1$"
        if ZZ(order).is_prime():
            data['ordermsg'] = "$%s$ (is prime)" % order
        pgroup = len(ZZ(order).prime_factors()) < 2
        if n == 1:
            G = gap.SmallGroup(n, t)
        else:
            G = gap.TransitiveGroup(n, t)
        if ZZ(order) < ZZ('10000000000'):
            ctable = chartable(n, t)
        else:
            ctable = 'Group too large'
        data['gens'] = generators(n, t)
        if n == 1 and t == 1:
            data['gens'] = 'None needed'
        data['chartable'] = ctable
        data['parity'] = "$%s$" % data['parity']
        data['cclasses'] = conjclasses(G, n)
        data['subinfo'] = subfield_display(C, n, data['subs'])
        data['resolve'] = resolve_display(C, data['resolve'])
        if data['gapid'] == 0:
            data['gapid'] = "Data not available"
        else:
            data['gapid'] = small_group_display_knowl(int(data['order']),int(data['gapid']),C, str([int(data['order']),int(data['gapid'])]))
        data['otherreps'] = wgg.otherrep_list()
        ae = wgg.arith_equivalent()
        if ae>0:
            if ae>1:
                data['arith_equiv'] = r'A number field with this Galois group has %d <a knowl="nf.arithmetically_equivalent", title="arithmetically equivalent">arithmetically equivalent</a> fields.'% ae
            else:
                data['arith_equiv'] = r'A number field with this Galois group has exactly one <a knowl="nf.arithmetically_equivalent", title="arithmetically equivalent">arithmetically equivalent</a> field.'
        else:
            data['arith_equiv'] = r'A number field with this Galois group has no <a knowl="nf.arithmetically_equivalent", title="arithmetically equivalent">arithmetically equivalent</a> fields.'
        if len(data['otherreps']) == 0:
            data['otherreps']="There is no other low degree representation."
        query={'galois': bson.SON([('n', n), ('t', t)])}
        C = base.getDBConnection()
        intreps = C.transitivegroups.Gmodules.find({'n': n, 't': t}).sort('index', pymongo.ASCENDING)
        # turn cursor into a list
        intreps = [z for z in intreps]
        if len(intreps) > 0:
            data['int_rep_classes'] = [str(z[0]) for z in intreps[0]['gens']]
            for onerep in intreps:
                onerep['gens']=[list_to_latex_matrix(z[1]) for z in onerep['gens']]
            data['int_reps'] = intreps
            data['int_reps_complete'] = int_reps_are_complete(intreps)
            dcq = data['moddecompuniq']
            if dcq[0] == 0:
                data['decompunique'] = 0
            else:
                data['decompunique'] = dcq[0]
                data['isoms'] = [[mult2mult(z[0]), mult2mult(z[1])] for z in dcq[1]]
                data['isoms'] = [[modules2string(n,t,z[0]), modules2string(n,t,z[1])] for z in data['isoms']]
                #print dcq[1]
                #print data['isoms']

        friends = []
        one = C.numberfields.fields.find_one(query)
        if one:
            friends.append(('Number fields with this Galois group', url_for('number_fields.number_field_render_webpage')+"?galois_group=%dT%d" % (n, t) )) 
        prop2 = [('Label', label),
            ('Order', '\(%s\)' % order),
            ('n', '\(%s\)' % data['n']),
            ('Cyclic', yesno(data['cyc'])),
            ('Abelian', yesno(data['ab'])),
            ('Solvable', yesno(data['solv'])),
            ('Primitive', yesno(data['prim'])),
            ('$p$-group', yesno(pgroup)),
        ]
        pretty = group_display_pretty(n,t,C)
        if len(pretty)>0:
            prop2.extend([('Group:', pretty)])
            info['pretty_name'] = pretty
        data['name'] = re.sub(r'_(\d+)',r'_{\1}',data['name'])
        data['name'] = re.sub(r'\^(\d+)',r'^{\1}',data['name'])
        info.update(data)

        bread = get_bread([(label, ' ')])
        return render_template("gg-show-group.html", credit=GG_credit, title=title, bread=bread, info=info, properties2=prop2, friends=friends)
示例#8
0
def render_group_webpage(args):
    data = None
    info = {}
    if 'label' in args:
        label = clean_input(args['label'])
        label = label.replace('t', 'T')
        C = base.getDBConnection()
        data = C.transitivegroups.groups.find_one({'label': label})
        if data is None:
            bread = get_bread([("Search Error", ' ')])
            info['err'] = "Group " + label + " was not found in the database."
            info['label'] = label
            return search_input_error(info, bread)
        data['label_raw'] = label.lower()
        title = 'Galois Group: ' + label
        wgg = WebGaloisGroup.from_data(data)
        n = data['n']
        t = data['t']
        data['yesno'] = yesno
        order = data['order']
        data['orderfac'] = latex(ZZ(order).factor())
        orderfac = latex(ZZ(order).factor())
        data['ordermsg'] = "$%s=%s$" % (order, latex(orderfac))
        if order == 1:
            data['ordermsg'] = "$1$"
        if ZZ(order).is_prime():
            data['ordermsg'] = "$%s$ (is prime)" % order
        pgroup = len(ZZ(order).prime_factors()) < 2
        if n == 1:
            G = gap.SmallGroup(n, t)
        else:
            G = gap.TransitiveGroup(n, t)
        if ZZ(order) < ZZ('10000000000'):
            ctable = chartable(n, t)
        else:
            ctable = 'Group too large'
        data['gens'] = generators(n, t)
        if n == 1 and t == 1:
            data['gens'] = 'None needed'
        data['chartable'] = ctable
        data['parity'] = "$%s$" % data['parity']
        data['cclasses'] = conjclasses(G, n)
        data['subinfo'] = subfield_display(C, n, data['subs'])
        data['resolve'] = resolve_display(C, data['resolve'])
        if data['gapid'] == 0:
            data['gapid'] = "Data not available"
        else:
            data['gapid'] = small_group_display_knowl(int(data['order']),int(data['gapid']),C, str([int(data['order']),int(data['gapid'])]))
        data['otherreps'] = wgg.otherrep_list()
        ae = wgg.arith_equivalent()
        if ae>0:
            if ae>1:
                data['arith_equiv'] = r'A number field with this Galois group has %d <a knowl="nf.arithmetically_equivalent", title="arithmetically equivalent">arithmetically equivalent</a> fields.'% ae
            else:
                data['arith_equiv'] = r'A number field with this Galois group has exactly one <a knowl="nf.arithmetically_equivalent", title="arithmetically equivalent">arithmetically equivalent</a> field.'
        else:
            data['arith_equiv'] = r'A number field with this Galois group has no <a knowl="nf.arithmetically_equivalent", title="arithmetically equivalent">arithmetically equivalent</a> fields.'
        if len(data['otherreps']) == 0:
            data['otherreps']="There is no other low degree representation."
        query={'galois': bson.SON([('n', n), ('t', t)])}
        C = base.getDBConnection()
        intreps = C.transitivegroups.Gmodules.find({'n': n, 't': t}).sort('index', pymongo.ASCENDING)
        # turn cursor into a list
        intreps = [z for z in intreps]
        if len(intreps) > 0:
            data['int_rep_classes'] = [str(z[0]) for z in intreps[0]['gens']]
            for onerep in intreps:
                onerep['gens']=[list_to_latex_matrix(z[1]) for z in onerep['gens']]
            data['int_reps'] = intreps
            data['int_reps_complete'] = int_reps_are_complete(intreps)
            dcq = data['moddecompuniq']
            if dcq[0] == 0:
                data['decompunique'] = 0
            else:
                data['decompunique'] = dcq[0]
                data['isoms'] = [[mult2mult(z[0]), mult2mult(z[1])] for z in dcq[1]]
                data['isoms'] = [[modules2string(n,t,z[0]), modules2string(n,t,z[1])] for z in data['isoms']]
                #print dcq[1]
                #print data['isoms']

        friends = []
        one = C.numberfields.fields.find_one(query)
        if one:
            friends.append(('Number fields with this Galois group', url_for('number_fields.number_field_render_webpage')+"?galois_group=%dT%d" % (n, t) )) 
        prop2 = [('Label', label),
            ('Order', '\(%s\)' % order),
            ('n', '\(%s\)' % data['n']),
            ('Cyclic', yesno(data['cyc'])),
            ('Abelian', yesno(data['ab'])),
            ('Solvable', yesno(data['solv'])),
            ('Primitive', yesno(data['prim'])),
            ('$p$-group', yesno(pgroup)),
        ]
        pretty = group_display_pretty(n,t,C)
        if len(pretty)>0:
            prop2.extend([('Group:', pretty)])
            info['pretty_name'] = pretty
        data['name'] = re.sub(r'_(\d+)',r'_{\1}',data['name'])
        data['name'] = re.sub(r'\^(\d+)',r'^{\1}',data['name'])
        info.update(data)

        bread = get_bread([(label, ' ')])
        return render_template("gg-show-group.html", credit=GG_credit, title=title, bread=bread, info=info, properties2=prop2, friends=friends)
示例#9
0
def render_hgm_family_webpage(args):
    data = None
    info = {}
    if 'label' in args:
        label = clean_input(args['label'])
        data = familydb().find_one({'label': label})
        if data is None:
            bread = get_bread([("Search error", url_for('.search'))])
            info['err'] = "Family of hypergeometric motives " + label + " was not found in the database."
            info['label'] = label
            return search_input_error(info, bread)
        title = 'Hypergeometric Motive Family:' + label
        A = string2list(data['A'])
        B = string2list(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 = string2list(data['snf'])
        snf = list2Cnstring(snf)
        typee = 'Orthogonal'
        if (data['weight'] % 2) == 1 and (data['degree'] % 2) == 0:
            typee = 'Symplectic'
        ppart = [[2, [string2list(u) for u in [data['A2'],data['B2'],data['C2']]]],
            [3, [string2list(u) for u in [data['A3'],data['B3'],data['C3']]]],
            [5, [string2list(u) for u in [data['A5'],data['B5'],data['C5']]]],
            [7, [string2list(u) for u in [data['A7'],data['B7'],data['C7']]]]]
        prop2 = [
            ('Degree', '\(%s\)' % data['degree']),
            ('Weight',  '\(%s\)' % data['weight'])
        ]
        mono = [[m[0], dogapthing(m[1]), 
          getgroup(m[1],m[0]),
          latex(ZZ(m[1][0]).factor())] for m in data['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,db()),
                    '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())
示例#10
0
文件: main.py 项目: sanni85/lmfdb
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())