Ticket #8335: 8335_finite_field_coerce_vs_47.patch

File 8335_finite_field_coerce_vs_47.patch, 25.1 KB (added by roed, 10 years ago)

Against 4.7 for patchbot

  • sage/categories/pushout.py

    # HG changeset patch
    # User David Roe <roed@math.harvard.edu>
    # Date 1266946333 18000
    # Node ID 3b66223207f9ff0d0a633d211f04b895595b2538
    # Parent  bd9e7c288acb4801807f58cfeb9800c70abefe1c
    8335: Modifies _coerce_map_from_ for finite fields and AlgebraicExtensionFunctor in pushout to allow for coercion within lattices of finite fields defined by Conway and pseudo-Conway polynomials.  Defines a subfields() method on finite fields analogous to the one on number fields.
    
    diff -r bd9e7c288acb -r 3b66223207f9 sage/categories/pushout.py
    a b  
    23852385    """
    23862386    rank = 3
    23872387   
    2388     def __init__(self, polys, names, embeddings, cyclotomic=None):
     2388    def __init__(self, polys, names, embeddings, cyclotomic=None, prefix=None):
    23892389        """
    23902390        INPUT:
    23912391
    2392         - ``polys``: a list of polynomials
     2392        - ``polys``: a list of polynomials (or of integers, for
     2393          finite fields and unramified local extensions)
    23932394        - ``names``: a list of strings of the same length as the
    23942395          list ``polys``
    23952396        - ``embeddings``: a list of approximate complex values,
     
    23992400        - ``cyclotomic``: optional integer. If it is provided,
    24002401          application of the functor to the rational field yields
    24012402          a cyclotomic field, rather than just a number field.
     2403        - ``prefix``: optional string.  If it is provided, it will
     2404          allow application of this functor to some finite fields to
     2405          function without providing a variable name
    24022406
    24032407        REMARK:
    24042408
     
    24632467        self.names = list(names)
    24642468        self.embeddings = list(embeddings)
    24652469        self.cyclotomic = int(cyclotomic) if cyclotomic is not None else None
     2470        self.prefix = prefix
    24662471
    24672472    def _apply_functor(self, R):
    24682473        """
     
    24802485            Univariate Quotient Polynomial Ring in a over Real Field with 53 bits of precision with modulus a^3 + a^2 + 1.00000000000000
    24812486        """
    24822487        from sage.all import QQ, ZZ, CyclotomicField
     2488        from sage.rings.finite_rings.finite_field_base import is_FiniteField
    24832489        if self.cyclotomic:
    24842490            if R==QQ:
    24852491                return CyclotomicField(self.cyclotomic)
    24862492            if R==ZZ:
    24872493                return CyclotomicField(self.cyclotomic).maximal_order()
    24882494        if len(self.polys) == 1:
    2489             return R.extension(self.polys[0], self.names[0], embedding=self.embeddings[0])
     2495            if is_FiniteField(R):
     2496                return R.extension(self.polys[0], self.names[0], embedding=self.embeddings[0], prefix=self.prefix)
     2497            else:
     2498                return R.extension(self.polys[0], self.names[0], embedding=self.embeddings[0])
    24902499        return R.extension(self.polys, self.names, embedding=self.embeddings)
    24912500
    24922501    def __cmp__(self, other):
     
    25252534          associated with the pushout of the codomains
    25262535          of the two embeddings is returned, provided that
    25272536          it is a number field.
     2537        - If these two extensions are defined by Conway polynomials over finite fields
     2538          (indicated by the fact that their ``poly`` fields are just integers),
     2539          merges them into a single extension of degree the product of the two degrees.
    25282540        - Otherwise, None is returned.
    25292541         
    25302542        REMARK:
     
    25362548
    25372549        TESTS::
    25382550
     2551            sage: k = GF(3^3)
     2552            sage: l = GF(3^2)
     2553            sage: k.gen() + l.gen() # indirect doctest
     2554            z6^5 + 2*z6^4 + 2*z6^3 + z6^2 + 2*z6 + 1
    25392555            sage: P.<x> = QQ[]
    25402556            sage: L.<b> = NumberField(x^8-x^4+1, embedding=CDF.0)
    25412557            sage: M1.<c1> = NumberField(x^2+x+1, embedding=b^4-1)
     
    25652581            CoercionException: ('Ambiguous Base Extension', Number Field in a with defining polynomial x^3 - 2, Number Field in b with defining polynomial x^6 - 2)
    25662582
    25672583        """
    2568         if not isinstance(other,AlgebraicExtensionFunctor):
     2584        if isinstance(other, AlgebraicClosureFunctor):
     2585            return other
     2586        elif not isinstance(other,AlgebraicExtensionFunctor):
    25692587            return None
    25702588        if self == other:
    25712589            return self
     
    25852603#                return self
    25862604#            if  other.embeddings==[None]:
    25872605#                return other
    2588         # ... or we may use the given embeddings:
     2606        # ... or we may use the given embeddings
     2607        from sage.rings.integer import Integer
     2608        # finite fields use an integer to encode the pseudo-Conway extension that allows pushouts
     2609        if isinstance(self.polys[0], Integer) and isinstance(other.polys[0], Integer) and self.prefix is not None and self.prefix == other.prefix:
     2610            if self.embeddings != [None] or other.embeddings != [None]:
     2611                raise NotImplementedError
     2612            return AlgebraicExtensionFunctor([self.polys[0]*other.polys[0]],[None],[None],prefix=self.prefix)
    25892613        if self.embeddings!=[None] and other.embeddings!=[None]:
    25902614            from sage.all import QQ
    25912615            KS = self(QQ)
  • sage/rings/finite_rings/constructor.py

    diff -r bd9e7c288acb -r 3b66223207f9 sage/rings/finite_rings/constructor.py
    a b  
    666666        sage: from sage.rings.finite_rings.constructor import find_pseudo_conway_polynomial_tree
    667667        sage: PCPT = find_pseudo_conway_polynomial_tree(2, 12, False)
    668668        sage: PCPT.f
    669         x^12 + x^8 + x^7 + x^6 + x^4 + x^3 + 1
     669        x^12 + x^10 + x^9 + x^8 + x^4 + x^2 + 1
    670670    """
    671671    if not pseudo_conway_poly.has_key(p):
    672672        pseudo_conway_poly[p] = {}
  • sage/rings/finite_rings/element_base.pyx

    diff -r bd9e7c288acb -r 3b66223207f9 sage/rings/finite_rings/element_base.pyx
    a b  
    6969            else: raise ValueError, "no nth root"
    7070        self = self**alpha
    7171        if cunningham:
    72             F = n._factor_cunningham()
     72            from sage.rings.factorint import factor_cunningham
     73            F = factor_cunningham(n)
    7374        else:
    7475            F = n.factor()
    7576        from sage.groups.generic import discrete_log
  • sage/rings/finite_rings/element_ntl_gf2e.pyx

    diff -r bd9e7c288acb -r 3b66223207f9 sage/rings/finite_rings/element_ntl_gf2e.pyx
    a b  
    523523            from sage.rings.residue_field import ResidueField_generic
    524524            if isinstance(R, ResidueField_generic):
    525525                return False
    526             if PY_TYPE_CHECK(R, IntegerModRing_generic) and R.characteristic() % 2 == 0:
    527                 return True
    528526            if R.characteristic() == 2:
     527                if PY_TYPE_CHECK(R, IntegerModRing_generic):
     528                    return True
    529529                if R.degree() == 1:
    530530                    return True
    531531                elif self.degree() % R.degree() == 0:
    532                     # This is where we *would* do coercion from one nontrivial finite field to another...
    533                     raise NotImplementedError
     532                    if self._PCPT is not None and hasattr(R, '_PCPT') and R._PCPT is not None:
     533                        from homset import FiniteFieldHomset, FiniteFieldHomomorphism_im_gens
     534                        return FiniteFieldHomomorphism_im_gens(FiniteFieldHomset(R, self), self.gen()**((self.order()-1)//(R.order()-1)))
    534535
    535536    def gen(FiniteField_ntl_gf2e self, ignored=None):
    536537        r"""
     
    12831284            sage: g = K.random_element()
    12841285            sage: g.minpoly()(g)
    12851286            0
     1287
     1288        We check that the NTL modulus is restored properly::
     1289
     1290            sage: k.<a> = GF(2^1000)
     1291            sage: b = a^(k.order()//(2^20-1))
     1292            sage: l.<c> = GF(2^20)
     1293            sage: b.minpoly()
     1294            x^20 + x^17 + x^16 + x^14 + x^13 + x^11 + x^8 + x^7 + x^3 + x + 1
    12861295        """
    12871296        (<FiniteField_ntl_gf2e>self._parent).F.restore()
    12881297        cdef GF2X_c r = GF2X_IrredPolyMod(GF2E_rep(self.x), GF2E_modulus())
  • sage/rings/finite_rings/finite_field_base.pyx

    diff -r bd9e7c288acb -r 3b66223207f9 sage/rings/finite_rings/finite_field_base.pyx
    a b  
    310310            ...
    311311            TypeError: images do not define a valid homomorphism           
    312312        """
    313 
    314313        if (self.characteristic() != codomain.characteristic()):
    315314            raise ValueError, "no map from %s to %s"%(self, codomain)
    316315        if (len(im_gens) != 1):
     
    516515        """
    517516        if self.__factored_unit_order is None:
    518517            if self.characteristic() in []: # want to be [2,3,5,7,11] once #7240 is finished.
    519                 self.__factored_unit_order = [(self.order()-1)._factor_cunningham()]
     518                from sage.rings.factorint import factor_cunningham
     519                self.__factored_unit_order = [factor_cunningham(self.order()-1)]
    520520            else:
    521521                self.__factored_unit_order = [(self.order()-1).factor()]
    522522        return self.__factored_unit_order
     
    715715        """
    716716        return hash("GF") + hash(self.order())
    717717
     718    def construction(self):
     719        """
     720        Returns the construction of this finite field, as a ConstructionFunctor and the base field.
     721
     722        EXAMPLES::
     723       
     724            sage: v = GF(3^3).construction(); v
     725            (AlgebraicExtensionFunctor, Finite Field of size 3)
     726            sage: v[0].polys[0]
     727            3
     728            sage: v = GF(2^1000,'a').construction(); v[0].polys[0]
     729            a^1000 + a^5 + a^4 + a^3 + 1
     730        """
     731        from sage.categories.pushout import AlgebraicExtensionFunctor
     732        if self.degree() == 1:
     733            # this is not of type FiniteField_prime_modn
     734            from sage.rings.integer import Integer
     735            return AlgebraicExtensionFunctor([Integer(1)], [None],[None]), self.base_ring()
     736        elif hasattr(self, '_PCPT') and self._PCPT is not None:
     737            return AlgebraicExtensionFunctor([self.degree()], [self.variable_name()],[None],prefix=self._prefix), self.base_ring()
     738        else:
     739            return AlgebraicExtensionFunctor([self.polynomial()], [self.variable_name()],[None]), self.base_ring()
     740
     741    def extension(self, modulus, name=None, names=None, embedding=None, prefix='z'):
     742        """
     743        Returns an extension of this finite field.
     744
     745        INPUT::
     746
     747        - modulus -- either a polynomial with coefficients in this field or an integer. 
     748                     If an integer, returns the pseudo-Conway extension of this field of that degree.
     749        - name -- the name of the generator in the new extension
     750        - embedding -- currently not used; for compatibility with other AlgebraicExtensionFunctor calls.
     751        - prefix -- Passed on to the finite field constructor.  See the documentation of
     752                    ``GF`` in ``sage.rings.finite_rings.constructor``
     753
     754        OUTPUT::
     755       
     756        An extension of the given modulus, or pseudo-Conway of the given degree if the modulus is just an integer.
     757       
     758        EXAMPLES::
     759
     760            sage: k = GF(3^4)
     761            sage: k.extension(3)
     762            Finite Field in z12 of size 3^12
     763            sage: R.<x> = GF(2)[]
     764            sage: GF(2).extension(x^1000 + x^5 + x^4 + x^3 + 1,'a')
     765            Finite Field in a of size 2^1000
     766            sage: R.<x> = GF(3)[]
     767
     768        Extensions of non-prime finite fields by polynomials are not yet supported: we fall back to generic code.
     769
     770            sage: k.extension(x^5 + x^2 + x - 1)
     771            Univariate Quotient Polynomial Ring in x over Finite Field in z4 of size 3^4 with modulus x^5 + x^2 + x + 2
     772        """
     773        from constructor import GF
     774        from sage.rings.integer import Integer
     775        from sage.rings.polynomial.all import is_Polynomial
     776        if name is None and names is not None:
     777            name = names
     778        if self.degree() == 1:
     779            if isinstance(modulus, Integer):
     780                return GF(self.characteristic()**modulus, modulus='conway', name=name, prefix=prefix)
     781            if isinstance(modulus, (list, tuple)):
     782                return GF(self.characteristic()**(len(modulus) - 1), name=name, modulus=modulus, prefix=prefix)
     783            elif is_Polynomial(modulus):
     784                if modulus.change_ring(self).is_irreducible():
     785                    return GF(self.characteristic()**(modulus.degree()), name=name, modulus=modulus, prefix=prefix)
     786                else:
     787                    return Field.extension(self, modulus, name=name, embedding=embedding)
     788        elif isinstance(modulus, Integer):
     789            if hasattr(self, '_PCPT') and self._PCPT is not None:
     790                return GF(self.order()**modulus, name=name, prefix=prefix)
     791        return Field.extension(self, modulus, name=name, embedding=embedding)
     792
     793    def subfields(self, degree=0, name=None):
     794        """
     795        Return all proper subfields of self of the given degree,
     796        or of all possible degrees if degree is 0. 
     797
     798        The subfields are returned as
     799        absolute fields together with an embedding into self.
     800
     801        INPUT::
     802
     803        - degree -- (default 0) An integer.
     804        - name -- A string, a dictionary or None.
     805                  If degree is nonzero, name must be a string (or None, if this is a pseudo-Conway extension), and will be the variable name of the returned field.
     806                  If degree is zero, the dictionary should have keys the divisors of the degree of this field, with the desired variable name for the field of that degree as an entry.
     807                  As a shortcut, you can provide a string and the degree of each subfield will be appended for the variable name of that subfield.
     808                  If None, uses the prefix of this field.
     809   
     810        OUTPUT::
     811
     812        A list of pairs (K, e), where K ranges over the subfields of this field and e gives an embedding of K into this field.
     813
     814        EXAMPLES::
     815
     816            sage: k.<a> = GF(2^21)
     817            sage: k.subfields()
     818            [(Finite Field of size 2,
     819              Conversion map:
     820                  From: Finite Field of size 2
     821                  To:   Finite Field in a of size 2^21),
     822             (Finite Field in z3 of size 2^3,
     823              Ring morphism:
     824                  From: Finite Field in z3 of size 2^3
     825                  To:   Finite Field in a of size 2^21
     826                  Defn: z3 |--> a^20 + a^19 + a^17 + a^15 + a^11 + a^9 + a^8 + a^6 + a^2),
     827             (Finite Field in z7 of size 2^7,
     828              Ring morphism:
     829                  From: Finite Field in z7 of size 2^7
     830                  To:   Finite Field in a of size 2^21
     831                  Defn: z7 |--> a^20 + a^19 + a^17 + a^15 + a^14 + a^6 + a^4 + a^3 + a)]
     832        """
     833        from sage.rings.integer import Integer
     834        from constructor import GF
     835        p = self.characteristic()
     836        if degree != 0:
     837            degree = Integer(degree)
     838            if degree.divides(self.degree()):
     839                if hasattr(self, '_PCPT') and self._PCPT is not None:
     840                    K = GF(p**degree, name=name, prefix=self._prefix)
     841                    return [K, self.coerce_map_from(K)]
     842                elif degree == 1:
     843                    K = GF(p)
     844                    return [K, self.coerce_map_from(K)]
     845                else:
     846                    deg_gen = self.multiplicative_generator()**((self.order() - 1)//(p**degree-1))
     847                    from homset import FiniteFieldHomset, FiniteFieldHomomorphism_im_gens
     848                    K = GF(p**degree, modulus=deg_gen.minimal_polynomial(), name=name, prefix=self._prefix)
     849                    return [K, FiniteFieldHomomorphism_im_gens(FiniteFieldHomset(K, self), deg_gen)]
     850            else:
     851                return []
     852        if hasattr(self, '_PCPT') and self._PCPT is not None:
     853            if name is None:
     854                name = self._prefix
     855        else:
     856            if isinstance(name, str):
     857                prefix = name
     858                name = {}
     859            else:
     860                if self._prefix is None:
     861                    prefix = self.variable_name()
     862                else:
     863                    prefix = self._prefix
     864                if name is None:
     865                    name = {}
     866                elif not isinstance(name, dict):
     867                    raise ValueError, "name must be None, a string or a dictionary indexed by divisors of the degree"
     868            for m in self.degree().divisors():
     869                name[m] = prefix + str(m)
     870        ans = []
     871        from homset import FiniteFieldHomset, FiniteFieldHomomorphism_im_gens
     872        for m in self.degree().divisors():
     873            if m == self.degree(): continue
     874            if hasattr(self, '_PCPT') and self._PCPT is not None:
     875                K = GF(p**m, prefix=name)
     876                ans.append((K, self.coerce_map_from(K)))
     877            elif m == 1:
     878                ans.append((GF(p), self.coerce_map_from(K)))
     879            else:
     880                deg_gen = self.multiplicative_generator()**((self.order() - 1)//(p**m-1))
     881                K = GF(p**m, modulus=deg_gen.minimal_polynomial(), name=name[m])
     882                print K
     883                ans.append((K, FiniteFieldHomomorphism_im_gens(FiniteFieldHomset(K, self), deg_gen)))
     884        return ans
     885
    718886    def algebraic_closure(self):
    719887        """
    720888        Return the algebraic closure of self (not implemented).
  • sage/rings/finite_rings/finite_field_ext_pari.py

    diff -r bd9e7c288acb -r 3b66223207f9 sage/rings/finite_rings/finite_field_ext_pari.py
    a b  
    607607            ...
    608608            TypeError: no canonical coercion from Finite Field in a of size 2^2 to Finite Field in a of size 2^3
    609609            sage: FiniteField_ext_pari(16,'a')._coerce_(FiniteField_ext_pari(4,'a').0)
    610             Traceback (most recent call last):
    611             ...
    612             TypeError: no canonical coercion from Finite Field in a of size 2^2 to Finite Field in a of size 2^4
     610            a^2 + a
    613611            sage: k = FiniteField_ext_pari(8,'a')
    614612            sage: k._coerce_(FiniteField(7,'a')(2))
    615613            Traceback (most recent call last):
     
    617615            TypeError: no canonical coercion from Finite Field of size 7 to Finite Field in a of size 2^3
    618616        """
    619617        from sage.rings.integer_ring import ZZ
     618        from sage.rings.finite_rings.finite_field_base import is_FiniteField
    620619        from sage.rings.finite_rings.integer_mod_ring import IntegerModRing_generic
    621620        if R is int or R is long or R is ZZ:
    622621            return True
    623         if isinstance(R, FiniteField_ext_pari):
     622        if is_FiniteField(R):
    624623            if R is self:
    625624                return True
     625            from sage.rings.residue_field import ResidueField_generic
     626            if isinstance(R, ResidueField_generic):
     627                return False
    626628            if R.characteristic() == self.characteristic():
     629                if isinstance(R, IntegerModRing_generic):
     630                    return True
    627631                if R.degree() == 1:
    628632                    return True
    629                 elif self.degree() % R.degree() == 0:
    630                     # TODO: This is where we *would* do coercion from one nontrivial finite field to another...
    631                     return False               
    632         from sage.rings.residue_field import ResidueField_generic
    633         if isinstance(R, IntegerModRing_generic) and R.characteristic() == self.characteristic() and not isinstance(R, ResidueField_generic):
    634             return True
     633                if self.degree() % R.degree() == 0:
     634                    if hasattr(self, '_PCPT') and hasattr(R, '_PCPT') and R._PCPT is not None:
     635                        from homset import FiniteFieldHomset, FiniteFieldHomomorphism_im_gens
     636                        return FiniteFieldHomomorphism_im_gens(FiniteFieldHomset(R, self), self.gen()**((self.order()-1)//(R.order()-1)))
    635637
    636638    def __len__(self):
    637639        """
  • sage/rings/finite_rings/finite_field_givaro.py

    diff -r bd9e7c288acb -r 3b66223207f9 sage/rings/finite_rings/finite_field_givaro.py
    a b  
    326326            sage: F9 = FiniteField_givaro(9)
    327327            sage: F81 = FiniteField_givaro(81)
    328328            sage: F81(F9.gen())
    329             Traceback (most recent call last):
    330             ...
    331             NotImplementedError
     329            2*a^3 + 2*a^2 + 1
    332330        """
    333331        return self._cache.element_from_data(e)
    334332
     
    352350                    return True
    353351                if R.degree() == 1:
    354352                    return True
    355                 elif self.degree() % R.degree() == 0:
    356                     # This is where we *would* do coercion from one nontrivial finite field to another...
    357                     raise NotImplementedError
     353                if self.degree() % R.degree() == 0:
     354                    if hasattr(self, '_PCPT') and hasattr(R, '_PCPT') and R._PCPT is not None:
     355                        from homset import FiniteFieldHomset, FiniteFieldHomomorphism_im_gens
     356                        return FiniteFieldHomomorphism_im_gens(FiniteFieldHomset(R, self), self.gen()**((self.order()-1)//(R.order()-1)))
    358357
    359358    def gen(self, n=0):
    360359        r"""
  • sage/rings/finite_rings/finite_field_prime_modn.py

    diff -r bd9e7c288acb -r 3b66223207f9 sage/rings/finite_rings/finite_field_prime_modn.py
    a b  
    154154        if to_ZZ is not None:
    155155            return integer_mod.Integer_to_IntegerMod(self) * to_ZZ
    156156
     157    def construction(self):
     158        """
     159        Returns the construction of this finite field (for use by sage.categories.pushout)
     160
     161        EXAMPLES::
     162
     163            sage: GF(3).construction()
     164            (QuotientFunctor, Integer Ring)
     165        """
     166        return integer_mod_ring.IntegerModRing_generic.construction(self)
     167
    157168    def characteristic(self):
    158169        r"""
    159170        Return the characteristic of \code{self}.
  • sage/rings/finite_rings/homset.py

    diff -r bd9e7c288acb -r 3b66223207f9 sage/rings/finite_rings/homset.py
    a b  
    77    """
    88    Set of homomorphisms with domain a given finite field.
    99    """
     10#     def __init__(self, R, S, category=None):
     11#         if category is None:
     12#             from sage.categories.finite_fields import FiniteFields
     13#             category = FiniteFields()
     14#         RingHomset_generic.__init__(self, R, S, category)
     15
    1016    def __call__(self, im_gens, check=True):
    1117        """
    1218        EXAMPLES:
  • sage/sets/set.py

    diff -r bd9e7c288acb -r 3b66223207f9 sage/sets/set.py
    a b  
    378378            sage: Set(GF(2)) + Set(GF(4,'a'))
    379379            {0, 1, a, a + 1}
    380380            sage: Set(GF(8,'b')) + Set(GF(4,'a'))
    381             {0, 1, b, b + 1, b^2, b^2 + 1, b^2 + b, b^2 + b + 1, a, a + 1, 1, 0}
     381            {0, 1, b, b + 1, b^2, b^2 + 1, b^2 + b, b^2 + b + 1, a, a + 1}
    382382        """
    383383        return self.union(X)
    384384
     
    413413
    414414            sage: X = Set(GF(9,'b')).intersection(Set(GF(27,'c')))
    415415            sage: X
    416             {}
     416            {0, 1, 2}
    417417
    418418            sage: X = Set(GF(9,'b')).intersection(Set(GF(27,'b')))
    419419            sage: X
    420             {}
     420            {0, 1, 2}
    421421        """
    422422        if is_Set(X):
    423423            if self is X:
     
    443443
    444444            sage: X = Set(GF(9,'b')).difference(Set(GF(27,'c')))
    445445            sage: X
    446             {0, 1, 2, b, b + 1, b + 2, 2*b, 2*b + 1, 2*b + 2}
     446            {b, b + 1, b + 2, 2*b, 2*b + 1, 2*b + 2}
    447447
    448448            sage: X = Set(GF(9,'b')).difference(Set(GF(27,'b')))
    449449            sage: X
    450             {0, 1, 2, b, b + 1, b + 2, 2*b, 2*b + 1, 2*b + 2}
     450            {b, b + 1, b + 2, 2*b, 2*b + 1, 2*b + 2}
    451451        """
    452452        if is_Set(X):
    453453            if self is X:
  • sage/structure/factory.pyx

    diff -r bd9e7c288acb -r 3b66223207f9 sage/structure/factory.pyx
    a b  
    232232
    233233        EXAMPLES:
    234234            sage: key, _ = GF.create_key_and_extra_args(27, 'k'); key
    235             (27, ('k',), 'conway', None, '{}')
     235            (27, ('k',), 'conwayz', None, '{}')
    236236            sage: K = GF.create_object(0, key); K
    237237            Finite Field in k of size 3^3
    238238            sage: GF.other_keys(key, K)
  • sage/tests/french_book/numbertheory.py

    diff -r bd9e7c288acb -r 3b66223207f9 sage/tests/french_book/numbertheory.py
    a b  
    4848sage: p = R(x+1); R2(p)
    4949Traceback (most recent call last):
    5050...
    51 NotImplementedError
     51TypeError: unable to coerce from a finite field other than the prime subfield
    5252sage: rational_reconstruction(411,1000)
    5353-13/17
    5454sage: rational_reconstruction(409,1000)