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


Python ZZ.ideal方法代码示例

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


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

示例1: deg_one_primes_iter

# 需要导入模块: from sage.rings.all import ZZ [as 别名]
# 或者: from sage.rings.all.ZZ import ideal [as 别名]
def deg_one_primes_iter(K, principal_only=False):
    r"""
    Return an iterator over degree 1 primes of ``K``.

    INPUT:

    - ``K`` -- a number field
    - ``principal_only`` -- bool; if ``True``, only yield principal primes

    OUTPUT:

    An iterator over degree 1 primes of `K` up to the given norm,
    optionally yielding only principal primes.

    EXAMPLES::

        sage: K.<a> = QuadraticField(-5)
        sage: from sage.schemes.elliptic_curves.gal_reps_number_field import deg_one_primes_iter
        sage: it = deg_one_primes_iter(K)
        sage: [next(it) for _ in range(6)]
        [Fractional ideal (2, a + 1),
         Fractional ideal (3, a + 1),
         Fractional ideal (3, a + 2),
         Fractional ideal (-a),
         Fractional ideal (7, a + 3),
         Fractional ideal (7, a + 4)]
        sage: it = deg_one_primes_iter(K, True)
        sage: [next(it) for _ in range(6)]
        [Fractional ideal (-a),
         Fractional ideal (-2*a + 3),
         Fractional ideal (2*a + 3),
         Fractional ideal (a + 6),
         Fractional ideal (a - 6),
         Fractional ideal (-3*a + 4)]
    """
    # imaginary quadratic fields have no principal primes of norm < disc / 4
    start = K.discriminant().abs() // 4 if principal_only and K.signature() == (0,1) else 2

    K_is_Q = (K==QQ)
    from sage.arith.misc import primes
    from sage.rings.infinity import infinity
    for p in primes(start=start, stop=infinity):
        if K_is_Q:
            yield ZZ.ideal(p)
        else:
            for P in K.primes_above(p, degree=1):
                if not principal_only or P.is_principal():
                    yield P
开发者ID:mcognetta,项目名称:sage,代码行数:50,代码来源:gal_reps_number_field.py

示例2: _an_element_

# 需要导入模块: from sage.rings.all import ZZ [as 别名]
# 或者: from sage.rings.all.ZZ import ideal [as 别名]
    def _an_element_(self):
        r"""
        Return an element of the spectrum of the ring.

        OUTPUT:

        A point of the affine scheme ``self``.

        EXAMPLES::

            sage: Spec(QQ).an_element()
            Point on Spectrum of Rational Field defined by the Principal ideal (0) of Rational Field
            sage: Spec(ZZ).an_element()    # random output
            Point on Spectrum of Integer Ring defined by the Principal ideal (811) of Integer Ring
        """
        if self.coordinate_ring() is ZZ:
            from sage.arith.all import random_prime
            return self(ZZ.ideal(random_prime(1000)))
        return self(self.coordinate_ring().zero_ideal())
开发者ID:saraedum,项目名称:sage-renamed,代码行数:21,代码来源:scheme.py

示例3: __init__

# 需要导入模块: from sage.rings.all import ZZ [as 别名]
# 或者: from sage.rings.all.ZZ import ideal [as 别名]
    def __init__(self, E, P, proof=None, algorithm="pari", globally=False):
        r"""
        Initializes the reduction data for the elliptic curve `E` at the prime `P`.

        INPUT:

        - ``E`` -- an elliptic curve defined over a number field, or `\QQ`.

        - ``P`` -- a prime ideal of the field, or a prime integer if the field is `\QQ`.

        - ``proof`` (bool)-- if True, only use provably correct
          methods (default controlled by global proof module).  Note
          that the proof module is number_field, not elliptic_curves,
          since the functions that actually need the flag are in
          number fields.

        - ``algorithm`` (string, default: "pari") -- Ignored unless the
          base field is `\QQ`.  If "pari", use the PARI C-library
          ``ellglobalred`` implementation of Tate's algorithm over
          `\QQ`. If "generic", use the general number field
          implementation.
          
        - ``globally`` (bool, default: False) -- If True, the algorithm
          uses the generators of principal ideals rather than an arbitrary
          uniformizer.

        .. note::

           This function is not normally called directly by users, who
           may access the data via methods of the EllipticCurve
           classes.

        EXAMPLES::

            sage: from sage.schemes.elliptic_curves.ell_local_data import EllipticCurveLocalData
            sage: E = EllipticCurve('14a1')
            sage: EllipticCurveLocalData(E,2)
            Local data at Principal ideal (2) of Integer Ring:
            Reduction type: bad non-split multiplicative
            Local minimal model: Elliptic Curve defined by y^2 + x*y + y = x^3 + 4*x - 6 over Rational Field
            Minimal discriminant valuation: 6
            Conductor exponent: 1
            Kodaira Symbol: I6
            Tamagawa Number: 2

        ::

            sage: EllipticCurveLocalData(E,2,algorithm="generic")
            Local data at Principal ideal (2) of Integer Ring:
            Reduction type: bad non-split multiplicative
            Local minimal model: Elliptic Curve defined by y^2 + x*y + y = x^3 + 4*x - 6 over Rational Field
            Minimal discriminant valuation: 6
            Conductor exponent: 1
            Kodaira Symbol: I6
            Tamagawa Number: 2

        ::

            sage: EllipticCurveLocalData(E,2,algorithm="pari")
            Local data at Principal ideal (2) of Integer Ring:
            Reduction type: bad non-split multiplicative
            Local minimal model: Elliptic Curve defined by y^2 + x*y + y = x^3 + 4*x - 6 over Rational Field
            Minimal discriminant valuation: 6
            Conductor exponent: 1
            Kodaira Symbol: I6
            Tamagawa Number: 2

        ::

            sage: EllipticCurveLocalData(E,2,algorithm="unknown")
            Traceback (most recent call last):
            ...
            ValueError: algorithm must be one of 'pari', 'generic'

        ::

            sage: EllipticCurveLocalData(E,3)
            Local data at Principal ideal (3) of Integer Ring:
            Reduction type: good
            Local minimal model: Elliptic Curve defined by y^2 + x*y + y = x^3 + 4*x - 6 over Rational Field
            Minimal discriminant valuation: 0
            Conductor exponent: 0
            Kodaira Symbol: I0
            Tamagawa Number: 1

        ::

            sage: EllipticCurveLocalData(E,7)
            Local data at Principal ideal (7) of Integer Ring:
            Reduction type: bad split multiplicative
            Local minimal model: Elliptic Curve defined by y^2 + x*y + y = x^3 + 4*x - 6 over Rational Field
            Minimal discriminant valuation: 3
            Conductor exponent: 1
            Kodaira Symbol: I3
            Tamagawa Number: 3
        """
        self._curve = E
        K = E.base_field()
        p = check_prime(K,P) # error handling done in that function
        if algorithm != "pari" and algorithm != "generic":
#.........这里部分代码省略.........
开发者ID:amitjamadagni,项目名称:sage,代码行数:103,代码来源:ell_local_data.py

示例4: __init__

# 需要导入模块: from sage.rings.all import ZZ [as 别名]
# 或者: from sage.rings.all.ZZ import ideal [as 别名]
    def __init__(self,q,level,info_magma = None,grouptype = None,magma = None, compute_presentation = True):
        from sage.modular.arithgroup.congroup_gamma import Gamma_constructor
        assert grouptype in ['SL2','PSL2']
        self._grouptype = grouptype
        self._compute_presentation = compute_presentation
        self.magma = magma
        self.F = QQ
        self.q = ZZ(q)
        self.discriminant = ZZ(1)
        self.level = ZZ(level/self.q)
        if self.level != 1 and compute_presentation:
            raise NotImplementedError
        self._Gamma = Gamma_constructor(self.q)
        self._Gamma_farey = self._Gamma.farey_symbol()
        self.F_units = []
        self._prec_inf = -1

        self.B = MatrixSpace(QQ,2,2)

        self._O_discriminant = ZZ.ideal(self.level * self.q)

        # Here we initialize the non-split Cartan, properly
        self.GFq = FiniteField(self.q)
        if not self.GFq(-1).is_square():
            self.eps = ZZ(-1)
        else:
            self.eps = ZZ(2)
            while self.GFq(self.eps).is_square():
                self.eps += 1
        epsinv = (self.GFq(self.eps)**-1).lift()

        N = self.level
        q = self.q
        self.Obasis = [matrix(ZZ,2,2,v) for v in [[1,0,0,1], [0,q,0,0], [0,N*epsinv,N,0], [0,0,0,q]]]

        x = QQ['x'].gen()
        K = FiniteField(self.q**2,'z',modulus = x*x - self.eps)
        x = K.primitive_element()
        x1 = x
        while x1.multiplicative_order() != self.q+1 or x1.norm() != 1:
            x1 *= x
        a, b = x1.polynomial().list() # represents a+b*sqrt(eps)
        a = a.lift()
        b = b.lift()
        self.extra_matrix = self.B(lift(matrix(ZZ,2,2,[a,b,b*self.eps,a]),self.q))
        self.extra_matrix_inverse = ~self.extra_matrix
        if compute_presentation:
            self.Ugens = []
            self._gens = []
            temp_relation_words = []
            I = SL2Z([1,0,0,1])
            E = SL2Z([-1,0,0,-1])
            minus_one = []
            for i,g in enumerate(self._Gamma_farey.generators()):
                newg = self.B([g.a(),g.b(),g.c(),g.d()])
                if newg == I:
                    continue
                self.Ugens.append(newg)
                self._gens.append(self.element_class(self,quaternion_rep = newg, word_rep = [i+1],check = False))
                if g.matrix()**2 == I.matrix():
                    temp_relation_words.append([i+1, i+1])
                    if minus_one is not None:
                        temp_relation_words.append([-i-1]+minus_one)
                    else:
                        minus_one = [i+1]
                elif g.matrix()**2 == E.matrix():
                    temp_relation_words.append([i+1,i+1,i+1,i+1])
                    if minus_one is not None:
                        temp_relation_words.append([-i-1,-i-1]+minus_one)
                    else:
                        minus_one = [i+1, i+1]
                elif g.matrix()**3 == I.matrix():
                    temp_relation_words.append([i+1, i+1, i+1])
                elif g.matrix()**3 == E.matrix():
                    temp_relation_words.append([i+1, i+1, i+1, i+1, i+1, i+1])
                    if minus_one is not None:
                        temp_relation_words.append([-i-1, -i-1, -i-1]+minus_one)
                    else:
                        minus_one = [i+1, i+1, i+1]
                else:
                    assert g.matrix()**24 != I.matrix()
            # The extra matrix is added
            i = len(self.Ugens)
            self.extra_matrix_index = i
            self.Ugens.append(self.extra_matrix)
            self._gens.append(self.element_class(self,quaternion_rep = self.Ugens[i], word_rep = [i+1],check = False))

            # The new relations are also added
            w = self._get_word_rep_initial(self.extra_matrix**(self.q+1))
            temp_relation_words.append( w + ([-i-1] * (self.q+1)))
            for j,g in enumerate(self.Ugens[:-1]):
                g1 = self.extra_matrix_inverse * g * self.extra_matrix
                w = self._get_word_rep_initial(g1)
                new_rel = w + [-i-1, -j-1, i+1]
                temp_relation_words.append(new_rel)
            self.F_unit_offset = len(self.Ugens)
            if minus_one is not None:
                self.minus_one_long = syllables_to_tietze(minus_one)
            self._relation_words = []
            for rel in temp_relation_words:
#.........这里部分代码省略.........
开发者ID:mmasdeu,项目名称:darmonpoints,代码行数:103,代码来源:arithgroup_nscartan.py


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