Ask Your Question
1

How do i solve a 2 variable polynomial over 1 variable

asked 2020-05-26 18:23:29 +0100

JGC gravatar image

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 flag offensive close merge delete

Comments

2

3 answers in a row, yeah !

tmonteil gravatar imagetmonteil ( 2020-05-26 18:36:43 +0100 )edit

3 Answers

Sort by » oldest newest most voted
1

answered 2020-05-26 18:34:19 +0100

Sébastien gravatar image

updated 2020-05-26 18:37:45 +0100

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)
[898]
edit flag offensive delete link more
1

answered 2020-05-26 18:35:47 +0100

rburing gravatar image

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)
[898]

Alternatively:

sage: R.ideal([Phi, X-33]).variety()
[{Y: 898, X: 33}]
edit flag offensive delete link more
1

answered 2020-05-26 18:34:26 +0100

tmonteil gravatar image

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)]
edit flag offensive delete link more

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-26 18:23:29 +0100

Seen: 1,205 times

Last updated: May 26 '20