#17984: Dedicated RR.__contains__() and CC.__contains__()
-------------------------+-------------------------------------------------
Reporter: rws | Owner:
Type: | Status: needs_review
enhancement | Milestone: sage-6.6
Priority: major | Resolution:
Component: basic | Merged in:
arithmetic | Reviewers:
Keywords: | Work issues:
Authors: Ralf | Commit:
Stephan | 544450ea18ed2778953141bab8feced61237556e
Report Upstream: N/A | Stopgaps:
Branch: |
u/rws/17984 |
Dependencies: |
-------------------------+-------------------------------------------------
Comment (by pbruin):
Replying to [comment:21 rws]:
> Replying to [comment:20 pbruin]:
> > I guess the first basic question is how to resolve the following
inconsistency:
> > {{{
> > sage: bool(RR(pi) == pi)
> > True
> > sage: bool(RR(sqrt(2)) == sqrt(2))
> > False
> > }}}
> >...Hence I am tending towards the opinion that if `x` is some exact
element, then `bool(RR(x) == x)` should return `True` if and only if `x`
is exactly representable in `RR`.
> And inexact elements compare the precision? And this condition would be
the same for other inexact fields?
I didn't say anytyhing about the case where `x` is an element of an
inexact ring. Currently (I think), if `x.parent() == RealField(m)`, then
`x in RealField(n)` will return `True` regardless of `m` and `n`. This
could be changed of course, but that would break the general "philosophy"
that Sage has been following so far (elements are compared in the ring
with the lowest precision).
> This looks nice, but at the moment that we check the relation (in
`Expression.__nonzero__`) the conversion to `RR` has already happened.
That means we cannot use the relation to determine elementship.
I don't understand this; the fact that `x` can be converted into `RR` does
not imply that it is an element of `RR`. The element `RR(x)` is just some
candidate for "the element of `RR` that is equal to `x`", but we don't yet
know if `x` and `RR(x)` are indeed equal in a meaningful way. I guess you
are talking about the case where `x.parent() is SR`. Doesn't `bool(RR(x)
== x)` then compare two elements of `SR`, one being the original `x` and
the other being the result of converting to `RR` and back? These can
still be compared in a non-trivial way.
--
Ticket URL: <http://trac.sagemath.org/ticket/17984#comment:22>
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.