Closed katestange closed 13 years ago
Attachment: trac_10464_residue_symbol.patch.gz
I like the look of this, but the formatting of the docstrings isn't quite right -- the text "Quadratic Residue (7 is not a square modulo 11)"
shouldn't be inside the code block. You should remove the double colon after EXAMPLES
, unindent the description lines and put a double colon at the end of each one. Other than that very trivial fix this looks absolutely fine.
Work Issues: docstring formatting
I think there are a couple of things which will make the ideal residue_symbol
function a little faster:
check=True
when recursively applying the function to the prime factors of the ideal since all the checks will have already been performed.Thus I think the last few lines of the definition should read something like:
if not self.is_prime():
return prod(Q.residue_symbol(e, m, check=False)**i for Q, i in self.factor())
k = self.residue_field()
r = k(e)**((k.order() - 1)/m)
resroot = primroot**(rootorder/m)
from sage.groups.generic import discrete_log
j = discrete_log(k(resroot), k(r), ord=m)
return resroot**j
One other little thing. I think it is safer to write self.smallest_integer()
rather than ZZ(self.gens()[0])
.
Attachment: trac_10464_residue_symbol.2.patch.gz
Thanks all for the comments and suggestions; they were very helpful. I've uploaded a new version of the patch that has taken into account all of them. (I couldn't figure out how to replace the file with one of the same name as suggested in the development walkthrough guide.)
There is something messed up with this patch: each new method is defined twice over.
Changed work issues from docstring formatting to patch corrupted?
Attachment: trac_10464_residue_symbol.3.patch.gz
Sorry! I must have cloned the wrong branch at some point, but I should have noticed in the diff -- newbie mistake. Anyway, it's now been fixed. (I also see now how to replace the old patch, but at this point I think that would be more confusing, so this is labelled '3'.)
It's all fine now. I'd give it a positive review but for one thing. The docstring for sage.rings.number_field.number_field_element.NumberFieldElement.residue_symbol
says
- ``P`` - proper ideal of the number field (or an extension)
I think that there needs to be a doctest illustrating the case where P is an ideal in an extension.
Attachment: trac_10464_residue_symbol.4.patch.gz
Thanks for pointing that out. I've fleshed out the documentation somewhat, and in the process found a small bug which has been fixed (the faster routine kronecker_symbol was called on some inappropriate cases).
All looks good now. Positive review.
Changed work issues from patch corrupted? to none
Reviewer: Francis Clarke
Please put into the ticket's description which patches to apply [in which order, i.e., in the order they should be applied, and perhaps to which repository].
(The trac wiki syntax for referring to attached files is [attachment: here_comes_the_filename](https://github.com/sagemath/sage/files/ticket10464/here_comes_the_filename.gz)
, hence in this case [attachment: trac_10464_residue_symbol.4.patch](https://github.com/sagemath/sage-prod/files/10651605/trac_10464_residue_symbol.4.patch.gz)
.)
Also, using the comment field of attachments isn't bad.
Changed reviewer from Francis Clarke to Francis Clarke, David Loeffler
Description changed:
---
+++
@@ -1 +1,6 @@
implement m-th power residue symbol (generalising Legendre/Kronecker symbol)
+
+---
+
+Apply only [attachment: trac_10464_residue_symbol.4.patch](https://github.com/sagemath/sage-prod/files/10651605/trac_10464_residue_symbol.4.patch.gz) to the Sage library.
+
Merged: sage-4.7.2.alpha3
implement m-th power residue symbol (generalising Legendre/Kronecker symbol)
Apply only attachment: trac_10464_residue_symbol.4.patch to the Sage library.
CC: @katestange
Component: number fields
Keywords: cubic residue
Author: Katherine Stange
Reviewer: Francis Clarke, David Loeffler
Merged: sage-4.7.2.alpha3
Issue created by migration from https://trac.sagemath.org/ticket/10464