#12466: test whether a polynomial is cyclotomic
---------------------------------+------------------------------------------
       Reporter:  sstarosta      |         Owner:  sstarosta   
           Type:  task           |        Status:  needs_review
       Priority:  major          |     Milestone:  sage-5.0    
      Component:  number theory  |    Resolution:              
       Keywords:  Cernay2012     |   Work issues:              
Report Upstream:  N/A            |     Reviewers:              
        Authors:                 |     Merged in:              
   Dependencies:                 |      Stopgaps:              
---------------------------------+------------------------------------------

Comment (by davidloeffler):

 This will do some strange things if the base ring is a finite field. For
 instance it will say that the mod p reduction of the nth cyclotomic
 polynomial is cyclotomic for some values of p, and non-cyclotomic for
 others (because it will depend whether the reduction mod p is irreducible
 or not).

 Moreover, if the base ring is a characteristic 0 ring bigger than ZZ, you
 will get some strange behaviour in case 3 because you call "f1.factor()"
 and the factorization over {{{ self.base_ring() }}} won't generally be the
 same as over ZZ; indeed you might even get errors at this point if the
 base ring is one where Sage doesn't know how to factor polynomials.

 I suggest you change the type-check
 {{{
 #!python
 try:
     self.change_ring(ZZ)
 except TypeError:
     return False
 }}}
 to something a bit more cautious like
 {{{
 #!python
 if self.base_ring().characteristic() != 0:
     return False
 if self.base_ring() != ZZ:
     try:
         f = self.change_ring(ZZ)
         return f.is_cyclotomic()
     except TypeError,ValueError:
         return False
 }}}
 (or raise a !ValueError, if you prefer). Then you can continue with your
 algorithm in the confidence that the base ring is ZZ.

-- 
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/12466#comment:5>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica, 
and MATLAB

-- 
You received this message because you are subscribed to the Google Groups 
"sage-trac" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/sage-trac?hl=en.

Reply via email to