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

Improve sign consistency in rational polynomial factorization #33283

Open
real-or-random opened this issue Feb 3, 2022 · 2 comments
Open

Improve sign consistency in rational polynomial factorization #33283

real-or-random opened this issue Feb 3, 2022 · 2 comments

Comments

@real-or-random
Copy link

The placement of the minus sign when factoring multivariate polynomials over QQ lost consistency at some point between Sage 9.2 and 9.4.

Define a multivariate polynomial ring:

sage: R.<ax,bx,ay,by,Az,Bz,Ai,Bi> = PolynomialRing(QQ, 8, order='invlex')
sage: R
Multivariate Polynomial Ring in ax, bx, ay, by, Az, Bz, Ai, Bi over Rational Field

Then, in Sage 9.2:

sage: R((-2 * (bx - ax)) ^ 1).factor()
(2) * (-bx + ax)
sage: R((-2 * (bx - ax)) ^ 2).factor()
(4) * (-bx + ax)^2
sage: R((-2 * (bx - ax)) ^ 3).factor()
(8) * (-bx + ax)^3

while in Sage 9.4 or Sage 9.5:

sage: R((-2 * (bx - ax)) ^ 1).factor()
(-2) * (bx - ax)
sage: R((-2 * (bx - ax)) ^ 2).factor()
(4) * (-bx + ax)^2
sage: R((-2 * (bx - ax)) ^ 3).factor()
(8) * (-bx + ax)^3

This broke our code in

It would be good to output a canonical form. A natural choice seems to make the leading coefficient of each factor positive.

It may then also be good to document that the factors will be primitive.

The invlex monomial ordering is not the culprit: the inconsistency also occurs with lex (see one comment down at the GitHub link).

Component: factorization

Issue created by migration from https://trac.sagemath.org/ticket/33283

@real-or-random

This comment has been minimized.

@slel

This comment has been minimized.

@slel slel changed the title Inconsistent position of sign in factorization of rational polynominals Improve sign consistency in rational polynomial factorization Feb 4, 2022
@mkoeppe mkoeppe modified the milestones: sage-9.6, sage-9.7 May 3, 2022
@mkoeppe mkoeppe modified the milestones: sage-9.7, sage-9.8 Sep 19, 2022
@mkoeppe mkoeppe removed this from the sage-9.8 milestone Jan 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants
@real-or-random @slel @mkoeppe and others