-
Notifications
You must be signed in to change notification settings - Fork 58
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
is_squarefree for integer polynomials #1510
Comments
Thanks for the report. I think the |
Thanks for the fix. It segfaults for the zero polynomial, but I would say that's a bug in FLINT. (Reported at flintlib/flint#1414.) |
Hm, I am inclined to add the assumption, that the input must be non-zero. (Magma is also doing this.) What do you think? |
For For |
I agree with you, that It is actually hard to find a definition for squarefree elements in arbitrary rings. Interpolating the definition for integers and polynomials over fields, I would come up with: An element is not squarefree, if it is divisible by the square of a non-unit. This generalizes https://de.wikipedia.org/wiki/Quadratfreie_Zahl#Allgemeine_Definition, although Wikipedia imposes the condition that the element is non-zero (but they do not provide a source). |
Not really relevant here, but just for the record: I agree with your definition of squarefree elements in the case of unique factorization domains. But for Dedekind domains, I think the usual definition would be that an element (or more generally an ideal) is squarefree if it is not divisible by the square of any prime ideal. |
The polynomial$7x^2+2$ is irreducible in $\mathbb Z[x]$ , but Nemo (version 0.35.1) claims that it is not squarefree:
I'm new to Nemo and might be misunderstanding the specification of
is_squarefree
, so apologies if this is out of scope. But at least this test suggests to me that it's intended to work for integer polynomials:https://github.com/lgoettgens/Hecke.jl/blob/c7ab8cd067cbddc815002a1dcde0da3e1a21a64c/test/Misc/Poly.jl#L111-L117
The reason for this behavior is that f is divided by its leading coefficient with divexact. That seems to round$(7x^2+2)/7$ to $x^2$ , which is not squarefree.
Nemo.jl/src/HeckeMiscPoly.jl
Line 526 in 45d8783
The check flag of
divexact
is ignored when dividing by scalars:Nemo.jl/src/flint/fmpz_poly.jl
Lines 409 to 423 in 45d8783
(Flint assumes that the division is exact, but doesn't check it.)
The text was updated successfully, but these errors were encountered: