Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

How to reproduce `elimination_ideal` with Giac ?

Hello,

I have the following parametric equations, where cost$=\cos t$, cos2t$=\cos 2t$, and $A^2+B^2=1$: x = A*cost*cos2t - sint*sin2t, y = A*sint*cos2t + cost*sin2t, z = B*cos2t I want to transform this system into an implicit equation with the help of Gröbner bases. In the Sage software, I do:

R.<x, y, z, A, B, cost, sint, cos2t, sin2t> = PolynomialRing(QQ, 9); I = R.ideal([x - A*cost*cos2t + sint*sin2t, y - A*sint*cos2t - cost*sin2t, z - B*cos2t, A^2 + B^2 - 1, cost^2 + sint^2 - 1, cos2t - cost^2 + sint^2, sin2t - 2*sint*cost]); I.elimination_ideal([cost, sint, cos2t, sin2t])

Sage fastly returns three polynomials (including A^2+B^2-1).

Now I want to do it with Xcas/Giac (Xcas is the graphical interface to Giac). The Gröbner implicitization is not implemented, only Gröbner bases. So I request the Gröbner basis for: x - A*cost*cos2t + sint*sin2t, y - A*sint*cos2t - cost*sin2t, z - B*cos2t, A^2 + B^2 - 1, cost^2 + sint^2 - 1, cos2t - cost^2 + sint^2, sin2t - 2*sint*cost with the variables (the order is important) cost, sint, cos2t, sin2t, A, B, x, y, z.

That works for this example, i.e. I get a polynomial not involving cost and sint.

But now, if I replace cos2t with cos3t and sin2t with sin3t (and I adapt the trig identities), that does not work. I don't get any equation not involving cost and sint, except the trivial ones (A^2+B^2=1 and x^2+y^2+z^2=1).

So I'm wondering how Sage works, because it works in Sage. I have Cox & al's book but they don't explain how to proceed when there are relations among the variables (such as cos2t = cost^2 - sint^2, sin2t = 2*sint*cost) and constant parameters (A and B). What is the Gröbner basis I should request in order to get the same result as Sage, with which order among the variables and which order of the equations?

The Sage code for this second example is:

R.<x, y, z, A, B, cost, sint, cos3t, sin3t> = PolynomialRing(QQ, 9); I = R.ideal([x - A*cost*cos3t + sint*sin3t, y - A*sint*cos3t - cost*sin3t, z - B*cos3t, A^2 + B^2 - 1, cost^2 + sint^2 - 1, cos3t - 4*cost^3+3*cost, sin3t - (4*cost^2-1)*sint]); I.elimination_ideal([cost, sint, cos3t, sin3t])

How to reproduce `elimination_ideal` with Giac ?

Hello,

I have the following parametric equations, where cost$=\cos t$, cos2t$=\cos 2t$, and $A^2+B^2=1$: x = A*cost*cos2t - sint*sin2t, y = A*sint*cos2t + cost*sin2t, z = B*cos2t I want to transform this system into an implicit equation with the help of Gröbner bases. In the Sage software, I do:

R.<x, y, z, A, B, cost, sint, cos2t, sin2t> = PolynomialRing(QQ, 9); I = R.ideal([x - A*cost*cos2t + sint*sin2t, y - A*sint*cos2t - cost*sin2t, z - B*cos2t, A^2 + B^2 - 1, cost^2 + sint^2 - 1, cos2t - cost^2 + sint^2, sin2t - 2*sint*cost]); I.elimination_ideal([cost, sint, cos2t, sin2t])

Sage fastly returns three polynomials (including A^2+B^2-1).

Now I want to do it with Xcas/Giac (Xcas is the graphical interface to Giac). The Gröbner implicitization is not implemented, only Gröbner bases. So I request the Gröbner basis for: x - A*cost*cos2t + sint*sin2t, y - A*sint*cos2t - cost*sin2t, z - B*cos2t, A^2 + B^2 - 1, cost^2 + sint^2 - 1, cos2t - cost^2 + sint^2, sin2t - 2*sint*cost with the variables (the order is important) cost, sint, cos2t, sin2t, A, B, x, y, z.

That works for this example, i.e. I get a polynomial not involving cost and sint.

But now, if I replace cos2t with cos3t and sin2t with sin3t (and I adapt the trig identities), that does not work. I don't get any equation not involving cost and sint, except the trivial ones (A^2+B^2=1 and x^2+y^2+z^2=1).

