Changeset 7492:22c24fe79fcf


Ignore:
Timestamp:
12/01/07 22:11:13 (5 years ago)
Author:
David Roe <roed@…>
Branch:
default
Message:

Added algebraic closure construction functor.

Location:
sage
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • sage/categories/pushout.py

    r6689 r7492  
    4040        return False 
    4141         
    42 class CompositConstructionFunctor(ConstructionFunctor): 
     42class CompositeConstructionFunctor(ConstructionFunctor): 
    4343    def __init__(self, first, second): 
    4444        Functor.__init__(self, first.domain(), second.codomain()) 
     
    254254            c = cmp(self.poly, other.poly) 
    255255        return c 
     256 
     257class AlgebraicClosureFunctor(ConstructionFunctor): 
     258    def __init__(self): 
     259        Functor.__init__(self, Rings(), Rings()) 
     260        self.rank = 3 
     261    def __call__(self, R): 
     262        return R.algebraic_closure() 
     263    def merge(self, other): 
     264        # Algebraic Closure subsumes Algebraic Extension 
     265        return self 
    256266         
    257267def BlackBoxConstructionFunctor(ConstructionFunctor): 
  • sage/rings/complex_double.pyx

    r7435 r7492  
    277277            sage: parent(a) 
    278278            Symbolic Ring 
     279 
     280        sage: CDF(1) + RR(1) 
     281        2.0 
    279282        """ 
    280283        return self._coerce_try(x, [self.real_double_field(), 
     
    339342        """ 
    340343        return self(3.1415926535897932384626433832) 
    341      
     344 
     345    def construction(self): 
     346        """ 
     347        Returns the functorial construction of self, namely, 
     348        algebraic closure of the real double field. 
     349         
     350        EXAMPLES:  
     351            sage: c, S = CDF.construction(); S 
     352            Real Double Field 
     353            sage: CDF == c(S) 
     354            True 
     355        """ 
     356        from sage.categories.pushout import AlgebraicClosureFunctor 
     357        return (AlgebraicClosureFunctor(), self.real_double_field()) 
    342358 
    343359def new_ComplexDoubleElement(): 
  • sage/rings/complex_field.py

    r7428 r7492  
    213213           * this MPFR complex field, or any other of higher precision 
    214214           * anything that canonically coerces to the mpfr real field with this prec 
     215 
     216        EXAMPLES: 
     217        sage: ComplexField(200)(1) + RealField(90)(1) 
     218        2.0000000000000000000000000 
    215219        """ 
    216220        try: 
     
    258262        """ 
    259263        return False 
     264 
     265    def construction(self): 
     266        """ 
     267        Returns the functorial construction of self, namely, 
     268        algebraic closure of the real field with the same precision. 
     269         
     270        EXAMPLES:  
     271            sage: c, S = CC.construction(); S 
     272            Real Field with 53 bits of precision 
     273            sage: CC == c(S) 
     274            True 
     275        """ 
     276        from sage.categories.pushout import AlgebraicClosureFunctor 
     277        return (AlgebraicClosureFunctor(), self._real_field()) 
     278 
    260279 
    261280    def pi(self): 
  • sage/rings/real_double.pyx

    r7319 r7492  
    145145                                  {'type': 'RDF'}), 
    146146               sage.rings.rational_field.QQ) 
     147 
     148    def algebraic_closure(self): 
     149        """ 
     150        Returns the algebraic closure of self, 
     151        ie, the complex double field. 
     152 
     153        EXAMPLES: 
     154        sage: RDF.algebraic_closure() 
     155        Complex Double Field 
     156        """ 
     157        from sage.rings.complex_double import CDF 
     158        return CDF 
    147159 
    148160    cdef coerce_map_from_c(self, S): 
  • sage/rings/real_mpfr.pyx

    r7471 r7492  
    348348        """ 
    349349        return sage.rings.complex_field.ComplexField(self.prec()) 
     350 
     351    def algebraic_closure(self): 
     352        """ 
     353        Returns the algebraic closure of self, ie the 
     354        complex field with the same precision. 
     355        """ 
     356        return self.complex_field() 
    350357 
    351358    def ngens(self): 
Note: See TracChangeset for help on using the changeset viewer.