Le mardi 20 septembre 2016 04:02:16 UTC+2, Bill Page a écrit :
>
> In keeping with Richard's suggestion, in Sage I think a good 
> _algebraic_ definition of 'real' is 
>
>     bool(x/2+conjugate(x)/2 == x) 
>

why not bool(SR(x).imag_part()==0) ? 

>
> So 
>
> sage: def RN(x): 
> ....:     try: 
> ....:         return bool(x/2+conjugate(x)/2 == x) 
> ....:     except: 
> ....:         return false 
>
> which also works whenever conjugate is defined, including 
>
> sage: assume(x,'real') 
> sage: assume(y,'real') 
> sage: RN(sqrt(x^2+y^2)) 
> True 
>
>
>
> On 19 September 2016 at 19:51, rjf <fat...@gmail.com <javascript:>> 
> wrote: 
> > If arg(x) is 0 and x is a number, then it is a real number.  Maxima 
> calls 
> > this carg()  for complex arg. 
> > 
> > Carg will also work for some things that are not of numeric type, but 
> > symbolic in some way. 
> > . 
> >  Like sqrt(x^2+y^2)   is real  if domain=real 
> > 
> > Good luck 
> > 
>

-- 
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 https://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.

Reply via email to