#16436: is_real method should exist for elements of AA, ZZ, QQ
-------------------------------+------------------------
Reporter: slabbe | Owner:
Type: enhancement | Status: new
Priority: major | Milestone: sage-6.3
Component: algebra | Resolution:
Keywords: | Merged in:
Authors: | Reviewers:
Report Upstream: N/A | Work issues:
Branch: | Commit:
Dependencies: | Stopgaps:
-------------------------------+------------------------
Comment (by slabbe):
Replying to [comment:1 tmonteil]:
> Hi Sebastien. Note that you can also use coercion with the poorest real
representation:
I have been using monkey tricks like that for too long now like
{{{.n().imag() == 0}}}. I want a clean solution. It should be normal to
ask if some eigenvalue of some matrix is a real number.
{{{
sage: M = identity_matrix(RR,4)
sage: [a.is_real() for a in M.eigenvalues()]
[True, True, True, True]
}}}
{{{
sage: M = identity_matrix(ZZ,4)
sage: [a.is_real() for a in M.eigenvalues()]
Traceback (most recent call last):
...
AttributeError: 'sage.rings.rational.Rational' object has no attribute
'is_real'
}}}
{{{
sage: M = random_matrix(ZZ,4)
sage: [a.is_real() for a in M.eigenvalues()]
Traceback (most recent call last):
...
AttributeError: 'AlgebraicNumber' object has no attribute 'is_real'
}}}
--
Ticket URL: <http://trac.sagemath.org/ticket/16436#comment:3>
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 http://groups.google.com/group/sage-trac.
For more options, visit https://groups.google.com/d/optout.