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
Make Jacobi symbol #11138
Comments
a jacobi symbol function for sage/rings/arith.py |
comment:1
Attachment: trac11138.patch.gz There is a test class that is not passing (10|777)==-1 (if I'm reading the errors right). I'm not sure what is wrong because when I make the same program in a notebook it seems to work. This is my first patch. |
comment:2
Replying to @tdupu:
Could you paste the exact output? Another thing: it would be good if your input matched your documentation. Your function takes a and b and the documentation talks about x and n. |
Reviewer: François Bissey, Karl-Dieter Crisman |
comment:3
Thanks for your efforts, Taylor! There are some things that should be done for this patch to pass muster.
versus
for the formatting in documentation. You may also need to do Again, thanks for helping make Sage even better! |
Author: Taylor Dupuy |
comment:4
Attachment: trac11138.2.patch.gz Here is the copy and paste requested
when I run jacobi_symbol(10,777) it returns zero:
Let me know if my formatting isn't correct. I didn't change to the Kronecker Symbol. |
comment:5
should be
I think. You'll also want to make sure the description looks more like
than
which is hard to view in the command line. There is some weird grammar in the latest version.
The symbols have two inputs, right? Not sure what "of an odd number" means without more clarification. And Jacobi should be capitalized, most likely. You also still don't have the convention of a or b or n worked out properly. In fact, you might as well raise a ValueError After trying two that were identical, except for replacing the factoring and return value with
I get the following timings:
Granted, this is a product of two relatively large primes, but
really shows the difference. Make sure to use the kronecker symbol :) Indeed, if you look in number theory texts (well, the ones that have the Jacobi symbol as opposed to just Legendre symbol), none of them compute the Jacobi symbol 'by hand' - they all use that definition to prove you can do a Euclidean algorithm-style quadratic or sub-quadratic complexity. By the way, this is normal review process for Sage; this is great for your first contribution, please don't be discouraged! Mine needed much more work (well, my second one did - the first one was a one-word change to remove an unused keyword). |
Attachment: trac11138.3.patch.gz |
comment:6
Ok. So this time it passed all the tests. The only issue could be the documentation. Dang it... I just checked. I copied and pasted the note from the Legendre Symbol and I need to fix this... don't review this until I fix that. |
Attachment: trac11138.4.patch.gz |
comment:7
Ok, I think I took care of all the issues. The function works quickly, the documentation appears to be correct and it passed all of the doc tests. |
comment:8
Great work, and doc looks great as well. The only things that remain to be fixed is that you didn't include a commit message (see here, item 6, and a couple very minor typos. Since this is your first patch, I've fixed those for you as a reviewer prerogative (this is fairly typical). Thank you for doing this! Incidentally, I'm not getting the failure that the buildbot reports, which seems TOTALLY unrelated. |
This comment has been minimized.
This comment has been minimized.
comment:9
Attachment: trac11138.4-with-commit-message.patch.gz Apply only attachment: trac11138.4-with-commit-message.patch. |
Attachment: 11138_rebased.patch.gz Patch rebased to sage-4.7.1.alpha3 |
This comment has been minimized.
This comment has been minimized.
Merged: sage-4.7.1.alpha4 |
We have Kronecker symbol and Legendre symbol, but not Jacobi symbol. It is a method for integers, I think, but not a global one. It would be nice to have, at the very least for pedagogical purposes so that one doesn't have to explain why it's called Kronecker but we haven't introduced that... anyway, this would require a little checking for appropriate input, but otherwise should be easy to make
jacobi_symbol
.Apply only attachment: 11138_rebased.patch
Component: number theory
Author: Taylor Dupuy
Reviewer: François Bissey, Karl-Dieter Crisman
Merged: sage-4.7.1.alpha4
Issue created by migration from https://trac.sagemath.org/ticket/11138
The text was updated successfully, but these errors were encountered: