Jacob Hirbawi asked:
I am having this problem with factoring polynomials : the product of the
factors doesn't match the original polynomial.
This is indeed an error. Mea culpa (I should have learned in the meantime to
check also seemingly trivial cases).
I am using GAP 3.4 and I
am fairly sure this example used to work in the previous release.
In the progress of 3.3 to 3.4 the factorization routines were
rewritten (actually, we did not even tell the user about them be-
fore) to enhance performance. (So you got the wrong result much
Unfortunately, the part of the routine, which deals with non-
squarefree polynomials got an error and stupidly I only checked
the algorithm with squarefree polynomials (after all, this is
the interesting part of the routine).
This bug will be fixed in the next patch. If you need this
fix urgent, you can (but please note, that this might get you in
trouble when applying the next fix!) edit the library file
polyrat.g and replace
Degree(g) mod Degree(r) = 0
Degree(g) >= Degree(r) in lines 1629 and 1634.
With this fix, the polynomial is factorized correctly.
Alternatively, you could call Factors only for squarefree polynomials and
handle the square part yourself in the meantime.
Please excuse my short-sightedness,