Ask Your Question
0

Compute Groebner Basis of an ideal that includes parameters

asked 2016-04-10 19:53:35 +0100

this post is marked as community wiki

This post is a wiki. Anyone with karma >750 is welcome to improve it.

I'm trying to compute the Groebner Basis of the ideal $$I=\langle f_1,f_2,f_3,f_4,f_5 \rangle$$ in $\mathbb{R}[x_1,y_1,x_2,y_2,x_3,y_3]$, where

$$ f_1=13(x_1+x_1x_2-y_1y_2+(x_1x_2-y_1 y_2)x_3-(y_1 x_2+y_2x_1)y_3)-x_0 $$ $$ f_2=13(y_1+y_1x_2+y_2x_1+(y_1 x_2+y_2x_1)x_3+(x_1x_2-y_1 y_2)y_3)-y_0$$ $$f_3=x_1^2+y_1^2-1$$ $$f_4=x_2^2+y_2^2-1$$ $$f_5=x_3^2+y_3^2-1.$$

$x_1,y_1,x_2,y_2,x_3,y_3$ are real variables and $x_0,y_0$ are some constants. I'm using lex order with $x_1>y_1>x_2>y_2>x_3>y_3$. What I've tried was

sage: R.<x1,y1,x2,y2,x3,y3> = PolynomialRing(QQ, order='lex')
sage: x0,y0 = var('x0,y0')
sage: f1 = 13*(x1+x1*x2-y1*y2+(x1*x2-y1*y2)*x3-(y1*x2+y2*x1)*y3)-x0
sage: f2 = 13*(y1+y1*x2+y2*x1+(y1*x2+y2*x1)*x3+(x1*x2-y1*y2)*y3)-y0
sage: f3 = x1^2+y1^2-1
sage: f4 = x2^2+y2^2-1
sage: f5 = x3^2+y3^2-1
sage: ideal(f1,f2,f3,f4,f5).groebner_basis()

but the output was

---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-8-e03b88a807f0> in <module>()
----> 1 ideal(f1,f2,f3,f4,f5).groebner_basis()

sage/structure/element.pyx in sage.structure.element.Element.__getattr__ (/usr/lib/sagemath//src/build/cythonized/sage/structure/element.c:4675)()

sage/structure/misc.pyx in sage.structure.misc.getattr_from_other_class (/usr/lib/sagemath//src/build/cythonized/sage/structure/misc.c:1771)()

AttributeError: 'Ideal_generic' object has no attribute 'groebner_basis'

What can I do?

edit retag flag offensive close merge delete

Comments

@ilgk: in general, only tick the "community wiki" box for "meta" questions (questions about the design of the Ask Sage website).

slelievre gravatar imageslelievre ( 2016-04-11 13:13:29 +0100 )edit

2 Answers

Sort by ยป oldest newest most voted
0

answered 2016-04-11 15:30:53 +0100

tmonteil gravatar image

updated 2016-04-11 18:14:23 +0100

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.

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 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 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 ...
(more)
edit flag offensive delete link more
0

answered 2016-04-11 16:30:43 +0100

nbruin gravatar image

The usual solution for groebner bases is to just throw the variables in the ring:

sage: R.<x1,y1,x2,y2,x3,y3,x0,y0> = PolynomialRing(QQ, order='lex')

It may be worth experimenting a little with what weight you want to give these variables, but probably a low weight (as above) is good: they are parameters to you, so you don't care to what degree they occur. In particular, they shouldn't be eliminated anywhere at the cost of letting other variables occur to higher degrees.

This is usually enough to get what you want, but it's not the same as having x0,y0 invertible. If you really want to work in the polynomial ring over the fraction field of QQ[x0,y0], then you can write

sage: R.<x1,y1,x2,y2,x3,y3,x0i,y0i,x0,y0> = PolynomialRing(QQ, order='lex')

and add the relations x0*x0i-1, y0*y0i-1 to your ideal.

You may want to experiment with variable ordering to see which gives you the best result (if you have to freedom to choose anything else then lexicographic)

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

2 followers

Stats

Asked: 2016-04-10 19:53:35 +0100

Seen: 1,557 times

Last updated: Apr 11 '16