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


Python EllipticCurve.local_minimal_model方法代码示例

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


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

示例1: egros_get_j

# 需要导入模块: from constructor import EllipticCurve [as 别名]
# 或者: from constructor.EllipticCurve import local_minimal_model [as 别名]
def egros_get_j(S=[], proof=None, verbose=False):
    r"""
    Returns a list of rational `j` such that all elliptic curves
    defined over `\QQ` with good reduction outside `S` have
    `j`-invariant in the list, sorted by height.

    INPUT:

    - ``S`` -- list of primes (default: empty list).

    - ``proof`` -- ``True``/``False`` (default ``True``): the MW basis for
      auxiliary curves will be computed with this proof flag.

    - ``verbose`` -- ``True``/``False`` (default ``False````): if ``True``, some
      details of the computation will be output.

    .. note::

        Proof flag: The algorithm used requires determining all
        S-integral points on several auxiliary curves, which in turn
        requires the computation of their generators.  This is not
        always possible (even in theory) using current knowledge.

        The value of this flag is passed to the function which
        computes generators of various auxiliary elliptic curves, in
        order to find their S-integral points.  Set to ``False`` if the
        default (``True``) causes warning messages, but note that you can
        then not rely on the set of invariants returned being
        complete.

    EXAMPLES::

        sage: from sage.schemes.elliptic_curves.ell_egros import egros_get_j
        sage: egros_get_j([])
        [1728]
        sage: egros_get_j([2])  # long time (3s on sage.math, 2013)
        [128, 432, -864, 1728, 3375/2, -3456, 6912, 8000, 10976, -35937/4, 287496, -784446336, -189613868625/128]
        sage: egros_get_j([3])  # long time (3s on sage.math, 2013)
        [0, -576, 1536, 1728, -5184, -13824, 21952/9, -41472, 140608/3, -12288000]
        sage: jlist=egros_get_j([2,3]); len(jlist) # long time (30s)
        83

    """
    if not all([p.is_prime() for p in S]):
        raise ValueError("Elements of S must be prime.")

        if proof is None:
            from sage.structure.proof.proof import get_flag
            proof = get_flag(proof, "elliptic_curve")
        else:
            proof = bool(proof)

    if verbose:
        import sys  # so we can flush stdout for debugging

    SS = [-1] + S

    jlist=[]
    wcount=0
    nw = 6**len(S) * 2

    if verbose:
        print "Finding possible j invariants for S = ",S
        print "Using ", nw, " twists of base curve"
        sys.stdout.flush()

    for ei in xmrange([6]*len(S) + [2]):
        w = prod([p**e for p,e in zip(reversed(SS),ei)],QQ(1))
        wcount+=1
        if verbose:
            print "Curve #",wcount, "/",nw,":";
            print "w = ",w,"=",w.factor()
            sys.stdout.flush()
        a6 = -1728*w
        d2 = 0
        d3 = 0
        u0 = (2**d2)*(3**d3)
        E = EllipticCurve([0,0,0,0,a6])
        # This curve may not be minimal at 2 or 3, but the
        # S-integral_points function requires minimality at primes in
        # S, so we find a new model which is p-minimal at both 2 and 3
        # if they are in S.  Note that the isomorphism between models
        # will preserve S-integrality of points.
        E2 = E.local_minimal_model(2) if 2 in S else E
        E23 = E2.local_minimal_model(3) if 3 in S else E2
        urst = E23.isomorphism_to(E)

        try:
            pts = E23.S_integral_points(S,proof=proof)
        except RuntimeError:
            pts=[]
            print "Failed to find S-integral points on ",E23.ainvs()
            if proof:
                if verbose:
                    print "--trying again with proof=False"
                    sys.stdout.flush()
                pts = E23.S_integral_points(S,proof=False)
                if verbose:
                    print "--done"
        if verbose:
#.........这里部分代码省略.........
开发者ID:Findstat,项目名称:sage,代码行数:103,代码来源:ell_egros.py


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