On Thursday, June 19, 2014 2:38:11 AM UTC-4, vdelecroix wrote:
>
> Note that there is already a method "nth_root" on several elements 
> (ZZ, finite fields, etc). So I would rather go for "real_nth_root" 
> which makes things clearer. 
>
Perhaps we can then just get away with a "nth_root" symbolic function that  
uses nth_root on its argument, making use of the fact that if the numerical 
evaluation of the argument produces a real number, then the real number 
itself will know what its nth root is? Something along the lines of:

from sage.symbolic.function import SymbolicFunction
class nth_root(SymbolicFunction):
    def __init__(self):
        SymbolicFunction.__init__(self, 'nth_root', nargs=2)
    def _evalf_(self, n, x, parent=None):
        return parent(x).nth_root(n)

(this needs refinement, but numerical evaluation does seem to be able to 
produce sometimes real elements and sometimes complex numbers, so perhaps 
we can utilize that)

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-devel@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.

Reply via email to