#4612: [with patch, needs work] is_perfect_power for rationals
------------------------------+---------------------------------------------
 Reporter:  robertwb          |        Owner:  somebody
     Type:  defect            |       Status:  new     
 Priority:  major             |    Milestone:  sage-3.4
Component:  basic arithmetic  |   Resolution:          
 Keywords:                    |  
------------------------------+---------------------------------------------
Comment (by cremona):

 It won't be trivial to fix since the gmp function only returns whether or
 not the argument is a perfect power, not what the root or exponents are.

 I suggest that we implement something involving the factorizations.
 Assuming that both numerator and denonimator are perfect powers, compute
 (where the input is r = +-n/d)
 {{{
 gcd(gcd([e for p,e in n.factor()]), gcd([e for p,e in d.factor()]))
 }}}
 If that is 1 return 1.  If it is e>1 then return e if r is positive or if
 e is odd and r is negative, otherwise (e even, r<0) return
 e.prime_to_m_part(2), i.e. the odd part of e.  This will return the
 largest e such that r is an e'th power.

 I don't see what else we can do unless gmp has a better function.

-- 
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/4612#comment:4>
Sage <http://sagemath.org/>
Sage - Open Source Mathematical Software: Building the Car Instead of 
Reinventing the Wheel
--~--~---------~--~----~------------~-------~--~----~
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