Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

resulant of two polynomials returns incorrect value #12752

Closed
bhutz opened this issue Mar 26, 2012 · 4 comments
Closed

resulant of two polynomials returns incorrect value #12752

bhutz opened this issue Mar 26, 2012 · 4 comments

Comments

@bhutz
Copy link

bhutz commented Mar 26, 2012

The resultant of two homogeneous polynomials can return an incorrect value:
R.<x,y>=PolynomialRing(ZZ)

f=6x2 + xy + y2

g=y2
print f.resultant(g)

m=matrix([[6,1,1,0],[0,6,1,1],[0,0,1,0],[0,0,0,1]])

m.determinant()

notice that the coefficient of the f.resultant(g) does not match the integer determinant (they should be the same). I believe this is because the .resultant function is actually calling the pari library, which is interpreting y2 as a single variable polynomial. Thus it builds the wrong matrix. Probably the following:

m=matrix([[6,1,1,0],[0,6,1,1],[1,0,0,0],[0,1,0,0]])

m.determinant()

which is the value Sage is returning. The correct value is returned in Sage from

m=f.sylvester_matrix(g,x)

m.determinant()

Component: basic arithmetic

Keywords: polynomial resultant

Reviewer: Nils Bruin

Issue created by migration from https://trac.sagemath.org/ticket/12752

@bhutz bhutz added this to the sage-5.0 milestone Mar 26, 2012
@nbruin
Copy link
Contributor

nbruin commented Mar 27, 2012

comment:1

See this sage-devel thread. The documented use of f.resultant(g,) is to take the resultant of f,g with respect to . This is useful for eliminating variables when doing computations with polynomials. As documented, f.resultant(g) takes the resultant relative to the first parameter.

The resultant operation expected/requested in the ticket is a different one: It is the "bivariate form" resultant. You can compute it by taking a univariate polynomial resultant of dehomogenized forms and compensating for degree-drop by multiplying by the right power of some leading coefficients (if both forms drop in degree then they have a common root at infinity and the resultant is 0). Note that this routine should raise an error if any of its parameters is not homogeneous or not bivariate.

The resultant method on multivariate polynomials basically has to be the ordinary polynomial resultant. If you really want to have the form-resultant you can implement it as a separate function:

def form_resultant(F,G):
    """debugging, error checking and better coercion left as an exercise"""
    R=F.base_ring()
    Rt=PolynomialRing(R,'t')
    f=F(Rt.0,1)
    lcF=F.coefficient([F.degree(),0])
    g=G(Rt.0,1)
    lcG=G.coefficient([G.degree(),0])
    return lcF^(G.degree()-g.degree())*lcG^(F.degree()-f.degree())*f.resultant(g)

If there is a class somewhere that symbolizes homogeneous bivariate forms, you could hang that function off it as "form_resultant".

Note that in general, computing with bivariate forms is done most efficiently by representing them by a univariate polynomial together with a degree (to keep track of leading 0 coefficients). Univariate polynomials tend to have much more efficient implementations.

Changing to "invalid". If you want to track an enhancement proposal to implement a "forms" class, it's probably better to open a new ticket. I think it will be tricky to come up with a useful design for that, though.

@nbruin nbruin removed this from the sage-5.0 milestone Mar 27, 2012
@sagetrac-mariah
Copy link
Mannequin

sagetrac-mariah mannequin commented May 23, 2012

comment:3

Since this ticket has been set to invalid, I believe this ticket can be
closed.

@jdemeyer
Copy link

jdemeyer commented Jun 2, 2012

Changed stopgaps from todo to none

@jdemeyer
Copy link

jdemeyer commented Jun 2, 2012

Reviewer: Nils Bruin

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants