Ticket #14300: trac_14300_fix_CyclotomicField_is_isomorphic.2.patch

File trac_14300_fix_CyclotomicField_is_isomorphic.2.patch, 2.3 KB (added by robharron, 7 years ago)
  • sage/rings/number_field/number_field.py

    # HG changeset patch
    # User Robert Harron <rharron@math.wisc.edu>
    # Date 1365368582 18000
    # Node ID af66c1de2bd6d6117a5354e30afd860fc152530b
    # Parent  4381a8e9f0c8d5d481433f3e670c8de9ddeadc4f
    Trac 14300: Fix CyclotomicField's is_isomorphic
    
    diff --git a/sage/rings/number_field/number_field.py b/sage/rings/number_field/number_field.py
    a b  
    83218321        return True
    83228322
    83238323    def is_isomorphic(self, other):
    8324        """
    8325        Return True if the cyclotomic field self is isomorphic as a number
    8326        field to other.
    8327        
    8328        EXAMPLES::
    8329        
    8330            sage: CyclotomicField(11).is_isomorphic(CyclotomicField(22))
    8331            True
    8332            sage: CyclotomicField(11).is_isomorphic(CyclotomicField(23))
    8333            False
    8334            sage: CyclotomicField(3).is_isomorphic(NumberField(x^2 + x +1, 'a'))
    8335            True
    8336        """
    8337        if not isinstance(other, NumberField_generic):
    8338            raise ValueError, "other must be a generic number field."
    8339        return self.Hom(other).order() > 0
    8340 
     8324        """
     8325        Return True if the cyclotomic field self is isomorphic as a number
     8326        field to other.
     8327       
     8328        EXAMPLES::
     8329       
     8330            sage: CyclotomicField(11).is_isomorphic(CyclotomicField(22))
     8331            True
     8332            sage: CyclotomicField(11).is_isomorphic(CyclotomicField(23))
     8333            False
     8334            sage: CyclotomicField(3).is_isomorphic(NumberField(x^2 + x +1, 'a'))
     8335            True
     8336            sage: CyclotomicField(18).is_isomorphic(CyclotomicField(9))
     8337            True
     8338            sage: CyclotomicField(10).is_isomorphic(NumberField(x^4 - x^3 + x^2 - x + 1, 'b'))
     8339            True
     8340       
     8341        Check :trac:`14300`::     
     8342       
     8343            sage: K = CyclotomicField(4)
     8344            sage: N = K.extension(x^2-5, 'z')
     8345            sage: K.is_isomorphic(N)
     8346            False
     8347            sage: K.is_isomorphic(CyclotomicField(8))
     8348            False
     8349        """
     8350        if is_CyclotomicField(other):
     8351            return self.zeta_order() == other.zeta_order()
     8352        return NumberField_generic.is_isomorphic(self, other)
     8353   
    83418354    def complex_embedding(self, prec=53):
    83428355        r"""
    83438356        Return the embedding of this cyclotomic field into the approximate