#16436: is_real method should exist for elements of AA, ZZ, QQ,..., and be fixed
where it is already defined
-------------------------------+------------------------
Reporter: slabbe | Owner:
Type: enhancement | Status: new
Priority: major | Milestone: sage-6.4
Component: algebra | Resolution:
Keywords: | Merged in:
Authors: | Reviewers:
Report Upstream: N/A | Work issues:
Branch: | Commit:
Dependencies: | Stopgaps:
-------------------------------+------------------------
Comment (by kedlaya):
One clean way to implement {{{is_real}}} might be to compare x with its
conjugate, which is implemented quite often:
{{{
sage: def is_real(x):
....: return(x == x.conjugate())
....:
sage: is_real(ZZ(3))
True
sage: is_real(QQ(3))
True
sage: is_real(AA(3))
True
sage: is_real(RR(3))
True
sage: is_real(CC(3))
True
}}}
One could handle {{{is_imaginary}}} similarly.
--
Ticket URL: <http://trac.sagemath.org/ticket/16436#comment:9>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica,
and MATLAB
--
You received this message because you are subscribed to the Google Groups
"sage-trac" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/sage-trac.
For more options, visit https://groups.google.com/d/optout.