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


Python ZZ.valuation方法代码示例

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


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

示例1: twoadic

# 需要导入模块: from sage.rings.all import ZZ [as 别名]
# 或者: from sage.rings.all.ZZ import valuation [as 别名]
def twoadic(line):
    r""" Parses one line from a 2adic file.  Returns the label and a dict
    containing fields with keys '2adic_index', '2adic_log_level',
    '2adic_gens' and '2adic_label'.

    Input line fields:

    conductor iso number ainvs index level gens label

    Sample input lines:

    110005 a 2 [1,-1,1,-185793,29503856] 12 4 [[3,0,0,1],[3,2,2,3],[3,0,0,3]] X24
    27 a 1 [0,0,1,0,-7] inf inf [] CM
    """
    data = split(line)
    assert len(data) == 8
    label = data[0] + data[1] + data[2]
    model = data[7]
    if model == "CM":
        return label, {"2adic_index": int(0), "2adic_log_level": None, "2adic_gens": None, "2adic_label": None}

    index = int(data[4])
    level = ZZ(data[5])
    log_level = int(level.valuation(2))
    assert 2 ** log_level == level
    if data[6] == "[]":
        gens = []
    else:
        gens = data[6][1:-1].replace("],[", "];[").split(";")
        gens = [[int(c) for c in g[1:-1].split(",")] for g in gens]

    return label, {"2adic_index": index, "2adic_log_level": log_level, "2adic_gens": gens, "2adic_label": model}
开发者ID:nmascot,项目名称:lmfdb,代码行数:34,代码来源:import_ec_data.py

示例2: period_from_coords

# 需要导入模块: from sage.rings.all import ZZ [as 别名]
# 或者: from sage.rings.all.ZZ import valuation [as 别名]
def period_from_coords(p, E, P, prec=20):
    r"""
    Given a point `P` in the formal group of the elliptic curve `E` with split multiplicative reduction,
    this produces an element `u` in `\QQ_p^{\times}` mapped to the point `P` by the Tate parametrisation.
    The algorithm return the unique such element in `1+p\ZZ_p`.

    INPUT:

    - ``P`` - a point on the elliptic curve.

    - ``prec`` - the `p`-adic precision, default is 20.

    """
    R = Qp(p, prec)
    if P[0].valuation(p) >= 0:
        raise ValueError, "The point must lie in the formal group."
    Etate = E.tate_curve(p)
    Eq = Etate.curve(prec=prec)
    isom = Etate._isomorphism(prec=prec)
    C = isom[0]
    r = isom[1]
    s = isom[2]
    t = isom[3]
    xx = r + C ** 2 * P[0]
    yy = t + s * C ** 2 * P[0] + C ** 3 * P[1]
    try:
        EqCp = Eq.change_ring(yy.parent())
        Pq = EqCp([xx, yy])
    except:
        raise RuntimeError, "Bug : Point %s does not lie on the curve " % [xx, yy]

    tt = -xx / yy
    eqhat = Eq.formal()
    eqlog = eqhat.log(prec + 3)
    z = eqlog(tt)
    u = ZZ(1)
    fac = ZZ(1)
    for i in range(1, 2 * prec + 1):
        fac = fac * i
        u = u + z ** i / fac
    q = Etate.parameter(prec=prec)
    un = u * q ** (-(u.valuation() / q.valuation()).floor())
    return un
开发者ID:mmasdeu,项目名称:shp,代码行数:45,代码来源:util.py

示例3: coeff

# 需要导入模块: from sage.rings.all import ZZ [as 别名]
# 或者: from sage.rings.all.ZZ import valuation [as 别名]
        def coeff(m):
            m = ZZ(m)
            if m < 0:
                return ZZ(0)
            elif m == 0:
                return ZZ(1)

            factor = -2*k / QQ(bernoulli(k)) / lamk
            sum1   = sigma(m, k-1)
            if M.divides(m):
                sum2 = (lamk-1) * sigma(ZZ(m/M), k-1)
            else:
                sum2 = ZZ(0)
            if (M == 1):
                sum3 = ZZ(0)
            else:
                if (m == 1):
                    N = ZZ(1)
                else:
                    N = ZZ(m / M**ZZ(m.valuation(M)))
                sum3 = -sigma(ZZ(N), k-1) * ZZ(m/N)**(k-1) / (lamk + 1)

            return factor * (sum1 + sum2 + sum3) * dval**m
开发者ID:BlairArchibald,项目名称:sage,代码行数:25,代码来源:series_constructor.py


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