1 | initial version |
You should specify not only an ordering of variables but a monomial ordering or term ordering. An algorithm for the elimination of variables is to choose an elimination ordering, where the variables-to-be-eliminated are greater than all the other variables, then compute a Groebner basis of the ideal with respect to this ordering, and finally select those elements who(se leading terms) do not involve the variables-to-be-eliminated.
In SageMath you would do this (more manually, without the elimination_ideal
method) e.g. by:
sage: R.<cost, sint, cos3t, sin3t, x, y, z, A, B> = PolynomialRing(QQ, 9, order='degrevlex(4),degrevlex(5)')
sage: 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])
sage: [f for f in I.groebner_basis() if not any(v in f.lm().variables() for v in [cost,sint,cos2t,sin2t])]
[z^4*B^2 + 4*x*y^2*A*B^2 + x*z^2*A*B^2 - 2*z^4*A - 4*x*y^2*B^2 - x*z^2*B^2 + 3*z^2*A*B^2 - 2*z^4 - x*A*B^2 - 2*z^2*A + x*B^2 + A*B^2 + 2*z^2 - B^2,
x^2 + y^2 + z^2 - 1,
A^2 + B^2 - 1]
where the chosen monomial ordering degrevlex(4),degrevlex(5)
is a block ordering with two blocks.
The giac documentation for gbasis
suggests it is quite limited in its support for term orderings, so that you are forced to use lexicographic ordering (called plex
in giac), which is an elimination ordering, but one that makes computations huge/slow:
0>> vars := [cost, sint, cos2t, sin2t, x, y, z, A, B];
[cost,sint,cos2t,sin2t,x,y,z,A,B]
// Time 0
1>> sys := [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];
[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]
// Time 0
2>> gbasis(sys,vars,plex)
...
It doesn't finish in reasonable time in giac 1.7.0. You can try a more recent version.