#13672: resultant over GF(q)[t][x] is plain wrong!!!
---------------------------------------+------------------------------------
Reporter: zimmerma | Owner: malb
Type: defect | Status: positive_review
Priority: critical | Milestone: sage-5.6
Component: commutative algebra | Resolution:
Keywords: | Work issues:
Report Upstream: N/A | Reviewers: Paul Zimmermann
Authors: Jeroen Demeyer | Merged in:
Dependencies: | Stopgaps:
---------------------------------------+------------------------------------
Changes (by zimmerma):
* status: needs_review => positive_review
* reviewer: => Paul Zimmermann
Old description:
> Consider the following:
> {{{
> sage: R.<t> = GF(2)[]; S.<x> = R[]
> sage: f=(t^2 + t)*x + t^2 + t; g=(t + 1)*x + t^2
> sage: f.resultant(g)
> t^3 + t
> }}}
> This is wrong: the resultant of {{{f}}} and {{{g}}} is {{{t^4+t}}}.
>
> Plenty of failures can be found with the following code which computes
> the resultant as the determinant of the Sylvester matrix:
> {{{
> def Resultant(f,g):
> df = f.degree()
> dg = g.degree()
> K = f.base_ring()
> M = matrix(K,df+dg,df+dg)
> for i in range(dg):
> for j in range(df+1):
> M[i,i+j] = f.coeffs()[df-j]
> for i in range(df):
> for j in range(dg+1):
> M[dg+i,i+j] = g.coeffs()[dg-j]
> return M.det()
>
> def check(df,dg):
> f = S.random_element(degree=df)
> g = S.random_element(degree=dg)
> r1 = f.resultant(g)
> r2 = Resultant(f,g)
> if r1 <> r2:
> print f, g, r1, r2
> raise ValueError
> }}}
New description:
Consider the following:
{{{
sage: R.<t> = GF(2)[]; S.<x> = R[]
sage: f=(t^2 + t)*x + t^2 + t; g=(t + 1)*x + t^2
sage: f.resultant(g)
t^3 + t
}}}
This is wrong: the resultant of {{{f}}} and {{{g}}} is {{{t^4+t}}}.
Plenty of failures can be found with the following code which computes the
resultant as the determinant of the Sylvester matrix:
{{{
def Resultant(f,g):
df = f.degree()
dg = g.degree()
K = f.base_ring()
M = matrix(K,df+dg,df+dg)
for i in range(dg):
for j in range(df+1):
M[i,i+j] = f.coeffs()[df-j]
for i in range(df):
for j in range(dg+1):
M[dg+i,i+j] = g.coeffs()[dg-j]
return M.det()
def check(df,dg):
f = S.random_element(degree=df)
g = S.random_element(degree=dg)
r1 = f.resultant(g)
r2 = Resultant(f,g)
if r1 <> r2:
print f, g, r1, r2
raise ValueError
}}}
Apply {{{13672_pari_resultant.patch}}}
--
Comment:
thank you Jeroen for fixing this!
Paul
--
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/13672#comment:9>
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.