New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix Parent.__contains__ #17984
Comments
Branch: u/rws/17984 |
Commit: |
New commits:
|
Author: Ralf Stephan |
Replying to @rwst:
Can you clarify this please? |
comment:4
|
comment:5
Why this???
|
comment:6
I also think this is wrong:
|
comment:7
Also please explain why you use |
This comment has been minimized.
This comment has been minimized.
comment:9
Replying to @jdemeyer:
Clever. But before I fix this: What about the doctests? Do you think that any of them gives a wrong result? Do you agree that precision issue should be ignored when it comes to the behaviour of the |
comment:10
Replying to @jdemeyer:
If so, then I think this is wrong, too:
|
Branch pushed to git repo; I updated commit sha1. New commits:
|
Branch pushed to git repo; I updated commit sha1. New commits:
|
comment:14
Replying to @rwst:
Yes, I think precision should be ignored for |
comment:15
Replying to @rwst:
I don't think the above is wrong, it is possible to represent |
This comment has been minimized.
This comment has been minimized.
comment:16
Replying to @rwst:
Ah, seems I was chasing ghosts there. Nevertheless the ticket makes sense because of the unreliability of the construction |
comment:24
Replying to @pjbruin:
Can you please help me with this definition? In my understanding an exact representation has infinite precision (or another bit of information that makes it different from an inexact element). But everything in So, either no integers and rationals are |
comment:25
Replying to @rwst:
Elements of Different people have different viewpoints about this, but above I was thinking of elements of A related |
comment:26
Replying to @pjbruin:
So this would be similar (equal?) to what was recently said about
So, pragmatically, every inexact ring needs a method |
comment:27
Note that at the moment |
comment:28
Replying to @rwst:
Ah okay, |
comment:29
Replying to @rwst:
This method makes sense in I do not like the fact that we treat
Vincent |
comment:30
Replying to @videlec:
What would be consequences of removing it from the set (apart from documentation issues)? |
This comment has been minimized.
This comment has been minimized.
comment:31
Ping? |
comment:32
This issue has come up again with working on #19040. This is intolerable. I will have to have a new attempt at this, maybe I understand the arguments better now. |
Changed branch from u/rws/17984 to u/rws/17984-1 |
Dependencies: #19040 |
Changed commit from |
Changed branch from u/rws/17984-1 to none |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
comment:38
Unexpectedly it looks like we get a much more correct fix whenever we'll have #24456. |
In the catch-all
structure/parent.pyx:Parent.__contains__
we depend on the constructionbool(item==self(item))
to get the right result for, e.g.sqrt(3) in RR/CC
butbool(RR/CC(sqrt(3))==sqrt(3))
beingFalse
a trick was applied by the author that makes the function always returnTrue
. This trick uses the fact that Maxima doesn't know about the rings and will raise an exception, which is then caught.This way of programming strikes me as very wrong and previously I supported the notion that dedicated
__contains__
methods for both RR/CC were needed. As you can see from the discussion this was not wanted.Of course, as soon as we want to get rid of Maxima this odd behaviour must be simulated, because there is no way to test containment in these inexact rings in a generic way.
In order to make it more reliable the way we treat inclusion in inexact rings needs to be reconsidered.
Previously this ticket proposed that:
...dedicated
__contains__
methods for both rings are needed.Depends on #19040
CC: @sagetrac-tmonteil
Component: basic arithmetic
Author: Ralf Stephan
Issue created by migration from https://trac.sagemath.org/ticket/17984
The text was updated successfully, but these errors were encountered: