-
-
Notifications
You must be signed in to change notification settings - Fork 434
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
CyclotomicField's is_isomorphic is mathematically incorrect #14300
Comments
Author: Robert Harron |
comment:2
please use the python3 syntax for raise
|
comment:3
That's what I get for copying and pasting the code from NumberField_generic. It would probably be better if I just call that code. Is the proper syntax for calling a super class's method NumberField_generic.is_isomorphic(self, other)? Replying to @fchapoton:
|
comment:4
Attachment: trac_14300_fix_CyclotomicField_is_isomorphic.2.patch.gz I think that is the correct syntax, so I uploaded a new version of the patch. |
comment:5
(Actually, I don't think it was that I copy-pasted, rather I simply didn't change that line of code, though that's not clear from the way trac shows the diff.) Replying to @fchapoton:
|
comment:6
Apply trac_14300_fix_CyclotomicField_is_isomorphic.2.patch |
comment:7
I was responsible, in #3533, for the faulty code for However the reason for having a separate method for cyclotomic fields was that it can be much faster than the generic code. Thus with
I find that in Sage-5.8
takes 0.684 seconds, while
(which is the essential part of the generic Thus I think that the only change to the existing code that is needed is to add the two extra lines:
Plus, of course, the new doctests. |
comment:8
(And, also of course, the lines:
which are really fast.) I had done some testing before posting this code and for all the examples in the documentation the code I posted was quicker than the code you're suggesting. It's looks like the timing situation is pretty complex though. For instance:
Here: .is_isomorphic is my code and .is_isomorphic2 is the code you propose. Aside from timing:
So, the code I posted turns out to be more robust (though this just illustrates an issue with pari_nf). Since this ticket is for a mathematically incorrect output of sage it would be great to get it fixed ASAP (my functioning patch has already been sitting around for three weeks). In view of the examples above, I would propose worrying about optimizing this function in a separate ticket and (if there isn't some big problem with what I've written) accepting the current patch. How does that sound? |
Reviewer: Francis Clarke |
comment:9
Replying to @rharron:
After spending some time looking at why the existing code is sometimes slow, I agree with this suggestion, so a positive review. Using the fact that PARI's
When this is done, it might be sensible to eliminate the cyclotomic version as the new code will check first whether the defining polynomials are equal (at the moment |
Merged: sage-5.10.beta1 |
If K is a CyclotomicField, then K.is_isomorphic(L) returns true as long as L is a number field and K has an embedding in to L!
Is there a reason that CyclotomicField overrides the generic version of this? I guess one could first do the quick check: if L is a CyclotomicField, then checking they are isomorphic just means checking they are both the nth cyclotomic field (I assume the n is stored somewhere easily accessible).
Component: number fields
Keywords: CyclotomicField
Author: Robert Harron
Reviewer: Francis Clarke
Merged: sage-5.10.beta1
Issue created by migration from https://trac.sagemath.org/ticket/14300
The text was updated successfully, but these errors were encountered: