Ticket #8335: trac_8335-doc-5.7.b3.patch

File trac_8335-doc-5.7.b3.patch, 9.4 KB (added by jpflori, 9 years ago)

Fixes

  • sage/interfaces/singular.py

    # HG changeset patch
    # User Jean-Pierre Flori <jean-pierre.flor@ssi.gouv.fr>
    # Date 1360334827 -3600
    # Node ID 5c66825e785e57271dd7552104e5460f7a9f7bb0
    # Parent  871df8f6d409fa770f66b1222a31ac271b49d4a9
    #8335: Doc fixes
    
    diff --git a/sage/interfaces/singular.py b/sage/interfaces/singular.py
    a b  
    14301430            sage: singular.eval('minpoly = 1+z+z2+z3+z4')
    14311431            'minpoly = 1+z+z2+z3+z4;'
    14321432            sage: singular('r3').sage_global_ring()
    1433             Multivariate Polynomial Ring in a, b, c over Univariate Quotient Polynomial Ring in z over Finite Field of size 3 with modulus z^4 + z^3 + z^2 + z + 1
     1433            Multivariate Polynomial Ring in a, b, c over Finite Field in z of size 3^4
    14341434
    14351435        Real and complex fields in both Singular and Sage are defined with a precision.
    14361436        The precision in Singular is given in terms of digits, but in Sage it is given
     
    15171517                    singular.eval('short=%s'%is_short)
    15181518                else:
    15191519                    minpoly = ZZ[charstr[1]](minpoly)
    1520                 BR = br.extension(minpoly)
     1520                BR = br.extension(minpoly,name=charstr[1])
    15211521        else:
    15221522            BR = br
    15231523       
     
    15801580            'minpoly = 1+z+z2+z3+z4;'
    15811581            sage: p = singular('z^4*a^3+z^2*a*b*c')
    15821582            sage: p.sage_poly()
    1583             (2*z^3 + 2*z^2 + 2*z + 2)*a^3 + z^2*a*b*c
     1583            (-z^3 - z^2 - z - 1)*a^3 + (z^2)*a*b*c
    15841584            sage: singular('z^4')
    15851585            (-z3-z2-z-1)
    15861586
  • sage/rings/finite_rings/constructor.py

    diff --git a/sage/rings/finite_rings/constructor.py b/sage/rings/finite_rings/constructor.py
    a b  
    66Sage for several sizes of primes `p`. These implementations
    77are
    88
    9 
    109-  ``sage.rings.finite_rings.integer_mod.IntegerMod_int``,
    1110
    1211-  ``sage.rings.finite_rings.integer_mod.IntegerMod_int64``, and
     
    179178    Return the globally unique finite field of given order with
    180179    generator labeled by the given name and possibly with given
    181180    modulus.
    182    
     181
    183182    INPUT:
    184    
    185    
    186     -  ``order`` - int
    187    
    188     -  ``name`` - string; must be specified unless
    189        - ``order`` is prime
    190        - ``modulus`` is 'conway', in which case a name is generated
     183
     184    - ``order`` - int
     185
     186    - ``name`` - string; must be specified unless
     187
     188        - ``order`` is prime
     189
     190        - ``modulus`` is 'conway', in which case a name is generated
    191191          from the degree and the ``prefix`` string.
    192    
    193     -  ``modulus`` - (optional) either a defining polynomial for the
    194        field, i.e., generator of the field will be a root of this
    195        polynomial; or a string:
    196192
    197            - 'conway': force the use of a pseudo-Conway polynomial.
    198             If a conway polynomial is found in the database, that is used.
    199             Otherwise, a polynomial is used with the same algebraic properties
    200             but without the lexicographic constraint implying uniqueness.
    201            - 'random': use a random irreducible polynomial;
    202            - 'default': a Conway polynomial is used if in the database. Otherwise
    203             a sparse polynomial is used for binary fields and a
    204             random polynomial is used for other characteristics.
    205            - 'first_lexicographic': uses the first irreducible polynomial.
     193    - ``modulus`` - (optional) either a defining polynomial for the
     194      field, i.e., generator of the field will be a root of this
     195      polynomial; or a string:
    206196
    207        Other options might be available depending on the
    208        implementation.
    209    
    210     -  ``elem_cache`` - cache all elements to avoid
    211        creation time (default: order < 500)
    212    
    213     -  ``check_irreducible`` - verify that the polynomial
    214        modulus is irreducible
     197        - 'conway': force the use of a pseudo-Conway polynomial.
     198          If a conway polynomial is found in the database, that is used.
     199          Otherwise, a polynomial is used with the same algebraic properties
     200          but without the lexicographic constraint implying uniqueness.
     201
     202        - 'random': use a random irreducible polynomial;
     203
     204        - 'default': a Conway polynomial is used if in the database. Otherwise
     205          a sparse polynomial is used for binary fields and a
     206          random polynomial is used for other characteristics.
     207
     208        - 'first_lexicographic': uses the first irreducible polynomial.
     209
     210        - Other options might be available depending on the implementation.
     211
     212    - ``elem_cache`` - cache all elements to avoid
     213      creation time (default: order < 500)
     214
     215    - ``check_irreducible`` - verify that the polynomial
     216      modulus is irreducible
    215217
    216218    - ``prefix`` (default: 'z') - a string used to generate names
    217219      for subfields and pushouts of this field (mainly for use with
     
    219221
    220222    - ``proof`` -- bool (default: True); if True use provable
    221223      primality test; otherwise only use pseudoprimality test.
    222    
    223     -  ``args`` - additional parameters passed to finite
    224        field implementations
    225    
    226     -  ``kwds`` - additional keyword parameters passed to
    227        finite field implementations
    228    
    229    
     224
     225    - ``args`` - additional parameters passed to finite
     226      field implementations
     227
     228    - ``kwds`` - additional keyword parameters passed to
     229      finite field implementations
     230
    230231    ALIAS: You can also use GF instead of FiniteField - they are
    231232    identical.
    232233
    233234    EXAMPLES::
    234    
     235
    235236        sage: k.<a> = FiniteField(9); k
    236237        Finite Field in a of size 3^2
    237238        sage: parent(a)
     
    339340        True
    340341   
    341342    You may print finite field elements as integers. This
    342     currently only works if the order of field is `<2^{16}`,
     343    currently only works if the order of field is `< 2^{16}`,
    343344    though.
    344345   
    345346    ::
     
    403404
    404405                if isinstance(modulus, (list, tuple)):
    405406                    modulus = FiniteField(p)['x'](modulus)
    406                 # some classes use 'random' as the modulus to
    407                 # generate a random modulus, but we don't want
    408                 # to cache it
    409407                elif sage.rings.polynomial.polynomial_element.is_Polynomial(modulus):
     408                    # some classes use 'random' as the modulus to
     409                    # generate a random modulus, but we don't want
     410                    # to cache it
    410411                    modulus = modulus.change_variable_name('x')
     412                    # We might need the following for compatibility with
     413                    # the extension method of CommutativeRing class
     414                    if name is None:
     415                        name = str(modulus.parent().gen(0))
    411416                elif not isinstance(modulus, str):
    412417                    raise ValueError("Modulus parameter not understood.")
    413418            else:  # Neither a prime, nor a prime power
     
    724729        sage: from sage.rings.finite_rings.constructor import find_pseudo_conway_polynomial_tree
    725730        sage: PCPT = find_pseudo_conway_polynomial_tree(2, 12, False)
    726731        sage: PCPT.f
    727         x^12 + x^10 + x^9 + x^8 + x^4 + x^2 + 1
     732        x^12 + x^11 + x^10 + x^4 + 1
    728733    """
    729734    if not pseudo_conway_poly.has_key(p):
    730735        pseudo_conway_poly[p] = {}
     
    10171022        sage: PCPT20 = find_pseudo_conway_polynomial_tree(2, 20, False)
    10181023        sage: PCPT12 = find_pseudo_conway_polynomial_tree(2, 12, False)
    10191024        sage: compute_pseudo_conway_polynomial(2, 60, {2:PCPT30,3:PCPT20,5:PCPT12})
    1020         x^60 + x^59 + x^56 + x^53 + x^49 + x^45 + x^43 + x^42 + x^41 + x^40 + x^39 + x^37 + x^36 + x^34 + x^31 + x^30 + x^27 + x^26 + x^25 + x^23 + x^21 + x^19 + x^17 + x^15 + x^14 + x^11 + x^9 + x^8 + x^7 + x^6 + x^5 + x^2 + 1
     1025        x^60 + x^58 + x^56 + x^55 + x^52 + x^51 + x^50 + x^47 + x^44 + x^39 + x^36 + x^33 + x^31 + x^28 + x^27 + x^25 + x^23 + x^21 + x^17 + x^15 + x^14 + x^13 + x^11 + x^10 + x^9 + x^8 + x^7 + x^4 + 1
    10211026    """
    10221027    k = GF(p)
    10231028    from sage.rings.polynomial.polynomial_ring_constructor import PolynomialRing
  • sage/rings/finite_rings/finite_field_base.pyx

    diff --git a/sage/rings/finite_rings/finite_field_base.pyx b/sage/rings/finite_rings/finite_field_base.pyx
    a b  
    800800        if self.degree() == 1:
    801801            if isinstance(modulus, Integer):
    802802                return GF(self.characteristic()**modulus, modulus='conway', name=name, prefix=prefix)
    803             if isinstance(modulus, (list, tuple)):
     803            elif isinstance(modulus, (list, tuple)):
    804804                return GF(self.characteristic()**(len(modulus) - 1), name=name, modulus=modulus, prefix=prefix)
    805805            elif is_Polynomial(modulus):
    806806                if modulus.change_ring(self).is_irreducible():
  • sage/rings/finite_rings/integer_mod_ring.py

    diff --git a/sage/rings/finite_rings/integer_mod_ring.py b/sage/rings/finite_rings/integer_mod_ring.py
    a b  
    575575        """
    576576        return self
    577577
     578    def extension(self, poly, name=None, names=None, embedding=None):
     579        """
     580        Algebraically extends self by taking the quotient self[x] / (f(x)).
     581
     582        Specialized method for Integers(1).
     583        """
     584        if self.modulus() == 1:
     585            return self
     586        else:
     587            return CommutativeRing.extension(self, poly, name, names, embedding)
     588
    578589    @cached_method
    579590    def multiplicative_group_is_cyclic(self):
    580591        """