1 | initial version |
If you want x0
and y0
to be coefficients of your polynomials, your polynomial ring can not be defined over the ring QQ
, but it should be defined over SR
(the symbolic ring). So you can try something like:
sage: x0,y0 = var('x0,y0')
sage: R.<x1,y1,x2,y2,x3,y3> = PolynomialRing(SR, order='lex')
sage: sage: f1 = 13*(x1+x1*x2-y1*y2+(x1*x2-y1*y2)*x3-(y1*x2+y2*x1)*y3)-x0
sage: sage: f2 = 13*(y1+y1*x2+y2*x1+(y1*x2+y2*x1)*x3+(x1*x2-y1*y2)*y3)-y0
sage: sage: f3 = x1^2+y1^2-1
sage: sage: f4 = x2^2+y2^2-1
sage: sage: f5 = x3^2+y3^2-1
sage: I =R.ideal(f1,f2,f3,f4,f5)
Which results in
sage: I.groebner_basis()
verbose 0 (3369: multi_polynomial_ideal.py, groebner_basis) Warning: falling back to very slow toy implementation.
You can wait to see if something happens, but i am not very confident about how Sage will deal with the symbolic ring as it is currently implemented. A safer place to work in is in a well defined mathematical object, such as a polynomial ring. So, instead of claiming that x0
and y0
are symbols, let them be variables of a polynomial ring. Even better, since Groebner basis algorithms are more adapted to polynomials defined over a field, than over a ring, let us define x0
and y0
as variables of a fraction field:
sage: A.<x0,y0> = PolynomialRing(QQ)
sage: F = A.fraction_field()
sage: F.inject_variables() # we redefine x0 and y0 in the larger field F
Defining x0, y0
sage: R.<x1,y1,x2,y2,x3,y3> = PolynomialRing(F, order='lex')
sage: R
Multivariate Polynomial Ring in x1, y1, x2, y2, x3, y3 over Fraction Field of Multivariate Polynomial Ring in x0, y0 over Rational Field
sage: I = R.ideal(f1,f2,f3,f4,f5)
sage: I.groebner_basis()
[x1 + (228488*y0/(26*x0^4 + 52*x0^2*y0^2 + 26*y0^4 - 4394*x0^2 - 4394*y0^2))*y2^2*y3 + ((-676*y0)/(26*x0^2 + 26*y0^2))*y2*x3 + ((-228488*y0)/(26*x0^4 + 52*x0^2*y0^2 + 26*y0^4 - 4394*x0^2 - 4394*y0^2))*y2*y3^2 + (338*x0/(26*x0^2 + 26*y0^2))*x3 + ((-338*y0)/(26*x0^2 + 26*y0^2))*y3 + (-x0^3 - x0*y0^2 + 169*x0)/(26*x0^2 + 26*y0^2), y1 + ((-228488*x0)/(26*x0^4 + 52*x0^2*y0^2 + 26*y0^4 - 4394*x0^2 - 4394*y0^2))*y2^2*y3 + (676*x0/(26*x0^2 + 26*y0^2))*y2*x3 + (228488*x0/(26*x0^4 + 52*x0^2*y0^2 + 26*y0^4 - 4394*x0^2 - 4394*y0^2))*y2*y3^2 + (338*y0/(26*x0^2 + 26*y0^2))*x3 + (338*x0/(26*x0^2 + 26*y0^2))*y3 + (-x0^2*y0 - y0^3 + 169*y0)/(26*x0^2 + 26*y0^2), x2 + ((-77228944)/(338*x0^4 + 676*x0^2*y0^2 + 338*y0^4 - 114244*x0^2 - 114244*y0^2 + 9653618))*y2^3*y3 + ((-228488)/(338*x0^2 + 338*y0^2 - 57122))*y2^2 + (456976/(338*x0^2 + 338*y0^2 - 57122))*y2*x3*y3 + (77228944/(338*x0^4 + 676*x0^2*y0^2 + 338*y0^4 - 114244*x0^2 - 114244*y0^2 + 9653618))*y2*y3^3 + (-2)*y2*y3 + 3*x3 + (228488/(338*x0^2 + 338*y0^2 - 57122))*y3^2 - 1/338*x0^2 - 1/338*y0^2 + 1/2, y2^2*x3 + y2^2 - y2*x3*y3 + (1/338*x0^2 + 1/338*y0^2 - 3/2)*y2*y3 + (-1/338*x0^2 - 1/338*y0^2 + 1/2)*x3 + 1/228488*x0^4 + 1/114244*x0^2*y0^2 + 1/228488*y0^4 - 3/676*x0^2 - 3/676*y0^2 + 5/8, y2^2*y3^2 + (-1/338*x0^2 - 1/338*y0^2 + 1/2)*y2*x3*y3 - y2*y3^3 + (1/338*x0^2 + 1/338*y0^2 - 1/2)*y2*y3 + (-1/228488*x0^4 - 1/114244*x0^2*y0^2 - 1/228488*y0^4 + 1/676*x0^2 + 1/676*y0^2 - 1/8)*x3 + (-1/338*x0^2 - 1/338*y0^2 + 1/2)*y3^2 + 1/228488*x0^4 + 1/114244*x0^2*y0^2 + 1/228488*y0^4 - 1/676*x0^2 - 1/676*y0^2 + 1/8, x3^2 + y3^2 - 1]
2 | No.2 Revision |
If you want x0
and y0
to be coefficients of your polynomials, your polynomial ring can not be defined over the ring QQ
, but it should (in a first attempt) be defined over SR
(the symbolic ring). So you can try something like:
sage: x0,y0 = var('x0,y0')
sage: R.<x1,y1,x2,y2,x3,y3> = PolynomialRing(SR, order='lex')
sage: sage: f1 = 13*(x1+x1*x2-y1*y2+(x1*x2-y1*y2)*x3-(y1*x2+y2*x1)*y3)-x0
sage: sage: f2 = 13*(y1+y1*x2+y2*x1+(y1*x2+y2*x1)*x3+(x1*x2-y1*y2)*y3)-y0
sage: sage: f3 = x1^2+y1^2-1
sage: sage: f4 = x2^2+y2^2-1
sage: sage: f5 = x3^2+y3^2-1
sage: I =R.ideal(f1,f2,f3,f4,f5)
Which results in
sage: I.groebner_basis()
verbose 0 (3369: multi_polynomial_ideal.py, groebner_basis) Warning: falling back to very slow toy implementation.
You can wait to see if something happens, but i am not very confident about how Sage will deal with the symbolic ring as it is currently implemented. implemented.
A safer place to work in is in a well defined mathematical object, such as a polynomial ring. So, instead of claiming that x0
and y0
are symbols, let them be variables undeterminates of a polynomial ring. Even better, since Groebner basis algorithms are more adapted to polynomials defined over a field, than over a ring, let us define x0
and y0
as variables undeterminates of a fraction field:
sage: A.<x0,y0> = PolynomialRing(QQ)
sage: F = A.fraction_field()
sage: F.inject_variables() # we redefine x0 and y0 in the larger field F
Defining x0, y0
sage: R.<x1,y1,x2,y2,x3,y3> = PolynomialRing(F, order='lex')
sage: R
Multivariate Polynomial Ring in x1, y1, x2, y2, x3, y3 over Fraction Field of Multivariate Polynomial Ring in x0, y0 over Rational Field
sage: I = R.ideal(f1,f2,f3,f4,f5)
sage: I.groebner_basis()
[x1 + (228488*y0/(26*x0^4 + 52*x0^2*y0^2 + 26*y0^4 - 4394*x0^2 - 4394*y0^2))*y2^2*y3 + ((-676*y0)/(26*x0^2 + 26*y0^2))*y2*x3 + ((-228488*y0)/(26*x0^4 + 52*x0^2*y0^2 + 26*y0^4 - 4394*x0^2 - 4394*y0^2))*y2*y3^2 + (338*x0/(26*x0^2 + 26*y0^2))*x3 + ((-338*y0)/(26*x0^2 + 26*y0^2))*y3 + (-x0^3 - x0*y0^2 + 169*x0)/(26*x0^2 + 26*y0^2), y1 + ((-228488*x0)/(26*x0^4 + 52*x0^2*y0^2 + 26*y0^4 - 4394*x0^2 - 4394*y0^2))*y2^2*y3 + (676*x0/(26*x0^2 + 26*y0^2))*y2*x3 + (228488*x0/(26*x0^4 + 52*x0^2*y0^2 + 26*y0^4 - 4394*x0^2 - 4394*y0^2))*y2*y3^2 + (338*y0/(26*x0^2 + 26*y0^2))*x3 + (338*x0/(26*x0^2 + 26*y0^2))*y3 + (-x0^2*y0 - y0^3 + 169*y0)/(26*x0^2 + 26*y0^2), x2 + ((-77228944)/(338*x0^4 + 676*x0^2*y0^2 + 338*y0^4 - 114244*x0^2 - 114244*y0^2 + 9653618))*y2^3*y3 + ((-228488)/(338*x0^2 + 338*y0^2 - 57122))*y2^2 + (456976/(338*x0^2 + 338*y0^2 - 57122))*y2*x3*y3 + (77228944/(338*x0^4 + 676*x0^2*y0^2 + 338*y0^4 - 114244*x0^2 - 114244*y0^2 + 9653618))*y2*y3^3 + (-2)*y2*y3 + 3*x3 + (228488/(338*x0^2 + 338*y0^2 - 57122))*y3^2 - 1/338*x0^2 - 1/338*y0^2 + 1/2, y2^2*x3 + y2^2 - y2*x3*y3 + (1/338*x0^2 + 1/338*y0^2 - 3/2)*y2*y3 + (-1/338*x0^2 - 1/338*y0^2 + 1/2)*x3 + 1/228488*x0^4 + 1/114244*x0^2*y0^2 + 1/228488*y0^4 - 3/676*x0^2 - 3/676*y0^2 + 5/8, y2^2*y3^2 + (-1/338*x0^2 - 1/338*y0^2 + 1/2)*y2*x3*y3 - y2*y3^3 + (1/338*x0^2 + 1/338*y0^2 - 1/2)*y2*y3 + (-1/228488*x0^4 - 1/114244*x0^2*y0^2 - 1/228488*y0^4 + 1/676*x0^2 + 1/676*y0^2 - 1/8)*x3 + (-1/338*x0^2 - 1/338*y0^2 + 1/2)*y3^2 + 1/228488*x0^4 + 1/114244*x0^2*y0^2 + 1/228488*y0^4 - 1/676*x0^2 - 1/676*y0^2 + 1/8, x3^2 + y3^2 - 1]