#5685: enhanced nth_root in ZZ and QQ and related utilities
------------------------------+---------------------------------------------
 Reporter:  cremona           |       Owner:  somebody                 
     Type:  enhancement       |      Status:  new                      
 Priority:  major             |   Milestone:  sage-3.4.1               
Component:  basic arithmetic  |    Keywords:  nth root rational integer
------------------------------+---------------------------------------------
 As discussed here: http://groups.google.co.uk/group/sage-
 nt/browse_thread/thread/4c6e60b6a20cabae#

 I do not like this inconsistency between ZZ and QQ:

 {{{
 sage: a=ZZ(8)
 sage: a.nth_root(3)
 2
 sage: b=QQ(8)
 sage: b.nth_root(3)
 2
 sage: a.nth_root(2)
 2
 sage: b.nth_root(2)
 ---------------------------------------------------------------------------
 ValueError                                Traceback (most recent call
 last)

 /home/masgaj/.sage/temp/host_56_150/13463/_home_masgaj_sage_egros_sage_5.py
 in <module>()

 /local/jec/sage-3.4/local/lib/python2.5/site-
 packages/sage/rings/rational.so
 in sage.rings.rational.Rational.nth_root
 (sage/rings/rational.c:8888)()

 ValueError: not a perfect nth power
 }}}

 I cannot think of a reason why we have an nth_root function on
 integers which silently truncates a real root for positive argument
 and gives a ValueError for negative ones.

 The attached ticket deals with this, and at the same time adds a couple of
 extra utilities which I needed for rational numbers.

-- 
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/5685>
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