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.