Ask Your Question
0

Bug in roots()?

asked 2014-12-02 09:42:34 -0500

this post is marked as community wiki

This post is a wiki. Anyone with karma >750 is welcome to improve it.

Hi guys, I might have found a bug in the roots method. Below is some (ugly) polynomial of degree 4 over a fraction field of a polynomial ring over a finite extension of GF(11). The roots() method returns 0 as a root which it is not. If i do the same thing over QQ instead of GF(11) "Not implemented" is returned. Sry i couldn't come up with a shorter example.

    sage: K0=GF(11)
    sage: #K0=QQ
    sage: R0.<b>=K0[]
    sage: K.<b>=K0.extension(b^5+4)
    sage: R1.<z3>=K[]
    sage: L=FractionField(R1)
    sage: R.<x>=L[]
    sage: f=(x^4 + ((3*b^3*z3^24 + 9*b^4*z3^23 + 8*z3^22 + 7*b*z3^21 + 9*b^2*z3^20 + 4*b^3*z3^19 + 4*b^4*z3^18 + 10*z3^17 + 6*b*z3^16 + 4*b^2*z3^15 + 6*b^3*z3^14 + 4*b^4*z3^13 + 5*z3^12 + 2*b*z3^11 + 3*b^2*z3^10 + b^3*z3^9 + b^4*z3^8 + 9*z3^7 + 2*b*z3^6 + 4*b^2*z3^5 + b^4*z3^3 + 2*z3^2 + 9*b*z3 + 10*b^2)/(b^4*z3^24 + 7*z3^23 + 7*b*z3^22 + 2*b^2*z3^21 + b^3*z3^20 + 5*b^4*z3^19 + 9*z3^18 + 7*b*z3^17 + 2*b^3*z3^15 + 8*b^4*z3^14 + 2*z3^13 + 7*b*z3^12 + 6*b^3*z3^10 + 6*b^4*z3^9 + 4*z3^8 + b*z3^7 + 8*b^3*z3^5 + 5*b^4*z3^4))*x^3 + ((5*b^3*z3^26 + 9*b^4*z3^25 + 8*z3^24 + 10*b*z3^23 + 3*b^2*z3^22 + 8*b^3*z3^21 + 8*b^4*z3^20 + 6*z3^19 + 4*b*z3^18 + 7*b^2*z3^17 + 9*b^4*z3^15 + 7*z3^14 + b*z3^13 + 5*b^2*z3^12 + 10*b^3*z3^11 + 6*z3^9 + 4*b*z3^8 + 3*b^2*z3^7 + 8*b^3*z3^6 + 2*b^4*z3^5 + 4*z3^4 + 6*b*z3^3 + 2*b^2*z3^2 + 5*b^3*z3 + 10*b^4)/(b^4*z3^27 + 7*z3^26 + 7*b*z3^25 + 2*b^2*z3^24 + b^3*z3^23 + 5*b^4*z3^22 + 9*z3^21 + 7*b*z3^20 + 2*b^3*z3^18 + 8*b^4*z3^17 + 2*z3^16 + 7*b*z3^15 + 6*b^3*z3^13 + 6*b^4*z3^12 + 4*z3^11 + b*z3^10 + 8*b^3*z3^8 + 5*b^4*z3^7))*x^2 + ((9*b^3*z3^28 + b^4*z3^27 + 8*z3^26 + 4*b*z3^25 + 3*b^3*z3^23 + 7*b^4*z3^22 + 2*z3^21 + 6*b*z3^20 ...
(more)
edit retag flag offensive close merge delete

Comments

Seems to be a bug in the Singular interface. For f._singular_() returns x^4

Francis Clarke gravatar imageFrancis Clarke ( 2014-12-03 02:35:33 -0500 )edit

1 answer

Sort by ยป oldest newest most voted
0

answered 2017-03-02 14:45:12 -0500

dan_fulea gravatar image

This answer will rise an other question. I could produce an example in a small scene:

K.<b> = GF( 2^2 )
R.<w> = K[]
L = FractionField( R )
S.<x> = L[]

g = ( x + 1/w ) * ( x + 1/b )
h = x^2 + (w+b)/w/b * x + 1/w/b

print "Is g == h ?", g==h

print "g factorized is", g.factor()
print "h factorized is", h.factor()

print "Is g factorized == h factorized ?", g.factor() == h.factor()

print "g.factor().expand() is", g.factor().expand()
print "h.factor().expand() is", h.factor().expand()

And i've got this time:

Is g == h ? True
g factorized is (1/w) * (x + b + 1) * (w*x + 1)
h factorized is (1/w) * x * (w*x + 1)

Is g factorized == h factorized ? False
g.factor().expand() is x^2 + (((b + 1)*w + 1)/w)*x + (b + 1)/w
h.factor().expand() is x^2 + 1/w*x

So we immediately want to see...

sage: hf = h.factor()
sage: hf.__dict__
{'_Factorization__cr': False,
 '_Factorization__unit': 1/w,
 '_Factorization__universe': Univariate Polynomial Ring in x over Fraction Field 
                             of Univariate Polynomial Ring in w 
                             over Finite Field in b of size 2^2,
 '_Factorization__x': [(x, 1), (w*x + 1, 1)]}

OK, this is strange. (As a joke... my next try was to replace w by s. Same type of error.) Of course, the straight way to so the things worked:

K.<b> = GF( 2^2 )
R.<w,x> = K[]
S = FractionField( R )

g = ( x + 1/w ) * ( x + 1/b )
h = x^2 + (w+b)/w/b * x + 1/w/b

print "Is g == h ?", g==h

print "g factorized is", g.factor()
print "h factorized is", h.factor()

print "Is g factorized == h factorized ?", g.factor() == h.factor()

print "g.factor().expand() is", g.factor().expand()
print "h.factor().expand() is", h.factor().expand()

Results:

Is g == h ? True
g factorized is w^-1 * (x + (b + 1)) * (w*x + 1)
h factorized is w^-1 * (x + (b + 1)) * (w*x + 1)

Is g factorized == h factorized ? True
g.factor().expand() is (w*x^2 + (b + 1)*w*x + x + (b + 1))/w
h.factor().expand() is (w*x^2 + (b + 1)*w*x + x + (b + 1))/w
edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

Stats

Asked: 2014-12-02 09:42:34 -0500

Seen: 99 times

Last updated: Mar 02