So I'm wondering how Sage works, because it works in Sage. I have Cox & al's book but they don't explain how to proceed when there are relations among the variables (such as cos2t = cost^2 - sint^2, sin2t = 2*sint*cost) and constant parameters (A and B). What is the Gröbner basis I should request in order to get the same result as Sage, with which order among the variables and which order of the equations?

The Sage code for this second example is:

R.<x, y, z, A, B, cost, sint, cos3t, sin3t> = PolynomialRing(QQ, 9); I = R.ideal([x - A*cost*cos3t + sint*sin3t, y - A*sint*cos3t - cost*sin3t, z - B*cos3t, A^2 + B^2 - 1, cost^2 + sint^2 - 1, cos3t - 4*cost^3+3*cost, sin3t - (4*cost^2-1)*sint]); I.elimination_ideal([cost, sint, cos3t, sin3t])


Edit

The Giac code which does not work is:

gbasis([x - a*cost*(4*cost^3-3*cost) + sint*(4*cost^2-1)*sint, y - a*sint*(4*cost^3-3*cost) - cost*(4*cost^2-1)*sint, z - b*(4*cost^3-3*cost), cost^2 + sint^2 - 1, a^2 + b^2 - 1], [cost, sint, x, y, z, a, b])

But if you replace a and b with numeric values, e.g. a=3/5 and b = 4/5, it works.

click to hide/show revision 3
retagged

How to reproduce `elimination_ideal` with Giac ?

Hello,

I have the following parametric equations, where cost$=\cos t$, cos2t$=\cos 2t$, and $A^2+B^2=1$: x = A*cost*cos2t - sint*sin2t, y = A*sint*cos2t + cost*sin2t, z = B*cos2t I want to transform this system into an implicit equation with the help of Gröbner bases. In the Sage software, I do:

R.<x, y, z, A, B, cost, sint, cos2t, sin2t> = PolynomialRing(QQ, 9); I = R.ideal([x - A*cost*cos2t + sint*sin2t, y - A*sint*cos2t - cost*sin2t, z - B*cos2t, A^2 + B^2 - 1, cost^2 + sint^2 - 1, cos2t - cost^2 + sint^2, sin2t - 2*sint*cost]); I.elimination_ideal([cost, sint, cos2t, sin2t])

Sage fastly returns three polynomials (including A^2+B^2-1).

Now I want to do it with Xcas/Giac (Xcas is the graphical interface to Giac). The Gröbner implicitization is not implemented, only Gröbner bases. So I request the Gröbner basis for: x - A*cost*cos2t + sint*sin2t, y - A*sint*cos2t - cost*sin2t, z - B*cos2t, A^2 + B^2 - 1, cost^2 + sint^2 - 1, cos2t - cost^2 + sint^2, sin2t - 2*sint*cost with the variables (the order is important) cost, sint, cos2t, sin2t, A, B, x, y, z.

That works for this example, i.e. I get a polynomial not involving cost and sint.

But now, if I replace cos2t with cos3t and sin2t with sin3t (and I adapt the trig identities), that does not work. I don't get any equation not involving cost and sint, except the trivial ones (A^2+B^2=1 and x^2+y^2+z^2=1).

So I'm wondering how Sage works, because it works in Sage. I have Cox & al's book but they don't explain how to proceed when there are relations among the variables (such as cos2t = cost^2 - sint^2, sin2t = 2*sint*cost) and constant parameters (A and B). What is the Gröbner basis I should request in order to get the same result as Sage, with which order among the variables and which order of the equations?

The Sage code for this second example is:

R.<x, y, z, A, B, cost, sint, cos3t, sin3t> = PolynomialRing(QQ, 9); I = R.ideal([x - A*cost*cos3t + sint*sin3t, y - A*sint*cos3t - cost*sin3t, z - B*cos3t, A^2 + B^2 - 1, cost^2 + sint^2 - 1, cos3t - 4*cost^3+3*cost, sin3t - (4*cost^2-1)*sint]); I.elimination_ideal([cost, sint, cos3t, sin3t])


Edit

The Giac code which does not work is:

gbasis([x - a*cost*(4*cost^3-3*cost) + sint*(4*cost^2-1)*sint, y - a*sint*(4*cost^3-3*cost) - cost*(4*cost^2-1)*sint, z - b*(4*cost^3-3*cost), cost^2 + sint^2 - 1, a^2 + b^2 - 1], [cost, sint, x, y, z, a, b])

But if you replace a and b with numeric values, e.g. a=3/5 and b = 4/5, it works.