• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python cremona.parse_cremona_label函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中sage.databases.cremona.parse_cremona_label函数的典型用法代码示例。如果您正苦于以下问题:Python parse_cremona_label函数的具体用法?Python parse_cremona_label怎么用?Python parse_cremona_label使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



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

示例1: curve_cmp

def curve_cmp(E1, E2):
    r"""
    Comparison function for elliptic curves over `Q`.

    Order by label if in the database, else first by conductor, then
    by c_invariants.
    """
    t = cmp(E1.conductor(), E2.conductor())
    if t:
        return t

    # Now they have the same conductor
    try:
        from sage.databases.cremona import parse_cremona_label, class_to_int

        k1 = parse_cremona_label(E1.label())
        k2 = parse_cremona_label(E2.label())
        t = cmp(class_to_int(k1[1]), class_to_int(k2[1]))
        if t:
            return t
        return cmp(k1[2], k2[2])
    except RuntimeError:  # if not in database, label() will fail
        pass

    return cmp(E1.ainvs(), E2.ainvs())
开发者ID:sageb0t,项目名称:testsage,代码行数:25,代码来源:ell_egros.py


示例2: cmp_label

def cmp_label(lab1, lab2):
    from sage.databases.cremona import parse_cremona_label, class_to_int
    a, b, c = parse_cremona_label(lab1)
    id1 = int(a), class_to_int(b), int(c)
    a, b, c = parse_cremona_label(lab2)
    id2 = int(a), class_to_int(b), int(c)
    return cmp(id1, id2)
开发者ID:sibilant,项目名称:lmfdb,代码行数:7,代码来源:elliptic_curve.py


示例3: curve_key

def curve_key(E1):
    r"""
    Comparison key for elliptic curves over `\QQ`.

    The key is a tuple:

    - if the curve is in the database: (conductor, 0, label, number)

    - otherwise: (conductor, 1, a_invariants)

    EXAMPLES::

        sage: from sage.schemes.elliptic_curves.ell_egros import curve_key
        sage: E = EllipticCurve_from_j(1728)
        sage: curve_key(E)
        (32, 0, 0, 2)
        sage: E = EllipticCurve_from_j(1729)
        sage: curve_key(E)
        (2989441, 1, (1, 0, 0, -36, -1))
    """
    try:
        from sage.databases.cremona import parse_cremona_label, class_to_int
        N, l, k = parse_cremona_label(E1.label())
        return (N, 0, class_to_int(l), k)
    except RuntimeError:
        return (E1.conductor(), 1, E1.ainvs())
开发者ID:mcognetta,项目名称:sage,代码行数:26,代码来源:ell_egros.py


示例4: curve_cmp

def curve_cmp(E1, E2):
    r"""
    Comparison function for elliptic curves over `\QQ`.

    Order by label if in the database, else first by conductor, then
    by c_invariants.

    Deprecated, please use instead `curve_key`.

    EXAMPLES::

        sage: from sage.schemes.elliptic_curves.ell_egros import curve_cmp
        sage: E1 = EllipticCurve_from_j(1728)
        sage: E2 = EllipticCurve_from_j(1729)
        sage: curve_cmp(E1,E2)
        doctest:...: DeprecationWarning: Please use 'curve_key' instead.
        See http://trac.sagemath.org/21142 for details.
        -1
    """
    from sage.misc.superseded import deprecation
    deprecation(21142, "Please use 'curve_key' instead.")
    t = cmp(E1.conductor(), E2.conductor())
    if t:
        return t

    # Now they have the same conductor
    try:
        from sage.databases.cremona import parse_cremona_label, class_to_int
        k1 = parse_cremona_label(E1.label())
        k2 = parse_cremona_label(E2.label())
        t = cmp(class_to_int(k1[1]),class_to_int(k2[1]))
        if t:
            return t
        return cmp(k1[2], k2[2])
    except RuntimeError: # if not in database, label() will fail
        pass

    return cmp(E1.ainvs(),E2.ainvs())
开发者ID:mcognetta,项目名称:sage,代码行数:38,代码来源:ell_egros.py


示例5: _find_scaling_period

    def _find_scaling_period(self):
        r"""
        Uses the integral period map of the modular symbol implementation in sage
        in order to determine the scaling. The resulting modular symbol is correct
        only for the `X_0`-optimal curve, at least up to a possible factor +-1 or +-2.

        EXAMPLES::

            sage: E = EllipticCurve('11a1')
            sage: m = sage.schemes.elliptic_curves.ell_modular_symbols.ModularSymbolSage(E,+1,normalize='period')
            sage: m._e
            (1/5, 1)
            sage: E = EllipticCurve('11a2')
            sage: m = sage.schemes.elliptic_curves.ell_modular_symbols.ModularSymbolSage(E,+1,normalize='period')
            sage: m._e
            (1, 5)
            sage: E = EllipticCurve('121b2')
            sage: m = sage.schemes.elliptic_curves.ell_modular_symbols.ModularSymbolSage(E,+1,normalize='period')
            sage: m._e
            (0, 11/2, 0, 11/2, 11/2, 0, 0, -3, 2, 1/2, -1, 3/2)

        """

        P = self._modsym.integral_period_mapping()
        self._e = P.matrix().transpose().row(0)
        self._e /= 2
        E = self._E
        try :
            crla = parse_cremona_label(E.label())
        except RuntimeError: # raised when curve is outside of the table
            self._scaling = 1
        else :
            cr0 = Integer(crla[0]).str() + crla[1] + '1'
            E0 = EllipticCurve(cr0)
            if self._sign == 1:
                q = E0.period_lattice().basis()[0]/E.period_lattice().basis()[0]
            else:
                q = E0.period_lattice().basis()[1].imag()/E.period_lattice().basis()[1].imag()
                if E0.real_components() == 1:
                    q *= 2
                if E.real_components() == 1:
                    q /= 2
            q = QQ(int(round(q*200)))/200
            verbose('scale modular symbols by %s'%q)
            self._scaling = q
        self._e *= self._scaling
开发者ID:drupel,项目名称:sage,代码行数:46,代码来源:ell_modular_symbols.py


示例6: __scale_by_periods_only__

    def __scale_by_periods_only__(self):
        r"""
        If we fail to scale with ``_find_scaling_L_ratio``, we drop here
        to try and find the scaling by the quotient of the
        periods to the `X_0`-optimal curve. The resulting ``_scaling``
        is not guaranteed to be correct, but could well be.

        EXAMPLES::

            sage: E = EllipticCurve('19a1')
            sage: m = E.modular_symbol(sign=+1)
            sage: m.__scale_by_periods_only__()
            Warning : Could not normalize the modular symbols, maybe all further results will be multiplied by -1, 2 or -2.
            sage: m._scaling
            1

            sage: E = EllipticCurve('19a2')
            sage: m = E.modular_symbol(sign=+1)
            sage: m._scaling
            3/2
            sage: m.__scale_by_periods_only__()
            Warning : Could not normalize the modular symbols, maybe all further results will be multiplied by -1, 2 or -2.
            sage: m._scaling
            3
        """
        # we only do this inside the cremona-tables.
        try :
            crla = parse_cremona_label(self._E.label())
        except RuntimeError: # raised when curve is outside of the table
            print("Warning : Could not normalize the modular symbols, maybe all further results will be multiplied by a rational number.")
            self._scaling = 1
        else :
            print("Warning : Could not normalize the modular symbols, maybe all further results will be multiplied by -1, 2 or -2.")
            cr0 = Integer(crla[0]).str() + crla[1] + '1'
            E0 = EllipticCurve(cr0)
            if self._sign == 1:
                q = E0.period_lattice().basis()[0]/self._E.period_lattice().basis()[0]
            else:
                q = E0.period_lattice().basis()[1].imag()/self._E.period_lattice().basis()[1].imag()
                if E0.real_components() == 1:
                    q *= 2
                if self._E.real_components() == 1:
                    q /= 2
            q = ZZ(int(round(q*200)))/200
            verbose('scale modular symbols by %s'%q)
            self._scaling = q
开发者ID:drupel,项目名称:sage,代码行数:46,代码来源:ell_modular_symbols.py


示例7: make_allcurves_lines

def make_allcurves_lines(outfile, code, ainvs, r, t):
    E = EllipticCurve(ainvs)
    N, cl, n = parse_cremona_label(code)
    for i, F in enumerate(E.isogeny_class().curves):
        put_allcurves_line(outfile,N,cl,str(i+1),list(F.ainvs()),r,F.torsion_order())
    outfile.flush()
开发者ID:defeo,项目名称:ecdata,代码行数:6,代码来源:ecdb.py


示例8: _find_scaling_period

    def _find_scaling_period(self):
        r"""
        Uses the integral period map of the modular symbol implementation in sage
        in order to determine the scaling. The resulting modular symbol is correct
        only for the `X_0`-optimal curve, at least up to a possible factor +- a
        power of 2.

        EXAMPLES::

            sage: E = EllipticCurve('11a1')
            sage: m = sage.schemes.elliptic_curves.ell_modular_symbols.ModularSymbolSage(E,+1,normalize='period')
            sage: m._e
            (1/5, 1)
            sage: E = EllipticCurve('11a2')
            sage: m = sage.schemes.elliptic_curves.ell_modular_symbols.ModularSymbolSage(E,+1,normalize='period')
            sage: m._e
            (1, 5)
            sage: E = EllipticCurve('121b2')
            sage: m = sage.schemes.elliptic_curves.ell_modular_symbols.ModularSymbolSage(E,+1,normalize='period')
            sage: m._e
            (0, 11/2, 0, 11/2, 11/2, 0, 0, -3, 2, 1/2, -1, 3/2)

        TESTS::

            sage: E = EllipticCurve('19a1')
            sage: m = E.modular_symbol(sign=+1, implementation='sage', normalize='none')
            sage: m._find_scaling_period()
            sage: m._scaling
            1

            sage: E = EllipticCurve('19a2')
            sage: m = E.modular_symbol(sign=+1, implementation='sage', normalize='none')
            sage: m._scaling
            1
            sage: m._find_scaling_period()
            sage: m._scaling
            3
        """
        P = self._modsym.integral_period_mapping()
        self._e = P.matrix().transpose().row(0)
        self._e /= 2
        E = self._E
        try :
            crla = parse_cremona_label(E.label())
        except RuntimeError: # raised when curve is outside of the table
            print("Warning : Could not normalize the modular symbols, maybe all further results will be multiplied by a rational number.")
            self._scaling = 1
        else :
            cr0 = Integer(crla[0]).str() + crla[1] + '1'
            E0 = EllipticCurve(cr0)
            if self._sign == 1:
                q = E0.period_lattice().basis()[0]/E.period_lattice().basis()[0]
            else:
                q = E0.period_lattice().basis()[1].imag()/E.period_lattice().basis()[1].imag()
                if E0.real_components() == 1:
                    q *= 2
                if E.real_components() == 1:
                    q /= 2
            q = QQ(int(round(q*200)))/200
            verbose('scale modular symbols by %s'%q)
            self._scaling = q
        c = self(0) #  required, to change base point from oo to 0
        if c<0:
            c *= -1
            self._scaling *= -1
        self._at_zero = c
        self._e *= self._scaling
开发者ID:mcognetta,项目名称:sage,代码行数:67,代码来源:ell_modular_symbols.py


示例9: cmp_label

def cmp_label(lab1, lab2):
    a, b, c = parse_cremona_label(lab1)
    id1 = int(a), class_to_int(b), int(c)
    a, b, c = parse_cremona_label(lab2)
    id2 = int(a), class_to_int(b), int(c)
    return cmp(id1, id2)
开发者ID:LMFDB,项目名称:lmfdb,代码行数:6,代码来源:elliptic_curve.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python all.ceil函数代码示例发布时间:2022-05-27
下一篇:
Python cremona.class_to_int函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap