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


Python ZZ.zero_element方法代码示例

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


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

示例1: is_gamma0_equiv

# 需要导入模块: from sage.rings.all import ZZ [as 别名]
# 或者: from sage.rings.all.ZZ import zero_element [as 别名]
    def is_gamma0_equiv(self, other, N, transformation = None):
        r"""
        Return whether self and other are equivalent modulo the action of
        `\Gamma_0(N)` via linear fractional transformations.

        INPUT:


        -  ``other`` - Cusp

        -  ``N`` - an integer (specifies the group
           Gamma_0(N))

        -  ``transformation`` - None (default) or either the string 'matrix' or 'corner'. If 'matrix',
           it also returns a matrix in Gamma_0(N) that sends self to other. The matrix is chosen such that the lower left entry is as small as possible in absolute value. If 'corner' (or True for backwards compatibility), it returns only the upper left entry of such a matrix.


        OUTPUT:


        -  a boolean - True if self and other are equivalent

        -  a matrix or an integer- returned only if transformation is 'matrix' or 'corner', respectively.


        EXAMPLES::

            sage: x = Cusp(2,3)
            sage: y = Cusp(4,5)
            sage: x.is_gamma0_equiv(y, 2)
            True
            sage: _, ga = x.is_gamma0_equiv(y, 2, 'matrix'); ga
            [-1  2]
            [-2  3]
            sage: x.is_gamma0_equiv(y, 3)
            False
            sage: x.is_gamma0_equiv(y, 3, 'matrix')
            (False, None)
            sage: Cusp(1/2).is_gamma0_equiv(1/3,11,'corner')
            (True, 19)

            sage: Cusp(1,0)
            Infinity
            sage: z = Cusp(1,0)
            sage: x.is_gamma0_equiv(z, 3, 'matrix')
            (
                  [-1  1]
            True, [-3  2]
            )


        ALGORITHM: See Proposition 2.2.3 of Cremona's book 'Algorithms for
        Modular Elliptic Curves', or Prop 2.27 of Stein's Ph.D. thesis.
        """
        if transformation not in [False,True,"matrix",None,"corner"]:
            raise ValueError, "Value %s of the optional argument transformation is not valid."

        if not isinstance(other, Cusp):
            other = Cusp(other)
        N = ZZ(N)
        u1 = self.__a
        v1 = self.__b
        u2 = other.__a
        v2 = other.__b

        zero = ZZ.zero_element()
        one = ZZ.one_element()

        if transformation == "matrix":
            from sage.matrix.constructor import matrix

        #if transformation :
        #    transformation = "corner"

        if v1 == v2 and u1 == u2:
            if not transformation:
                return True
            elif transformation == "matrix":
                return True, matrix(ZZ,[[1,0],[0,1]])
            else:
                return True, one

        # a necessary, but not sufficient condition unless N is square-free
        if v1.gcd(N) != v2.gcd(N):
            if not transformation:
                return False
            else:
                return False, None

        if (u1,v1) != (zero,one):
            if v1 in [zero, one]:
                s1 = one
            else:
                s1 = u1.inverse_mod(v1)
        else:
            s1 = 0
        if (u2,v2) != (zero, one):
            if v2 in [zero,one]:
                s2 = one
            else:
#.........这里部分代码省略.........
开发者ID:CETHop,项目名称:sage,代码行数:103,代码来源:cusps.py


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