当前位置: 首页>>代码示例>>Python>>正文


Python ZZ.abs方法代码示例

本文整理汇总了Python中sage.all.ZZ.abs方法的典型用法代码示例。如果您正苦于以下问题:Python ZZ.abs方法的具体用法?Python ZZ.abs怎么用?Python ZZ.abs使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在sage.all.ZZ的用法示例。


在下文中一共展示了ZZ.abs方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: render_hgm_webpage

# 需要导入模块: from sage.all import ZZ [as 别名]
# 或者: from sage.all.ZZ import abs [as 别名]
def render_hgm_webpage(args):
    data = None
    info = {}
    if 'label' in args:
        label = clean_input(args['label'])
        C = base.getDBConnection()
        data = C.hgm.motives.find_one({'label': label})
        if data is None:
            bread = get_bread([("Search error", url_for('.search'))])
            info['err'] = "Motive " + label + " was not found in the database."
            info['label'] = label
            return search_input_error(info, bread)
        title = 'Hypergeometric Motive:' + label
        A = data['A']
        B = data['B']
        tn,td = data['t']
        t = latex(QQ(str(tn)+'/'+str(td)))
        primes = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71]
        locinfo = data['locinfo']
        for j in range(len(locinfo)):
            locinfo[j] = [primes[j]] + locinfo[j]
            locinfo[j][2] = poly_with_factored_coeffs(locinfo[j][2], primes[j])
        hodge = data['hodge']
        prop2 = [
            ('Degree', '\(%s\)' % data['degree']),
            ('Weight',  '\(%s\)' % data['weight']),
            ('Conductor', '\(%s\)' % data['cond']),
        ]
        # Now add factorization of conductor
        Cond = ZZ(data['cond'])
        if not (Cond.abs().is_prime() or Cond == 1):
            data['cond'] = "%s=%s" % (str(Cond), factorint(data['cond']))

        info.update({
                    'A': A,
                    'B': B,
                    't': t,
                    'degree': data['degree'],
                    'weight': data['weight'],
                    'sign': data['sign'],
                    'sig': data['sig'],
                    'hodge': hodge,
                    'cond': data['cond'],
                    'req': data['req'],
                    'locinfo': locinfo
                    })
        AB_data, t_data = data["label"].split("_t")
        #AB_data = data["label"].split("_t")[0]
        friends = [("Motive family "+AB_data.replace("_"," "), url_for(".by_family_label", label = AB_data))]
        friends.append(('L-function', url_for("l_functions.l_function_hgm_page", label=AB_data, t='t'+t_data)))
#        if rffriend != '':
#            friends.append(('Discriminant root field', rffriend))


        bread = get_bread([(label, ' ')])
        return render_template("hgm-show-motive.html", credit=HGM_credit, title=title, bread=bread, info=info, properties2=prop2, friends=friends)
开发者ID:StockpotCreative,项目名称:lmfdb,代码行数:58,代码来源:main.py

示例2: render_hgm_webpage

# 需要导入模块: from sage.all import ZZ [as 别名]
# 或者: from sage.all.ZZ import abs [as 别名]
def render_hgm_webpage(label):
    data = None
    info = {}
    data = db.hgm_motives.lookup(label)
    if data is None:
        abort(404, "Hypergeometric motive " + label + " was not found in the database.")
    title = 'Hypergeometric Motive:' + label
    A = data['A']
    B = data['B']
    det = db.hgm_families.lucky({'A': A, 'B': B}, 'det')
    if det is None:
        det = 'data not computed'
    else:
        det = [det[0],str(det[1])]
        d1 = det[1]
        d1 = re.sub(r'\s','', d1)
        d1 = re.sub(r'(.)\(', r'\1*(', d1)
        R = PolynomialRing(ZZ, 't')
        if det[1]=='':
            d2 = R(1)
        else:
            d2 = R(d1)
        det = d2(QQ(data['t']))*det[0]
    t = latex(QQ(data['t']))
    typee = 'Orthogonal'
    if (data['weight'] % 2) == 1 and (data['degree'] % 2) == 0:
        typee = 'Symplectic'
    primes = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71]
    locinfo = data['locinfo']
    for j in range(len(locinfo)):
        locinfo[j] = [primes[j]] + locinfo[j]
        #locinfo[j][2] = poly_with_factored_coeffs(locinfo[j][2], primes[j])
        locinfo[j][2] = list_to_factored_poly_otherorder(locinfo[j][2], vari='x')
    hodge = data['hodge']
    famhodge = data['famhodge']
    prop2 = [
        ('Degree', '\(%s\)' % data['degree']),
        ('Weight',  '\(%s\)' % data['weight']),
        ('Hodge vector',  '\(%s\)' % hodge),
        ('Conductor', '\(%s\)' % data['cond']),
    ]
    # Now add factorization of conductor
    Cond = ZZ(data['cond'])
    if not (Cond.abs().is_prime() or Cond == 1):
        data['cond'] = "%s=%s" % (str(Cond), factorint(data['cond']))

    info.update({
                'A': A,
                'B': B,
                't': t,
                'degree': data['degree'],
                'weight': data['weight'],
                'sign': data['sign'],
                'sig': data['sig'],
                'hodge': hodge,
                'famhodge': famhodge,
                'cond': data['cond'],
                'req': data['req'],
                'lcms': data['lcms'],
                'type': typee,
                'det': det,
                'locinfo': locinfo
                })
    AB_data, t_data = data["label"].split("_t")
    friends = [("Motive family "+AB_data.replace("_"," "), url_for(".by_family_label", label = AB_data))]
    friends.append(('L-function', url_for("l_functions.l_function_hgm_page", label=AB_data, t='t'+t_data)))
#    if rffriend != '':
#        friends.append(('Discriminant root field', rffriend))


    bread = get_bread([(label, ' ')])
    return render_template("hgm-show-motive.html", credit=HGM_credit, title=title, bread=bread, info=info, properties2=prop2, friends=friends, learnmore=learnmore_list())
开发者ID:sanni85,项目名称:lmfdb,代码行数:74,代码来源:main.py


注:本文中的sage.all.ZZ.abs方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。