Bug #1185
factor: multivariate, wrong RemainingFactor (sign wrong)
Description
Gereon Kreme reports the following bug (JAA has confirmed)
use QQ[x[0..5]]; f := (x[3]*x[4]+x[5])*(x[1]*x[2]-x[0]+x[1]); facs := factor(f); indent(facs); record[ RemainingFactor := -1, factors := [x[3]*x[4] +x[5], x[1]*x[2] -x[0] +x[1]], multiplicities := [1, 1] ]
RemainingFactor
should be 1
History
#1 Updated by John Abbott almost 6 years ago
- Status changed from New to In Progress
More failing examples:
f := (x[2]+x[3])*(x[2]^2-x[1]);
Did not find any examples with just 2 indets.
#2 Updated by John Abbott almost 6 years ago
- Assignee set to John Abbott
- % Done changed from 0 to 20
I have a workaround for the problem: in the file factor.C
I ensure that all factors have positive leading coeff, and then choose the sign of the RemainingFactor to be the same as the sign of the original leading coeff. In the DMPZfactor
code it does something similar but using its own internal ordering (DegLex
)... not sure why that goes wrong.
The code in DMPZfactor.c looks reasonable, but clearly does make mistakes. It will take some time to track down the real bug (and fix it properly). I'm still amazed that this bug hasn't surfaced before.
I have emailed a patched version of factor.C
to Gereon, and will check in once I have access to CVS again.
#3 Updated by John Abbott almost 6 years ago
- Status changed from In Progress to Resolved
- % Done changed from 20 to 50
I believe I have fixed the problem (without really finding what was the original bug).
I have changed the (ancient) multivariate GCD code so that it returns a result with a positive leading coeff (wrt the internal ordering, which is DegLex). This seems to have fixed the problem.
I'll check in as soon as I can.
#4 Updated by John Abbott almost 6 years ago
- Status changed from Resolved to Feedback
- % Done changed from 50 to 90
I have tested my change -- seems fine.
Checked in.
#5 Updated by Anna Maria Bigatti over 5 years ago
- Status changed from Feedback to Closed
- % Done changed from 90 to 100
- Estimated time set to 4.51 h