-
-
Notifications
You must be signed in to change notification settings - Fork 419
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
Bug in discriminant of polynomials over Z/nZ with n composite #11782
Comments
comment:1
The first problem is caused by the fact that FLINT doesn't compute resultants correctly. This is also mentioned in FLINT's documentation: see p. 58 of http://www.flintlib.org/flint-1.6.pdf: n must be prime to compute resultants correctly. The second problem is of course caused by the fact that the leading coefficient is a zero divisor. |
Attachment: 11782_use_sylvester.patch.gz |
comment:3
The docstring of discriminant() says
So is it correct that if a_n is not invertible this should read
If I understand your patch correctly, you're assuming 2+k-n=1 in the lines
since you're only dividing by a_n. But k could be different from n-1. I don't know much about discriminants/resultants, especially if the polynomials are defined over rings with zerodivisors. So maybe I'm just misunderstanding the definition/implementation here. |
comment:4
That code is reached whenever
raises a ZeroDivisionError, which means n-k-2 < 0 thus n-k <= 1 (and thus n-1 <= k). |
Author: Johan Bosman |
comment:5
"This" => "These" in the last sentence (is it possible to edit your own comments?) |
comment:6
I see. I had assumed that the catch block was a full alternative implementation of the try block. You're of course right, it doesn't have to be. |
comment:7
I'm a bit unhappy with catching a ZeroDivisionError. The error could be raised in the Also I added some comments and an explicit test to the flint polynomials. If you don't mind these changes, feel free to set it to positive review. |
This comment has been minimized.
This comment has been minimized.
Reviewer: Julian Rueth |
comment:8
If a_n is not a unit, but also not a zero divisor, it still makes sense to invert it, so your "if" condition is too strict. What do you think about the following solution?
|
Attachment: 11782_review.patch.gz review patch |
comment:9
You're right. I tried to follow your suggestion in the new review patch. |
comment:10
Okäse! |
Merged: sage-4.8.alpha4 |
The following behaviour is inconsistent:
And the following raises an error:
Apply
to the Sage library.
Component: algebra
Keywords: polynomial, discriminant, integer mod ring
Author: Johan Bosman
Reviewer: Julian Rueth
Merged: sage-4.8.alpha4
Issue created by migration from https://trac.sagemath.org/ticket/11782
The text was updated successfully, but these errors were encountered: