Ticket #3835: trac_3835-algebraic_closure.patch

File trac_3835-algebraic_closure.patch, 4.5 KB (added by cremona, 12 years ago)

Applies to 4.1.1

  • sage/rings/complex_field.py

    # HG changeset patch
    # User John Cremona <john.cremona@gmail.com>
    # Date 1251664397 -3600
    # Node ID df1c71a8d73a14131da533285f3565db5f8050e5
    # Parent  684eea91ff224e5bc6259ca19f1576c4c082b9d3
    #3835: Implement algebraic_closure() function for fields
    
    diff -r 684eea91ff22 -r df1c71a8d73a sage/rings/complex_field.py
    a b  
    466466    def scientific_notation(self, status=None):
    467467        return self._real_field().scientific_notation(status)
    468468
     469    def algebraic_closure(self):
     470        """
     471        Return the algebraic closure of self (which is itself).
     472
     473        EXAMPLES::
     474       
     475            sage: CC
     476            Complex Field with 53 bits of precision
     477            sage: CC.algebraic_closure()
     478            Complex Field with 53 bits of precision
     479            sage: CC = ComplexField(1000)
     480            sage: CC.algebraic_closure() is CC
     481            True
     482        """
     483        return self
     484   
  • sage/rings/number_field/number_field.py

    diff -r 684eea91ff22 -r df1c71a8d73a sage/rings/number_field/number_field.py
    a b  
    15441544        else:
    15451545            return embedding(self.gen())
    15461546
     1547    def algebraic_closure(self):
     1548        """
     1549        Return the algebraic closure of self (which is QQbar).
     1550
     1551        EXAMPLES::
     1552       
     1553            sage: K.<i> = QuadraticField(-1)
     1554            sage: K.algebraic_closure()
     1555            Algebraic Field
     1556            sage: K.<a> = NumberField(x^3-2)
     1557            sage: K.algebraic_closure()
     1558            Algebraic Field
     1559            sage: K = CyclotomicField(23)
     1560            sage: K.algebraic_closure()
     1561            Algebraic Field
     1562        """
     1563        return sage.rings.all.QQbar
     1564
    15471565    def latex_variable_name(self, name=None):
    15481566        """
    15491567        Return the latex representation of the variable name for this
  • sage/rings/rational_field.py

    diff -r 684eea91ff22 -r df1c71a8d73a sage/rings/rational_field.py
    a b  
    731731        from sage.rings.number_field.all import NumberField
    732732        return NumberField(poly, names=names, check=check, embedding=embedding)
    733733
     734    def algebraic_closure(self):
     735        """
     736        Return the algebraic closure of self (which is QQbar).
     737
     738        EXAMPLES::
     739       
     740            sage: QQ.algebraic_closure()
     741            Algebraic Field
     742        """
     743        from sage.rings.all import QQbar
     744        return QQbar
     745
    734746    def order(self):
    735747        """
    736748        EXAMPLES::
  • sage/rings/ring.pyx

    diff -r 684eea91ff22 -r df1c71a8d73a sage/rings/ring.pyx
    a b  
    14741474            import sage.rings.finite_field
    14751475            return sage.rings.finite_field.FiniteField(self.characteristic())
    14761476
     1477    def algebraic_closure(self):
     1478        """
     1479        Return the algebraic closure of self.
     1480
     1481        .. note::
     1482
     1483           This is only implemented for certain classes of field.
     1484
     1485        EXAMPLES::
     1486       
     1487            sage: K = PolynomialRing(QQ,'x').fraction_field(); K
     1488            Fraction Field of Univariate Polynomial Ring in x over Rational Field
     1489            sage: K.algebraic_closure()
     1490            Traceback (most recent call last):
     1491            ...
     1492            NotImplementedError: Algebraic closures of general fields not implemented.
     1493        """
     1494        raise NotImplementedError, "Algebraic closures of general fields not implemented."
     1495
    14771496cdef class FiniteFieldIterator:
    14781497    cdef object iter
    14791498    cdef FiniteField parent
     
    20402059        """
    20412060        return self._factory_data[0].reduce_data(self)
    20422061
     2062    def algebraic_closure(self):
     2063        """
     2064        Return the algebraic closure of self (not implemented).
     2065
     2066        .. note::
     2067
     2068           This is not yet implemented for finite fields.
     2069
     2070        EXAMPLES::
     2071       
     2072            sage: GF(5).algebraic_closure()
     2073            Traceback (most recent call last):
     2074            ...
     2075            NotImplementedError: Algebraic closures of finite fields not implemented.
     2076        """
     2077        raise NotImplementedError, "Algebraic closures of finite fields not implemented."
     2078
     2079
    20432080def unpickle_FiniteField_ext(_type, order, variable_name, modulus, kwargs):
    20442081    return _type(order, variable_name, modulus, **kwargs)
    20452082