Opened 11 years ago

Closed 11 years ago

# Bug in factor of polynomials over number fields

Reported by: Owned by: lftabera davidloeffler major sage-4.6.2 number fields pari, factor, number field jdemeyer sage-4.6.2.alpha2 Jeroen Demeyer Luis Felipe Tabera Alonso Fixed upstream, but not in a stable release.

Bug raised in sage-devel by Niels Lubbes

``` sage: R = PolynomialRing( QQ, var( 't' ), order = 'lex' )
sage: t = R.gens()[0]
sage: f = t^4 - t^2 + 1
sage: T = NumberFieldTower( [f], 'a0' )
sage: R1 = R.change_ring( T )
sage: a0 = T.gens()[0]
sage: t = R1.gens()[0]
sage: poly = t^3 + (-4*a0^3 + 2*a0)*t^2 - 11/3*a0^2*t + 2/3*a0^3 - 4/3*a0
sage: poly.factor()
(t - 2*a0^3 + a0) * (t^2 + (-2*a0^3 + a0)*t - 2/3*a0^2)
sage: fact = poly.factor()[1][0]
sage: fact.factor()
(t - 4/3*a0^3 + 2/3*a0) * (t - 2/3*a0^3 + 1/3*a0)
```

As Jeroen Demeyer points, it is a bug in Pari.

``` gp> t; nf = nfinit(a^4 - a^2 + 1);
gp> poly = t^3 + (-4*a^3 + 2*a)*t^2 - 11/3*a^2*t + 2/3*a^3 - 4/3*a
%1 = t^3 + (-4*a^3 + 2*a)*t^2 - 11/3*a^2*t + (2/3*a^3 - 4/3*a)
gp> F = nffactor(nf, poly)
%2 =
[t + Mod(-2*a^3 + a, a^4 - a^2 + 1) 1]

[t^2 + Mod(-2*a^3 + a, a^4 - a^2 + 1)*t + Mod(-2/3*a^2, a^4 - a^2 + 1) 1]

gp> nffactor(nf, F[2,1])
%3 =
[t + Mod(-4/3*a^3 + 2/3*a, a^4 - a^2 + 1) 1]

[t + Mod(-2/3*a^3 + 1/3*a, a^4 - a^2 + 1) 1]
```

The fix for this bug is in #10430, the attached patch simply adds a doctest.

### comment:1 Changed 11 years ago by lftabera

upstream bug reference

### comment:2 Changed 11 years ago by jdemeyer

• Component changed from factorization to number fields
• Milestone set to sage-4.6.1
• Owner changed from tbd to davidloeffler
• Report Upstream changed from Reported upstream. Little or no feedback. to Reported upstream. Developers acknowledge bug.

### comment:3 Changed 11 years ago by jdemeyer

• Report Upstream changed from Reported upstream. Developers acknowledge bug. to Fixed upstream, but not in a stable release.

### comment:4 Changed 11 years ago by jdemeyer

• Milestone changed from sage-4.6.1 to sage-duplicate/invalid/wontfix
• Status changed from new to needs_review

See #10430

### comment:5 follow-up: ↓ 6 Changed 11 years ago by davidloeffler

• Milestone changed from sage-duplicate/invalid/wontfix to sage-4.6.2

I suggest we keep this ticket open until the new Pari is in, and then we can add a doctest to prove that it is fixed. Otherwise there is a danger that we forget to add such a doctest and the bug reappears at a later date.

### comment:6 in reply to: ↑ 5 Changed 11 years ago by jdemeyer

• Authors set to Jeroen Demeyer
• Description modified (diff)

I suggest we keep this ticket open until the new Pari is in, and then we can add a doctest to prove that it is fixed. Otherwise there is a danger that we forget to add such a doctest and the bug reappears at a later date.

Agreed!

### comment:7 Changed 11 years ago by lftabera

• Reviewers set to Luis Felipe Tabera Alonso
• Status changed from needs_review to positive_review

This is a trivial doctest patch. The patch applies cleanly and adds a relevant doctest. Once #10430 is merged this will go along. Positive review.

### comment:8 Changed 11 years ago by jdemeyer

• Merged in set to sage-4.6.2.alpha1
• Resolution set to fixed
• Status changed from positive_review to closed

### comment:9 Changed 11 years ago by jdemeyer

• Merged in sage-4.6.2.alpha1 deleted
• Resolution fixed deleted
• Status changed from closed to new

### comment:10 Changed 11 years ago by jdemeyer

• Status changed from new to needs_review

### comment:11 Changed 11 years ago by jdemeyer

• Status changed from needs_review to positive_review

### comment:12 Changed 11 years ago by jdemeyer

• Merged in set to sage-4.6.2.alpha2
• Resolution set to fixed
• Status changed from positive_review to closed
Note: See TracTickets for help on using tickets.