Skip to content
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

Confusing factor results #1072

Closed
ThomasBreuer opened this issue May 17, 2023 · 1 comment · Fixed by #1090
Closed

Confusing factor results #1072

ThomasBreuer opened this issue May 17, 2023 · 1 comment · Fixed by #1090

Comments

@ThomasBreuer
Copy link
Contributor

Consider the following session.

julia> using Hecke

Welcome to 

    _    _           _
   | |  | |         | |
   | |__| | ___  ___| | _____
   |  __  |/ _ \/ __| |/ / _ \
   | |  | |  __/ (__|   <  __/
   |_|  |_|\___|\___|_|\_\___|
    
Version 0.18.13 ... 
 ... which comes with absolutely no warranty whatsoever
(c) 2015-2023 by Claus Fieker, Tommy Hofmann and Carlo Sircana


julia> R, x = polynomial_ring(QQ, "x");

julia> F, z = number_field(x^2+1);

julia> f = polynomial(F, [1, 2, 3])
3*x^2 + 2*x + 1

julia> facts = factor(f)
3 * (3*x^2 + 2*x + 1)

julia> factor_squarefree(f)
1 * (x^2 + 2//3*x + 1//3)

The result of factor looks wrong, I had expected that the product of facts.unit and the a^e for (a, e) in facts yields f.

(The result of factor_squarefree could be correct if the documentation of the function would state that f is silently divided by its leading coefficient; anyhow, changing factor_squarefree such that the leading coefficient appears in the result does not fix the factor problem.)

Looking into the code, one finds that there are alternatives for computing the factors.

julia> Hecke.factor_trager(f)
1-element Vector{AbstractAlgebra.Generic.Poly{nf_elem}}:
 x^2 + 2//3*x + 1//3

julia> Hecke.factor_new(f)
1-element Vector{AbstractAlgebra.Generic.Poly{nf_elem}}:
 3*x^2 + 2*x + 1

Perhaps the functions expect that the argument is monic ...

julia> g = divexact(f, leading_coefficient(f))
x^2 + 2//3*x + 1//3

julia> Hecke.factor_trager(g)
1-element Vector{AbstractAlgebra.Generic.Poly{nf_elem}}:
 x^2 + 2//3*x + 1//3

julia> Hecke.factor_new(g)
1-element Vector{AbstractAlgebra.Generic.Poly{nf_elem}}:
 3*x^2 + 2*x + 1

... no, apparently not.
I am lost: Which of these results are intentional, where is the bug?

@ThomasBreuer
Copy link
Contributor Author

Thanks @thofma

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant