#10279: Bug in factor of polynomials over number fields
------------------------------+---------------------------------------------
   Reporter:  lftabera        |       Owner:  davidloeffler                     
          
       Type:  defect          |      Status:  needs_review                      
          
   Priority:  major           |   Milestone:  sage-4.6.2                        
          
  Component:  number fields   |    Keywords:  pari, factor, number field        
          
     Author:  Jeroen Demeyer  |    Upstream:  Fixed upstream, but not in a 
stable release.
   Reviewer:                  |      Merged:                                    
          
Work_issues:                  |  
------------------------------+---------------------------------------------
Changes (by newvalueoldvalue):

  * author:  => Jeroen Demeyer


Old description:

> Bug raised in sage-devel by Niels Lubbes
>
> [http://groups.google.com/group/sage-
> devel/browse_thread/thread/33aa40a7685f37aa/d6a6230ee023fd06?show_docid=d6a6230ee023fd06]
>
> {{{
>  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]
> }}}

New description:

 Bug raised in sage-devel by Niels Lubbes

 [http://groups.google.com/group/sage-
 
devel/browse_thread/thread/33aa40a7685f37aa/d6a6230ee023fd06?show_docid=d6a6230ee023fd06]

 {{{
  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:

 Replying to [comment:5 davidloeffler]:
 > 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!

-- 
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/10279#comment:6>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica, 
and MATLAB

-- 
You received this message because you are subscribed to the Google Groups 
"sage-trac" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/sage-trac?hl=en.

Reply via email to