Ticket #9945: 9945-rebased.2.patch

File 9945-rebased.2.patch, 25.1 KB (added by mpatel, 11 years ago)

Rebased against #8334 which should be in 4.6.alpha2. Apply only this patch.

  • sage/categories/all.py

    # HG changeset patch
    # User Robert Bradshaw <robertwb@math.washington.edu>
    # Date 1284855068 25200
    # Node ID a90a6cf53f2e8ed8540a434159735213cd8cb562
    # Parent  0f5d83d02d8dc7a4b9fc257d9c751edd08d9d1a6
    #9945 - partial_fraction_decomposition broken for FpT elements
    
    Moved these methods into the category, fixed category of QQ as well.
    
    diff --git a/sage/categories/all.py b/sage/categories/all.py
    a b from finite_groups import FiniteGroups 
    4040from finite_permutation_groups import FinitePermutationGroups
    4141
    4242# fields
    43 from quotient_fields import QuotientFields
    44 from finite_fields import FiniteFields
    4543from number_fields import NumberFields
    4644
    4745# modules
  • sage/categories/basic.py

    diff --git a/sage/categories/basic.py b/sage/categories/basic.py
    a b from euclidean_domains import EuclideanD 
    4545from unique_factorization_domains import UniqueFactorizationDomains
    4646
    4747from fields import Fields
     48from quotient_fields import QuotientFields
     49from finite_fields import FiniteFields
  • sage/categories/quotient_fields.py

    diff --git a/sage/categories/quotient_fields.py b/sage/categories/quotient_fields.py
    a b QuotientFields 
    99#******************************************************************************
    1010
    1111from sage.categories.category import Category
    12 from sage.categories.all import Fields
    1312from sage.misc.cachefunc import cached_method
     13from sage.misc.abstract_method import abstract_method
    1414
    1515class QuotientFields(Category):
    1616    """
    class QuotientFields(Category): 
    3636            sage: QuotientFields().super_categories()
    3737            [Category of fields]
    3838        """
     39        from sage.categories.fields import Fields
    3940        return [Fields()]
    4041
    4142    class ParentMethods:
    4243        pass
    4344
    4445    class ElementMethods:
    45         pass
     46       
     47        @abstract_method
     48        def numerator(self):
     49            pass
     50       
     51        @abstract_method
     52        def denominator(self):
     53            pass
     54
     55        def factor(self, *args, **kwds):
     56            """
     57            Return the factorization of ``self`` over the base ring.
     58           
     59            INPUT:
     60           
     61            - ``*args`` - Arbitrary arguments suitable over the base ring
     62            - ``**kwds`` - Arbitrary keyword arguments suitable over the base ring
     63           
     64            OUTPUT:
     65           
     66            - Factorization of ``self`` over the base ring
     67           
     68            EXAMPLES::
     69           
     70                sage: K.<x> = QQ[]
     71                sage: f = (x^3+x)/(x-3)
     72                sage: f.factor()
     73                (x - 3)^-1 * x * (x^2 + 1)
     74           
     75            Here is an example to show that ticket #7868 has been resolved::
     76           
     77                sage: R.<x,y> = GF(2)[]
     78                sage: f = x*y/(x+y)
     79                sage: f.factor()
     80                Traceback (most recent call last):
     81                ...
     82                NotImplementedError: proof = True factorization not implemented.  Call factor with proof=False.
     83                sage: f.factor(proof=False)
     84                (x + y)^-1 * y * x
     85            """
     86            return (self.numerator().factor(*args, **kwds) /
     87                    self.denominator().factor(*args, **kwds))
     88
     89        def partial_fraction_decomposition(self):
     90            """
     91            Decomposes fraction field element into a whole part and a list of
     92            fraction field elements over prime power denominators.
     93           
     94            The sum will be equal to the original fraction.
     95           
     96            AUTHORS:
     97           
     98            - Robert Bradshaw (2007-05-31)
     99           
     100            EXAMPLES::
     101           
     102                sage: S.<t> = QQ[]
     103                sage: q = 1/(t+1) + 2/(t+2) + 3/(t-3); q
     104                (6*t^2 + 4*t - 6)/(t^3 - 7*t - 6)
     105                sage: whole, parts = q.partial_fraction_decomposition(); parts
     106                [3/(t - 3), 1/(t + 1), 2/(t + 2)]
     107                sage: sum(parts) == q
     108                True
     109                sage: q = 1/(t^3+1) + 2/(t^2+2) + 3/(t-3)^5
     110                sage: whole, parts = q.partial_fraction_decomposition(); parts
     111                [1/3/(t + 1), 3/(t^5 - 15*t^4 + 90*t^3 - 270*t^2 + 405*t - 243), (-1/3*t + 2/3)/(t^2 - t + 1), 2/(t^2 + 2)]
     112                sage: sum(parts) == q
     113                True
     114           
     115            We do the best we can over inexact fields::
     116           
     117                sage: R.<x> = RealField(20)[]
     118                sage: q = 1/(x^2 + x + 2)^2 + 1/(x-1); q
     119                (x^4 + 2.0000*x^3 + 5.0000*x^2 + 5.0000*x + 3.0000)/(x^5 + x^4 + 3.0000*x^3 - x^2 - 4.0000)
     120                sage: whole, parts = q.partial_fraction_decomposition(); parts
     121                [1.0000/(x - 1.0000), 1.0000/(x^4 + 2.0000*x^3 + 5.0000*x^2 + 4.0000*x + 4.0000)]
     122                sage: sum(parts)
     123                (x^4 + 2.0000*x^3 + 5.0000*x^2 + 5.0000*x + 3.0000)/(x^5 + x^4 + 3.0000*x^3 - x^2 - 4.0000)
     124   
     125            TESTS:
     126
     127            We test partial fraction for irreducible denominators::
     128           
     129                sage: R.<x> = ZZ[]
     130                sage: q = x^2/(x-1)
     131                sage: q.partial_fraction_decomposition()
     132                (x + 1, [1/(x - 1)])
     133                sage: q = x^10/(x-1)^5
     134                sage: whole, parts = q.partial_fraction_decomposition()
     135                sage: whole + sum(parts) == q
     136                True
     137
     138            And also over finite fields (see trac #6052, #9945)::
     139           
     140                sage: R.<x> = GF(2)[]
     141                sage: q = (x+1)/(x^3+x+1)
     142                sage: q.partial_fraction_decomposition()
     143                (0, [(x + 1)/(x^3 + x + 1)])
     144
     145                sage: R.<x> = GF(11)[]
     146                sage: q = x + 1 + 1/(x+1) + x^2/(x^3 + 2*x + 9)
     147                sage: q.partial_fraction_decomposition()
     148                (x + 1, [1/(x + 1), x^2/(x^3 + 2*x + 9)])
     149           
     150            And even the rationals::
     151           
     152                sage: (26/15).partial_fraction_decomposition()
     153                (1, [1/3, 2/5])
     154            """
     155            from sage.misc.misc import prod
     156            denom = self.denominator()
     157            whole, numer = self.numerator().quo_rem(denom)
     158            factors = denom.factor()
     159            if factors.unit() != 1:
     160                numer *= ~factors.unit()
     161            if len(factors) == 1:
     162                return whole, [numer/r**e for r,e in factors]
     163            if not self.parent().is_exact():
     164                # factors not grouped in this case
     165                all = {}
     166                for r in factors: all[r[0]] = 0
     167                for r in factors: all[r[0]] += r[1]
     168                factors = all.items()
     169                factors.sort() # for doctest consistency
     170            factors = [r**e for r,e in factors]
     171            parts = []
     172            for d in factors:
     173                # note that the product below is non-empty, since the case
     174                # of only one factor has been dealt with above
     175                n = numer * prod([r for r in factors if r != d]).inverse_mod(d) % d # we know the inverse exists as the two are relatively prime
     176                parts.append(n/d)
     177            return whole, parts
     178
     179        def derivative(self, *args):
     180            r"""
     181            The derivative of this rational function, with respect to variables
     182            supplied in args.
     183           
     184            Multiple variables and iteration counts may be supplied; see
     185            documentation for the global derivative() function for more
     186            details.
     187           
     188            .. seealso::
     189
     190               :meth:`_derivative`
     191           
     192            EXAMPLES::
     193           
     194                sage: F.<x> = Frac(QQ['x'])
     195                sage: (1/x).derivative()
     196                -1/x^2
     197           
     198            ::
     199           
     200                sage: (x+1/x).derivative(x, 2)
     201                2/x^3
     202           
     203            ::
     204           
     205                sage: F.<x,y> = Frac(QQ['x,y'])
     206                sage: (1/(x+y)).derivative(x,y)
     207                2/(x^3 + 3*x^2*y + 3*x*y^2 + y^3)
     208            """
     209            from sage.misc.derivative import multi_derivative
     210            return multi_derivative(self, args)
     211
     212        def _derivative(self, var=None):
     213            r"""
     214            Returns the derivative of this rational function with respect to the
     215            variable ``var``.
     216           
     217            Over an ring with a working GCD implementation, the derivative of a
     218            fraction `f/g`, supposed to be given in lowest terms, is computed as
     219            `(f'(g/d) - f(g'/d))/(g(g'/d))`, where `d` is a greatest common
     220            divisor of `f` and `g`.
     221           
     222            INPUT:
     223           
     224            - ``var`` - Variable with respect to which the derivative is computed
     225           
     226            OUTPUT:
     227           
     228            - Derivative of ``self`` with respect to ``var``
     229           
     230            .. seealso::
     231           
     232               :meth:`derivative`
     233           
     234            EXAMPLES::
     235           
     236                sage: F.<x> = Frac(QQ['x'])
     237                sage: t = 1/x^2
     238                sage: t._derivative(x)
     239                -2/x^3
     240                sage: t.derivative()
     241                -2/x^3
     242           
     243            ::
     244           
     245                sage: F.<x,y> = Frac(QQ['x,y'])
     246                sage: t = (x*y/(x+y))
     247                sage: t._derivative(x)
     248                y^2/(x^2 + 2*x*y + y^2)
     249                sage: t._derivative(y)
     250                x^2/(x^2 + 2*x*y + y^2)
     251           
     252            TESTS::
     253           
     254                sage: F.<t> = Frac(ZZ['t'])
     255                sage: F(0).derivative()
     256                0
     257                sage: F(2).derivative()
     258                0
     259                sage: t.derivative()
     260                1
     261                sage: (1+t^2).derivative()
     262                2*t
     263                sage: (1/t).derivative()
     264                -1/t^2
     265                sage: ((t+2)/(t-1)).derivative()
     266                -3/(t^2 - 2*t + 1)
     267                sage: (t/(1+2*t+t^2)).derivative()
     268                (-t + 1)/(t^3 + 3*t^2 + 3*t + 1)
     269            """
     270            R = self.parent()
     271            if var in R.gens():
     272                var = R.ring()(var)
     273           
     274            num = self.numerator()
     275            den = self.denominator()
     276           
     277            if (num.is_zero()):
     278                return R.zero_element()
     279           
     280            if R.is_exact():
     281                try:
     282                    numder = num._derivative(var)
     283                    dender = den._derivative(var)
     284                    d      = den.gcd(dender)
     285                    den    = den // d
     286                    dender = dender // d
     287                    tnum   = numder * den - num * dender
     288                    tden   = self.denominator() * den
     289                    if not tden.is_one() and tden.is_unit():
     290                        try:
     291                            tnum = tnum * tden.inverse_of_unit()
     292                            tden = R.ring().one_element()
     293                        except AttributeError:
     294                            pass
     295                        except NotImplementedError:
     296                            pass
     297                    return self.__class__(R, tnum, tden,
     298                        coerce=False, reduce=False)
     299                except AttributeError:
     300                    pass
     301                except NotImplementedError:
     302                    pass
     303                except TypeError:
     304                    pass
     305                num = self.numerator()
     306                den = self.denominator()
     307           
     308            num = num._derivative(var) * den - num * den._derivative(var)
     309            den = den**2
     310           
     311            return self.__class__(R, num, den,
     312                coerce=False, reduce=False)
     313
  • sage/rings/fraction_field.py

    diff --git a/sage/rings/fraction_field.py b/sage/rings/fraction_field.py
    a b import sage.misc.latex as latex 
    8282
    8383from sage.structure.parent import Parent
    8484from sage.structure.coerce_maps import CallableConvertMap
     85from sage.categories.basic import QuotientFields
    8586
    8687def FractionField(R, names=None):
    8788    """
    class FractionField_generic(field.Field) 
    155156    The fraction field of an integral domain.
    156157    """
    157158    def __init__(self, R,
    158             element_class=fraction_field_element.FractionFieldElement):
     159            element_class=fraction_field_element.FractionFieldElement,
     160            category=QuotientFields()):
    159161        """
    160162        Create the fraction field of the integral domain R.
    161163       
    class FractionField_generic(field.Field) 
    171173            Fraction Field of Univariate Polynomial Ring in x over Rational Field
    172174            sage: Frac(QQ['x,y']).variable_names()
    173175            ('x', 'y')
     176            sage: category(Frac(QQ['x']))
     177            Category of quotient fields
    174178        """
    175179        self._R = R
    176180        self._element_class = element_class
    177181        self._element_init_pass_parent = False
    178         Parent.__init__(self, base=R, names=R._names)
     182        Parent.__init__(self, base=R, names=R._names, category=category)
    179183
    180184    def __reduce__(self):
    181185        """
  • sage/rings/fraction_field_element.pyx

    diff --git a/sage/rings/fraction_field_element.pyx b/sage/rings/fraction_field_element.pyx
    a b from integer_ring import ZZ 
    4545from rational_field import QQ
    4646
    4747import sage.misc.latex as latex
    48 from sage.misc.misc import prod
    49 from sage.misc.derivative import multi_derivative
    5048
    5149def is_FractionFieldElement(x):
    5250    """
    cdef class FractionFieldElement(FieldEle 
    246244        """
    247245        return self.__denominator
    248246
    249     def factor(self, *args, **kwds):
    250         """
    251         Return the factorization of ``self`` over the base ring.
    252        
    253         INPUT:
    254        
    255         - ``*args`` - Arbitrary arguments suitable over the base ring
    256         - ``**kwds`` - Arbitrary keyword arguments suitable over the base ring
    257        
    258         OUTPUT:
    259        
    260         - Factorization of ``self`` over the base ring
    261        
    262         EXAMPLES::
    263        
    264             sage: K.<x> = QQ[]
    265             sage: f = (x^3+x)/(x-3)
    266             sage: f.factor()
    267             (x - 3)^-1 * x * (x^2 + 1)
    268        
    269         Here is an example to show that ticket #7868 has been resolved::
    270        
    271             sage: R.<x,y> = GF(2)[]
    272             sage: f = x*y/(x+y)
    273             sage: f.factor()
    274             Traceback (most recent call last):
    275             ...
    276             NotImplementedError: proof = True factorization not implemented.  Call factor with proof=False.
    277             sage: f.factor(proof=False)
    278             (x + y)^-1 * y * x
    279         """
    280         return self.numerator().factor(*args, **kwds) / \
    281             self.denominator().factor(*args, **kwds)
    282 
    283247    def __hash__(self):
    284248        """
    285249        This function hashes in a special way to ensure that generators of
    cdef class FractionFieldElement(FieldEle 
    333297            return -2
    334298        return n
    335299
    336     def partial_fraction_decomposition(self):
    337         """
    338         Decomposes fraction field element into a whole part and a list of
    339         fraction field elements over prime power denominators.
    340        
    341         The sum will be equal to the original fraction.
    342        
    343         AUTHORS:
    344        
    345         - Robert Bradshaw (2007-05-31)
    346        
    347         EXAMPLES::
    348        
    349             sage: S.<t> = QQ[]
    350             sage: q = 1/(t+1) + 2/(t+2) + 3/(t-3); q
    351             (6*t^2 + 4*t - 6)/(t^3 - 7*t - 6)
    352             sage: whole, parts = q.partial_fraction_decomposition(); parts
    353             [3/(t - 3), 1/(t + 1), 2/(t + 2)]
    354             sage: sum(parts) == q
    355             True
    356             sage: q = 1/(t^3+1) + 2/(t^2+2) + 3/(t-3)^5
    357             sage: whole, parts = q.partial_fraction_decomposition(); parts
    358             [1/3/(t + 1), 3/(t^5 - 15*t^4 + 90*t^3 - 270*t^2 + 405*t - 243), (-1/3*t + 2/3)/(t^2 - t + 1), 2/(t^2 + 2)]
    359             sage: sum(parts) == q
    360             True
    361        
    362         We do the best we can over in-exact fields::
    363        
    364             sage: R.<x> = RealField(70)[]
    365             sage: q = 1/(x^2 + 2)^2 + 1/(x-1); q
    366             (x^4 + 4.0000000000000000000*x^2 + x + 3.0000000000000000000)/(x^5 - x^4 + 4.0000000000000000000*x^3 - 4.0000000000000000000*x^2 + 4.0000000000000000000*x - 4.0000000000000000000)
    367             sage: whole, parts = q.partial_fraction_decomposition(); parts
    368             [1.0000000000000000000/(x - 1.0000000000000000000), (-3.3881317890172013563e-21*x^3 + 3.3881317890172013563e-21*x^2 - 3.3881317890172013563e-21*x + 1.0000000000000000000)/(x^4 + 4.0000000000000000000*x^2 + 4.0000000000000000000)]
    369             sage: sum(parts)
    370             (x^4 + 6.7762635780344027125e-21*x^3 + 4.0000000000000000000*x^2 + x + 3.0000000000000000000)/(x^5 - x^4 + 4.0000000000000000000*x^3 - 4.0000000000000000000*x^2 + 4.0000000000000000000*x - 4.0000000000000000000)
    371 
    372         TESTS:
    373 
    374         We test partial fraction for irreducible denominators::
    375        
    376             sage: R.<x> = ZZ[]
    377             sage: q = x^2/(x-1)
    378             sage: q.partial_fraction_decomposition()
    379             (x + 1, [1/(x - 1)])
    380             sage: q = x^10/(x-1)^5
    381             sage: whole, parts = q.partial_fraction_decomposition()
    382             sage: whole + sum(parts) == q
    383             True
    384 
    385         And also over finite fields (see trac #6052)::
    386        
    387             sage: R.<x> = GF(2)[]
    388             sage: q = (x+1)/(x^3+x+1)
    389             sage: q.partial_fraction_decomposition()
    390             (0, [(x + 1)/(x^3 + x + 1)])
    391         """
    392         denom = self.denominator()
    393         whole, numer = self.numerator().quo_rem(denom)
    394         factors = denom.factor()
    395         if factors.unit() != 1:
    396             numer *= ~factors.unit()
    397         if len(factors) == 1:
    398             return whole, [numer/r**e for r,e in factors]
    399         if not self._parent.is_exact():
    400             # factors not grouped in this case
    401             # TODO: think about changing the factor code itself
    402             # (what side effects would this have this be bad?)
    403             all = {}
    404             for r in factors: all[r[0]] = 0
    405             for r in factors: all[r[0]] += r[1]
    406             factors = all.items()
    407             factors.sort() # for doctest consistency
    408         factors = [r**e for r,e in factors]
    409         parts = []
    410         for d in factors:
    411             # note that the product below is non-empty, since the case
    412             # of only one factor has been dealt with above
    413             n = numer * prod([r for r in factors if r != d]).inverse_mod(d) % d # we know the inverse exists as the two are relatively prime
    414             parts.append(n/d)
    415         return whole, parts
    416 
    417300    def __call__(self, *x, **kwds):
    418301        """
    419302        Evaluate the fraction at the given arguments. This assumes that a
    cdef class FractionFieldElement(FieldEle 
    732615       
    733616        return self._mul_(rightinv)
    734617
    735     def derivative(self, *args):
    736         r"""
    737         The derivative of this rational function, with respect to variables
    738         supplied in args.
    739        
    740         Multiple variables and iteration counts may be supplied; see
    741         documentation for the global derivative() function for more
    742         details.
    743        
    744         .. seealso::
    745 
    746            :meth:`_derivative`
    747        
    748         EXAMPLES::
    749        
    750             sage: F = FractionField(PolynomialRing(RationalField(),'x'))
    751             sage: x = F.gen()
    752             sage: (1/x).derivative()
    753             -1/x^2
    754        
    755         ::
    756        
    757             sage: (x+1/x).derivative(x, 2)
    758             2/x^3
    759        
    760         ::
    761        
    762             sage: F = FractionField(PolynomialRing(RationalField(),'x,y'))
    763             sage: x,y = F.gens()
    764             sage: (1/(x+y)).derivative(x,y)
    765             2/(x^3 + 3*x^2*y + 3*x*y^2 + y^3)
    766         """
    767         return multi_derivative(self, args)
    768 
    769     def _derivative(self, var=None):
    770         r"""
    771         Returns the derivative of this rational function with respect to the
    772         variable ``var``.
    773        
    774         Over an ring with a working GCD implementation, the derivative of a
    775         fraction `f/g`, supposed to be given in lowest terms, is computed as
    776         `(f'(g/d) - f(g'/d))/(g(g'/d))`, where `d` is a greatest common
    777         divisor of `f` and `g`.
    778        
    779         INPUT:
    780        
    781         - ``var`` - Variable with respect to which the derivative is computed
    782        
    783         OUTPUT:
    784        
    785         - Derivative of ``self`` with respect to ``var``
    786        
    787         .. seealso::
    788        
    789            :meth:`derivative`
    790        
    791         EXAMPLES::
    792        
    793             sage: F = FractionField(PolynomialRing(RationalField(),'x'))
    794             sage: x = F.gen()
    795             sage: t = 1/x^2
    796             sage: t._derivative(x)
    797             -2/x^3
    798             sage: t.derivative()
    799             -2/x^3
    800        
    801         ::
    802        
    803             sage: F = FractionField(PolynomialRing(RationalField(),'x,y'))
    804             sage: x,y = F.gens()
    805             sage: t = (x*y/(x+y))
    806             sage: t._derivative(x)
    807             y^2/(x^2 + 2*x*y + y^2)
    808             sage: t._derivative(y)
    809             x^2/(x^2 + 2*x*y + y^2)
    810        
    811         TESTS::
    812        
    813             sage: F = Frac(PolynomialRing(ZZ, 't'))
    814             sage: t = F.gen()
    815             sage: F(0).derivative()
    816             0
    817             sage: F(2).derivative()
    818             0
    819             sage: t.derivative()
    820             1
    821             sage: (1+t^2).derivative()
    822             2*t
    823             sage: (1/t).derivative()
    824             -1/t^2
    825             sage: ((t+2)/(t-1)).derivative()
    826             -3/(t^2 - 2*t + 1)
    827             sage: (t/(1+2*t+t^2)).derivative()
    828             (-t + 1)/(t^3 + 3*t^2 + 3*t + 1)
    829         """
    830         if var in self._parent.gens():
    831             var = self._parent.ring()(var)
    832        
    833         num = self.__numerator
    834         den = self.__denominator
    835        
    836         if (num.is_zero()):
    837             return self._parent.zero_element()
    838        
    839         if self._parent.is_exact():
    840             try:
    841                 numder = num._derivative(var)
    842                 dender = den._derivative(var)
    843                 d      = den.gcd(dender)
    844                 den    = den // d
    845                 dender = dender // d
    846                 tnum   = numder * den - num * dender
    847                 tden   = self.__denominator * den
    848                 if not tden.is_one() and tden.is_unit():
    849                     try:
    850                         tnum = tnum * tden.inverse_of_unit()
    851                         tden = self._parent.ring().one_element()
    852                     except AttributeError:
    853                         pass
    854                     except NotImplementedError:
    855                         pass
    856                 return self.__class__(self._parent, tnum, tden,
    857                     coerce=False, reduce=False)
    858             except AttributeError:
    859                 pass
    860             except NotImplementedError:
    861                 pass
    862             except TypeError:
    863                 pass
    864        
    865         num = self.__numerator
    866         den = self.__denominator
    867         num = num._derivative(var) * den - num * den._derivative(var)
    868         den = den**2
    869        
    870         return self.__class__(self._parent, num, den,
    871             coerce=False, reduce=False)
    872 
    873618    def __int__(self):
    874619        """
    875620        EXAMPLES::
  • sage/rings/rational_field.py

    diff --git a/sage/rings/rational_field.py b/sage/rings/rational_field.py
    a b class RationalField(_uniq, number_field_ 
    152152            sage: Q.is_field()
    153153            True
    154154            sage: Q.category()
    155             Category of fields
     155            Category of quotient fields
    156156            sage: Q.zeta()
    157157            -1
    158158       
    class RationalField(_uniq, number_field_ 
    212212            sage: QQ.variable_names()
    213213            ('x',)
    214214        """
    215         from sage.categories.fields import Fields
    216         ParentWithGens.__init__(self, self, category = Fields())
     215        from sage.categories.basic import QuotientFields
     216        ParentWithGens.__init__(self, self, category = QuotientFields())
    217217        self._assign_names(('x',),normalize=False) # ???
    218218        self._populate_coercion_lists_(element_constructor=rational.Rational, init_no_parent=True)
    219219
  • sage/rings/ring.pyx

    diff --git a/sage/rings/ring.pyx b/sage/rings/ring.pyx
    a b cdef class Field(PrincipalIdealDomain): 
    16931693    def category(self):
    16941694        """
    16951695        Return the category of this field, which is the category
    1696         of fields.
     1696        of fields or a subcategory thereof.
    16971697
    16981698        EXAMPLES:
    16991699
    17001700        Examples with fields::
    17011701
    17021702            sage: QQ.category()
    1703             Category of fields
     1703            Category of quotient fields
    17041704            sage: RR.category()
    17051705            Category of fields
    17061706            sage: CC.category()
    cdef class Field(PrincipalIdealDomain): 
    17081708            sage: R.<x> = PolynomialRing(ZZ)
    17091709            sage: Q = R.fraction_field()
    17101710            sage: Q.category()
    1711             Category of fields
     1711            Category of quotient fields
    17121712
    17131713        Although fields themselves, number fields belong to the category
    17141714        of 'number fields'::