On Sunday, January 8, 2017 at 11:40:13 AM UTC+1, vdelecroix wrote:
>
> Making is_real works on the image of most functions would be good. It 
> would in particular let Sage recognize that cos(pi/7) is a real number. 


Please add your ideas to
https://trac.sagemath.org/ticket/22155
 

> Would it be easy to make is_real works on builtin functions? 
>

Yes, in C++ the code here is called with any function:
https://github.com/pynac/pynac/blob/master/ginac/function.cpp#L1581

In Python, no. You would have to construct a second expression
where any function of your choice is replaced with a e.g. constant that
has the property you determined yourself on that function, and call
is_real on that second expression.
 

> However, an expression such as exp(I*pi/7) + exp(-I*pi/7) would still be 
> considered as not being real. Even if 
>
> sage: (exp(I*pi/7) + exp(-I*pi/7)).imag() 
> 0 
>

Calling imag can be costly and I want to avoid that with all the is_ 
functions.

-- 
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