# How do i solve a 2 variable polynomial over 1 variable

So i have a polynomial over 2 variables:

R.<X, Y> = GF(8009)[]
Phi = -X^2*Y^2 + X^3 + 1488*X^2*Y + 1488*X*Y^2 + Y^3 \
- 162000*X^2 + 40773375*X*Y - 162000*Y^2 \
+ 8748000000*X + 8748000000*Y - 157464000000000


I want to know for what Y values the polynomial has a solution with X = 33. I've tried using the solve method:

Phi(33, Y).roots(Y)


But this yields the error

AttributeError: 'sage.rings.polynomial.multi_polynomial_libsingular.MPolynomial_libsingular' object has no attribute 'roots'


I also tried the following:

Phi(33).roots()


It yields the error

TypeError: number of arguments does not match number of variables in parent


So what is the correct way to do this?

edit retag close merge delete

2

Sort by » oldest newest most voted

The method univariate_polynomial of a multivariate polynomial object depending on a single variable returns a polynomial in the appropriate univariate polynomial ring:

sage: Phi(X=33).univariate_polynomial().parent()
Univariate Polynomial Ring in Y over Finite Field of size 8009


Then:

sage: Phi(X=33).univariate_polynomial().roots()
[(898, 1)]
sage: Phi(X=33).univariate_polynomial().roots(multiplicities=False)


more The polynomial Phi can only be evaluated at two inputs (using the function call syntax). The method roots is only available for single variable polynomials. Your Phi(33,Y) is (in SageMath) still a multivariable polynomial (in which X does not appear). To convert it to a single variable polynomial in Y, use the univariate_polynomial method:

sage: f = Phi.subs(X=33).univariate_polynomial(); f
Y^3 + 6150*Y^2 + 5541*Y + 1175
sage: f.parent()
Univariate Polynomial Ring in Y over Finite Field of size 8009
sage: f.roots()
[(898, 1)]
sage: f.roots(multiplicities=False)



Alternatively:

sage: R.ideal([Phi, X-33]).variety()
[{Y: 898, X: 33}]

more

This is because Phi(33, Y) is still a polynomial in two variables:

sage: Phi(33, Y).parent()
Multivariate Polynomial Ring in X, Y over Finite Field of size 8009


So, you have to turn it into a one-variable polynomial first:

sage: S.<Y> = GF(8009)[]
sage: S(Phi(33, Y))
Y^3 + 6150*Y^2 + 5541*Y + 1175

sage: S(Phi(33, Y)).parent()
Univariate Polynomial Ring in Y over Finite Field of size 8009

sage: S(Phi(33, Y)).roots()
[(898, 1)]

more