-
-
Notifications
You must be signed in to change notification settings - Fork 480
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
add .twists() to EllipticCurve_finite_field #34981
add .twists() to EllipticCurve_finite_field #34981
Conversation
Codecov ReportBase: 88.60% // Head: 88.58% // Decreases project coverage by
Additional details and impacted files@@ Coverage Diff @@
## develop #34981 +/- ##
===========================================
- Coverage 88.60% 88.58% -0.02%
===========================================
Files 2136 2140 +4
Lines 396142 397058 +916
===========================================
+ Hits 350990 351744 +754
- Misses 45152 45314 +162
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report at Codecov. |
aba66e4
to
287a90c
Compare
The test failure is yet another instance of #35017. |
Thanks, I wonder why I did not implement this years ago. Review comments:
|
|
For my 2nd comment, if you look in ell_field.py you will see that E.quadratic_twist() gives the unique twist in char. 2 provided j is nonzero:
For the case char=2 or 3 and j=0, my old code (which was moved to a separate file cardinality.py when it was no longer used by default) has useful examples in lines 54-96: there are 4 cases (despite 0=1728!) since the number of twists depends on the parity of the field degree. Here's an idea @yyyyx4: I can add these extra cases and make a PR to your branch; if you like my changes you can merge that and this PR will then automatically update. |
@JohnCremona Sounds great! |
287a90c
to
93e94da
Compare
OK, so I did
and am working on it. When I am done I will push to my github fork and make a PR from that to your @yyyyx4 . (Adding detail here is this sort of workflow is not familiar to all.) |
@yyyyx4 I have been working on this, not quite finished. The only source I know for the hard cases (char. p=2,3 and j=0) is unpublished online notes of Ian Connell (with only a sketch of the details), I did once work through it myself but have just redone that. I'll add a citation to Connell. Also, the PR I will make to your branch will change a few things in the cases you already implemented and I want to run that past you. I want to have separate functions listing the isomorphism classes of curves with j=0 and j=1728 (these are quite long in the hard cases just mentioned) which I think will be cleaner; then the twists method can just call that but replace one of the curves in the standard list with self and move it to the front of the list. I am still a bit bothered about the non-determinacy: in the cases where there are 4 quartic or 6 sextic twists, since the group K*/K*^4 or K*/K*^6 has two generators the output curves can some in one of two different orders, even up to isomorphism. As a partial solution which is cost-free, and actually saves work in many cases, I will do the following:
I hope to finish this today. |
@yyyyx4 My update of your branch is at https://github.com/JohnCremona/sage/tree/ecff-twists. At the end I did a rebase on 9.8, with the unfortunate side-effect that making a PR to your branch is harder, but I could make a new PR to the main develop branch. The new twists method plus helper function all with doctests are now nearly 500 lines, sorry about that, but it does handle all cases cleanly (and a lot of the lines are docstrings). |
SageMath version 9.8, Release Date: 2023-02-11
Thanks, it looks very nice! I've merged your branch into this one. The doctests were failing sometimes due to the remaining non-determinism. They are fixed for now, but perhaps we want to simply implement both the deterministic and potentially non-deterministic algorithms and allow users to choose between them with an optional |
Thanks. I thought I had added the #random tag on the tests where the results were not deterministic, but I must have missed some. Note that sorting the curves will not always be sufficient. I'm not sure that users will care enough about the results being deterministic to make it worth implementing that. Could you add my name to the authors after yours ;) ? |
Of course, already done, in the associated issue #34782. The git history also remembers your original commit including metadata. But I'm not sure if this is how shared authorship is supposed to be handled now... |
I meant, at the top of the ell_finite_field.py file. Nice to get a notification that the documentation is now built and viewable! The relevant page is https://deploy-preview-34981--sagemath-tobias.netlify.app/reference/arithmetic_curves/sage/schemes/elliptic_curves/ell_finite_field.html. This reveals some bad docstrings (all my fault), one being \F (should it be \FF?), also two curve equations in Would you fix those or shall I? |
Oh, now I see, sorry. Done, and also (hopefully) fixed the docstrings. |
Thanks. I'll wait to see that the docstrings look good now, then this is ready to go -- but we probably need a 3rd party to review it, or does the old convention that it is OK for both of us to review joint work still apply? |
Documentation preview for this PR is ready! 🎉 |
If jointly reviewing joint work was okay on Trac, it should probably also be okay here? Either way, I'm happy with the changes. |
OK then... |
Fixes #34782.