Ask Your Question
2

Equating coefficients of multivariate polynomials

asked 2020-05-30 03:15:59 -0500

Tom11 gravatar image

Here is a simple question, and despite looking at answers to other questions I cannot find how to proceed. I would be extremely grateful for any help.

We have a polynomial Pol in several variables (with rational coefficients, if it helps). Its coefficients involve some parameters. And I would like to find values of these parameter so that Pol is the zero polynomial. Here's some code that does not work but capture what I've tried to do.

var('a0,a1') ; R.<x,y> = QQ[] ; Pol = (a1*x+a0)*(1-x*y)-5*y*x ;

ad then I would like to solve (in the variables a0, a1) the system of coefficients equated to 0:

WA = [SR(Pol).coefficient({x:0,y:0})==0,
     SR(Pol).coefficient({x:2,y:1})==0,
     SR(Pol).coefficient({x:1,y:1})==0,
     SR(Pol).coefficient({x:1,y:0})==0
    ].solve(SR(a0),SR(a1)); WA
edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
3

answered 2020-05-30 06:01:19 -0500

tmonteil gravatar image

updated 2020-05-30 14:48:42 -0500

Whe you write :

sage: var('a0,a1') ; R.<x,y> = QQ[] ; 
sage: Pol = (a1*x+a0)*(1-x*y)-5*y*x ;

The product a1*x (and the other elementary operations) is done using coercion, that is Sage first searches the common parent between the symbolic ring and the bivariate rational polynomials in x,y. It turns out that it is the symbolic ring itself. Hence, what you get is and element of the symbolic ring:

sage: Pol.parent()
Symbolic Ring

In particular, you lose the polynomial structure in x,y.

The first approach is to let Sage consider a0 and a1 a possible coefficients for polynomials in x,y, by declaring the polynomial ring R to be defined over the symbolic ring SR:

sage: var('a0,a1') ; R.<x,y> = SR[]
(a0, a1)
sage: Pol = (a1*x+a0)*(1-x*y)-5*y*x 
sage: Pol
(-a1)*x^2*y + (-a0 - 5)*x*y + a1*x + a0
sage: Pol.parent()
Multivariate Polynomial Ring in x, y over Symbolic Ring

Then you can extract the nonzero coefficients:

sage: Pol.coefficients()
[-a1, -a0 - 5, a1, a0]
sage: solve(Pol.coefficients(),[a0,a1])
[]

There is of course no solution since a0 should be both equal to 0 and -5.

Another approach is to let the coefficients be elements of another polynomial ring S, that will be the ring over which R will be defined:

sage: S.<a0,a1> = QQ[] ; S
Multivariate Polynomial Ring in a0, a1 over Rational Field
sage: R.<x,y> = S[] ; R
Multivariate Polynomial Ring in x, y over Multivariate Polynomial Ring in a0, a1 over Rational Field
sage: Pol = (a1*x+a0)*(1-x*y)-5*y*x 
sage: Pol
(-a1)*x^2*y + (-a0 - 5)*x*y + a1*x + a0
sage: Pol.parent()
Multivariate Polynomial Ring in x, y over Multivariate Polynomial Ring in a0, a1 over Rational Field

Now, the common zeroes of the coeficients of Pol (which are polynomials, elements of S), is nothing but the variety of an ideal:

sage: Pol.coefficients()
[-a1, -a0 - 5, a1, a0]
sage: S.ideal(Pol.coefficients())
Ideal (-a1, -a0 - 5, a1, a0) of Multivariate Polynomial Ring in a0, a1 over Rational Field
sage: I = S.ideal(Pol.coefficients())
sage: I.variety()
[]

Which is empty as well.

edit flag offensive delete link more

Comments

Thank you so much for this detailed answer, this is perfect! (Yes in this simple example there is no solution, my actual application has lots of variables and a higher degree so it would have been clumsy to show here).

Tom11 gravatar imageTom11 ( 2020-05-30 06:39:07 -0500 )edit

Your Answer

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

Add Answer

Question Tools

1 follower

Stats

Asked: 2020-05-30 03:14:30 -0500

Seen: 58 times

Last updated: May 30