Ticket #2775 (closed defect: fixed)

Opened 5 years ago

Last modified 5 years ago

[with patch, positive review] multivariate factoring over some rings gives incorrect results

Reported by: dmharvey Owned by: tbd
Priority: major Milestone: sage-3.0
Component: factorization Keywords:
Cc: Work issues:
Report Upstream: Reviewers:
Authors: Merged in:
Dependencies: Stopgaps:

Description

This example is from Genya Zaytman:

sage: version()
'SAGE Version sage-2.11, Release Date: 2008-03-30'
sage: q = 1073741789
sage: T.<aa, bb> = PolynomialRing(GF(q))
sage: f = aa^2 + 12124343*bb*aa + 32434598*bb^2; f
aa^2 + 12124343*aa*bb + 32434598*bb^2
sage: f.factor()
(32434598) * (16373350*aa^2 + 437239695*aa*bb + bb^2)
sage: g = (32434598) * (16373350*aa^2 + 437239695*aa*bb + bb^2); g
aa^2 - 49344938*aa*bb + 32434598*bb^2
sage: f == g
False

Michael Abshoff reports that this is a bug in Singular itself.

See also

 http://groups.google.com/group/sage-devel/browse_thread/thread/bb040b4580b44184

Attachments

trac_2775.patch Download (2.0 KB) - added by malb 5 years ago.

Change History

comment:1 Changed 5 years ago by mabshoff

  • Milestone set to sage-3.0

comment:2 Changed 5 years ago by mabshoff

  • Owner changed from somebody to tbd
  • Component changed from basic arithmetic to factorization

comment:3 follow-up: ↓ 4 Changed 5 years ago by malb

We got word from the Singular team: My rough translation follows:

Our analysis revealed that the cause is that the characteristic is too big: despite the fact that the Singular kernel can compute with characteristics up to 231 since 3-0-0, Factory has a limit of p <229 (31 bit for signed int, 2 bit as "Type indicator"). Unfortunately this wasn't tested, since the former limit for Singular was much lower (215).

comment:4 in reply to: ↑ 3 ; follow-ups: ↓ 5 ↓ 6 Changed 5 years ago by dmharvey

Replying to malb:

We got word from the Singular team: My rough translation follows:

Our analysis revealed that the cause is that the characteristic is too big: despite the fact that the Singular kernel can compute with characteristics up to 231 since 3-0-0, Factory has a limit of p <229 (31 bit for signed int, 2 bit as "Type indicator"). Unfortunately this wasn't tested, since the former limit for Singular was much lower (215).

Clarification: is "Factory" something in Sage, or something in Singular? i.e. is this still a bug (or possibly documentation bug) at their end, or do we just need to stop using Singular when the characteristic gets this big?

Another question: is it really always 29 bits, or is it going to be 61 bits on a 64-bit machine?

comment:5 in reply to: ↑ 4 Changed 5 years ago by mabshoff

Replying to dmharvey:

Clarification: is "Factory" something in Sage, or something in Singular? i.e. is this still a bug (or possibly documentation bug) at their end, or do we just need to stop using Singular when the characteristic gets this big?

Factory is a library that is part of Singular and used to do factorization. Other projects like M2 also use it. As you write we need to check the characteristic before passing the polynomial to factory nee Singular and otherwise throw an exception.

Another question: is it really always 29 bits, or is it going to be 61 bits on a 64-bit machine?

It seems to be always 29 bits. I tested on sage.math with a 64 bit Singular.

Cheers,

Michael

comment:6 in reply to: ↑ 4 ; follow-up: ↓ 7 Changed 5 years ago by malb

Clarification: is "Factory" something in Sage, or something in Singular? i.e. is this still a bug (or possibly documentation bug) at their end, or do we just need to stop using Singular when the characteristic gets this big?

"Factory" is a Singular thing and we need to raise an Exception if the user attempts to factor of fields that large. I'll provide a patch later.

Another question: is it really always 29 bits, or is it going to be 61 bits on a 64-bit machine?

The word is 29 bits, but I'll check later, too.

comment:7 in reply to: ↑ 6 Changed 5 years ago by dmharvey

Replying to malb:

"Factory" is a Singular thing and we need to raise an Exception if the user attempts to factor of fields that large. I'll provide a patch later.

Ummm.... do we have any other way to provide the factorisation? For example, Genya (who reported this bug) actually wanted to factor the polynomial :-) I agree that an exception is better than an incorrect result, but it would be nice if.....

Changed 5 years ago by malb

comment:8 Changed 5 years ago by malb

  • Summary changed from multivariate factoring over some rings gives incorrect results to [with patch, needs review] multivariate factoring over some rings gives incorrect results

The attached patch raises a NotImplementedError if a factorisation with characteristic > 229 is attempted.

comment:9 Changed 5 years ago by mabshoff

  • Summary changed from [with patch, needs review] multivariate factoring over some rings gives incorrect results to [with patch, positive review] multivariate factoring over some rings gives incorrect results

Patch looks good to me. It adds the original bug report as a doctest. Positive review.

Cheers,

Michael

comment:10 Changed 5 years ago by mabshoff

  • Status changed from new to closed
  • Resolution set to fixed

Merged in Sage 3.0.alpha2

Note: See TracTickets for help on using tickets.