First time here? Check out the FAQ!

Ask Your Question
1

How do i solve a 2 variable polynomial over 1 variable

asked 4 years ago

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?

Preview: (hide)

Comments

2

3 answers in a row, yeah !

tmonteil gravatar imagetmonteil ( 4 years ago )

3 Answers

Sort by » oldest newest most voted
1

answered 4 years ago

Sébastien gravatar image

updated 4 years ago

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]
Preview: (hide)
link
1

answered 4 years ago

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}]
Preview: (hide)
link
1

answered 4 years ago

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)]
Preview: (hide)
link

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: 4 years ago

Seen: 1,322 times

Last updated: May 26 '20