-
-
Notifications
You must be signed in to change notification settings - Fork 512
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
test containment of ideals in class MPolynomialIdeal #12802
Comments
Changed keywords from none to sd40.5, groebner bases, ideals |
This comment has been minimized.
This comment has been minimized.
Author: John Perry |
comment:1
Attachment: trac_12802_and_12803.patch.gz The attached file gives a better check for correctness than even the proposed solution, using Groebner bases rather than generators alone. The examples given by mariah produce a correct result on my machine, though for a doctest I use a slightly different solution which her proposed fix wouldn't detect. This patch also resolve #12839, as far as I can tell. |
Work Issues: documentation |
comment:2
Functions are missing standard documentation blocks. |
comment:3
Replying to @novoselt:
It's even worse than that. For some reason, I'm now finding regressions that I didn't find earlier. I'm working on an updated patch. |
comment:4
Okay, so the problems were real, but were discovered because there's a very weird test of elements of quadratic number fields: basically, if a and b are distinct elements of a quadratic number field, then a>b and b>a are always true:
That strikes me as really, really odd behavior. Anyway, I'm about to upload a new patch that undoes the stupidity I did to |
Reviewer: novoselt |
comment:6
To help the reviewer(s), here are the non-whitespace changes.
On my machine all the doctests of |
comment:7
Would be better to have whitespaces separately... Anyway: "Decides whether two ideals are equal. The test is performed on the generators." does not sound right, this method does not decide whether ideals are equal. How about "Compare generators of two ideals." instead? |
Changed reviewer from novoselt to Andrey Novoseltsev |
comment:8
Replying to @novoselt:
I can do that, if you think it best. I'd rather not, now that I've removed them, but I can.
Done. |
comment:9
Apply trac_12802_and_12839.patch |
comment:10
I don't insist on separating whitespace patch now, it is just inconvenient to dig for changes in 100kb. But please make subsequent changes in a new little patch.
|
comment:11
Replying to @novoselt:
Okay, new patch coming. It'll be a bit.
Got it.
This was originally code for
When I first worked on this, the
It took me a while to find what you meant, but I finally saw it. |
comment:12
The last line in this
strikes me as wrong. If the base ring or the number of generators are different, they can't be the same ideal. I'm changing that to return The type is another story. If someone has defined a ring with singular, and wants to compare to a ring defined with cocoa or macaulay, that ought to be possible. Unfortunately, I can't test it: neither Macaulay nor CoCoA build on my Sage 5.0. Are you able to build either? |
comment:13
I think comparison of rings should be done by converting all to a single system where they will be unique. And in general what's the point in ring uniqueness if they may not be unique? If you are not satisfied with Note also that there are many failing doctests, the worst ones are with infinite recursion. If it will be necessary to change output in doctests of toric varieties, please do it on top of #13023 which is already positively reviewed. |
comment:51
Okay, a diff performed on the results of different patches showed the problems. Most tests passed before I interrupted the previous run; I've checked that the previous failures now pass. I'm running tests now on the files that were not checked before. |
comment:52
All tests pass on my machine. |
comment:53
In order to tell the patch bot what to do: Apply trac_12802_no_whitespace.patch |
comment:54
I just noticed from the patchbot that I had uploaded an older version of the patch, on account of forgetting to sync. If you're testing this, please download the revision. Sorry about that. |
Changed work issues from Patch commit messages to Patch commit message |
comment:55
The new patch still needs a good commit message. This patch isn't about "no white space", it's about ideals... |
Attachment: trac_12802_no_whitespace.patch.gz should incorporate other patches, without the removal of whitespace |
comment:56
Informative commit message added. |
Changed work issues from Patch commit message to none |
comment:58
How much precedent do we have to let < and > mean a containment partial ordering? Doesn't the presence of '<' make that "sort" doesn't throw an error and instead produces arbitrary results? |
comment:59
Replying to @nbruin:
**This problem predated the patch! ** As the original report points out, As long as there is a (Or am I wrong?) |
comment:60
Not all python types admit comparison
but you're right that by default it seems they do:
That changes with Python 3, though. |
comment:61
Apparently, complex is a built-in class; I can't find the source that makes it avoid comparison. However, it makes sense to raise an error in the case where the ideals are incomparable. I wouldn't raise a TypeError, though, but a ValueError. Does that sound acceptable? If so, I'll change the status to Needs Work (AGAIN) and upload a new patch... |
comment:62
What exactly does it mean "incomparable ideals"? If I also think that it is useful to be able to sort any mix of anything, so |
comment:63
Replying to @novoselt:
That just leads to silently incorrect code. If you want to sort on
I'm curious to see a useful application of this. This is all a bit off-topic, though. There IS precedent in python to use
so supporting this for ideals should be fine. I'd throw an error if the ideals are "incompatible" for comparison (according to coercion rules for common covering structure, I'd say), but |
Merged: sage-5.4.rc0 |
There seems to be no way to test containment of ideals in the class MPolynomialIdeal in
sage.rings.polynomial.multi_polynomial_ideal
. One might expect the comparison operators (e.g.I<J
) to do this, but in fact what they do is to compare the Groebner bases as sequences of polynomials, which is counterintuitive. For example:This is implemented in the
__cmp__
method, which is not up to the task of doing subset comparison, since__cmp__
is only suitable for total orderings.To do it right would seem to require implementing Python's "rich comparison" methods,
__lt__
,__gt__
, etc.For example:
With these we now get the expected behavior:
The patch supplied gives a solution via Groebner bases, and also fixes #12839.
Apply:
CC: @malb @nthiery
Component: commutative algebra
Keywords: sd40.5, groebner bases, ideals
Author: John Perry
Reviewer: Andrey Novoseltsev, Simon King
Merged: sage-5.4.rc0
Issue created by migration from https://trac.sagemath.org/ticket/12802
The text was updated successfully, but these errors were encountered: