4

I have a parametric equation like following:

expr = {1/(4 (1 + t^2)^3) - (15 t^2)/(4 (1 + 
          t^2)^3) + (15 t^4)/(4 (1 + t^2)^3) - t^6/(4 (1 + t^2)^3) + 
    3/(4 (1 + t^2)) - (3 t^2)/(4 (1 + 
         t^2)), -((3 t)/(2 (1 + t^2)^3)) + (5 t^3)/(1 + 
        t^2)^3 - (3 t^5)/(2 (1 + t^2)^3) + (3 t)/(2 (1 + 
         t^2)), (2 Sqrt[3] t)/(1 + t^2)^2 - (2 Sqrt[3] t^3)/(1 + 
        t^2)^2};
ParametricPlot3D[expr, {t, -100, 100}, PlotRange -> All]

enter image description here

Now I want to turn this into an implicit equation. So I use GroebnerBasis:

bases = GroebnerBasis[Thread[Equal[{x,y,z},expr]],{},t]

{9 x y - Sqrt[3] z^3, -1 + x^2 + y^2 + z^2}

I can show it with ContourPlot3D:

Show[ContourPlot3D[bases == 0, {x, -1, 1}, {y, -1, 1}, {z, -1, 1}, 
  Mesh -> None], 
 ParametricPlot3D[expr, {t, -100, 100}, PlotRange -> All, 
  PlotStyle -> Directive[Thick, Magenta]]]

enter image description here

This is a very good result. But I cannot understand why GroebnerBasis[Thread[Equal[{x,y,z},expr]],{x,y,z},t] cannot get the same result? And I can't even find the useage of GroebnerBasis[Thread[Equal[{x,y,z},expr]],{},t] in documentation.

As far as I know, the Gröbner Basis of the polynomial idea is unique, but the result returned by the two expressions is obviously not the same ideal. Is there any bug in it?

yode
  • 26,686
  • 4
  • 62
  • 167
  • @RolandF As far as I know, the ideal of a polynomial is unique, how can one be of length 2 and one of length 4? Or do you think there are extra bases in a base of length 4? Doesn't fit the definition of a GroebnerBasis, does it? – yode Aug 19 '23 at 07:30
  • The normal way is Eliminate@Reduce and yields a complete list of special solutions. GroebnerBasis without variables and elimination of "t" treats all symbols as the polynomial variables. Specifying {x,y,z} in eliminations yields more polynomials, the last two beeing identical to the empty list. GroebnerBasis makes random walk that may different on different input. – Roland F Aug 19 '23 at 08:01
  • @RolandF Can you get any results from this code? Eliminate[Thread[Equal[{x,y,z},expr]],t] – yode Aug 19 '23 at 08:40
  • What is the actual question? - "Why ... cannot get the same result?" - Same as what? In what sense the same? You cannot have a single implicit equation of a curve in 3D. All equations in 3 variables represent a surface in 3D (except some degenerate cases). – azerbajdzan Aug 19 '23 at 10:56

3 Answers3

1

The elimination procedure

 expr = {1/(4 (1 + t^2)^3) - (15 t^2)/(4 (1 + t^2)^3) + 
           (15 t^4)/(4 (1 + t^2)^3) - t^6/(4 (1 + t^2)^3) + 
                3/(4 (1 + t^2)) - (3 t^2)/(4 (1 +  t^2)), 
         -((3 t)/(2 (1 + t^2)^3)) + (5 t^3)/(1 + t^2)^3 -
              (3 t^5)/(2 (1 + t^2)^3) + (3 t)/(2 (1 + t^2)), 
         (2 Sqrt[3] t)/(1 + t^2)^2 - (2 Sqrt[3] t^3)/(1 +  t^2)^2};
      expr3 = Simplify[expr]

$$\left\{-\frac{\left(t^2-1\right)^3}{\left(t^2+1\right)^3},\ \ \frac{8 t^3}{\left(t^2+1\right)^3},\ -\frac{2 \sqrt{3} t \left(t^2-1\right)}{\left(t^2+1\right)^2}\right\}$$

        expr4 = Reduce[Thread[expr3=={x,y,z}] 

reduce out

  Eliminate[expr4,{t}]

elimination out

Roland F
  • 3,534
  • 1
  • 2
  • 10
  • Your answer makes sense, but does it explain the strange behavior of the GroebnerBasis? – yode Aug 19 '23 at 10:47
1

GroebnerBasis[Thread[Equal[{x,y,z},expr]],{x,y,z},t] follows the documented usage and gives the correct result.

Let's see a simple example,

expr={t,t^2,t^3};
polys=Thread[Subtract[{x,y,z},expr]];

bases=GroebnerBasis[polys,{},{t}] bases2=GroebnerBasis[polys,{x,y,z},{t}]

PolynomialReduce[#,bases,{x,y,z}]&/@bases2

In this example both give the correct result.

enter image description here

Now let's deform the coefficient slightly,

expr={t,Sqrt[2]t^2,t^3};
polys=Thread[Subtract[{x,y,z},expr]];

bases=GroebnerBasis[polys,{},{t}] bases2=GroebnerBasis[polys,{x,y,z},{t}]

PolynomialReduce[#,bases,{x,y,z}]&/@bases2

enter image description here

Hence we know the Groebner basis bases2=GroebnerBasis[polys,{x,y,z},{t}] is correct in $\mathbb{C}[x,y,z]$

Notice that the Groebner basis is only unique when fixing the order of monomials. I guess the undocumented usage GroebnerBasis[polys,{},{t}] uses some default order and coefficient ring. Or even worse, if the MonomialOrder inherits from the empty argument {}, the result could make no sense.

expr={t,Sqrt[2] t^2,t^3};
polys=Thread[Subtract[{x,y,z},expr]];

bases=GroebnerBasis[polys,{},{t}] bases=GroebnerBasis[polys,{},{t},CoefficientDomain->Rationals] bases=GroebnerBasis[polys,{},{t},CoefficientDomain->RationalFunctions]

enter image description here

Lacia
  • 2,253
  • 3
  • 19
1

Documented or undocumented?

According to the docs(!), GroebnerBasis[Thread[Equal[{x,y,z},expr]],{},t] treats the expressions as polynomials in t with the omitted variables x, y, z treated as "parameter variables." According to the docs, the parameter variables will be inferred from variables missing in the specified variables, if they are not explicitly declared with the ParameterVariables option. The following give the same output:

GroebnerBasis[{x, y, z} - expr, {x, y, z}, t, 
 MonomialOrder -> EliminationOrder]

(* {-1 + x^2 + y^2 + z^2, -3 Sqrt[3] x y + z^3} *)

GroebnerBasis[{x, y, z} - expr, {t, x, y, z}, t, MonomialOrder -> EliminationOrder, ParameterVariables -> {x, y, z}]

(* {-1 + x^2 + y^2 + z^2, -3 Sqrt[3] x y + z^3} *)

The above basis is not the same as but is clearly equivalent to the basis returned in one of the OP's codes:

GroebnerBasis[{x, y, z} - expr, {}, t]

(* {9 x y - Sqrt[3] z^3, -1 + x^2 + y^2 + z^2} *)

As others have mentioned, the basis depends on the ordering. See for instance Monomial Order or google it. Specifying {x, y, z} puts x first, so, for example, the first element of the basis has the lowest degree in x (zero, in this case). If you specify the order {y, z, x}, then the first element of the basis has the lowest degree in y. This is not the only property of a Groebner basis, of course, and it is meant to point out only that the order of the variables makes a difference.

Also, there are (at least) three types of variables, ordinary ones, ones to be eliminated, and parameter variables. And despite the documentation implying that omitted variables are treated like explicitly declared ParameterVariables, it is unclear to me that that is actually true. A possible fourth type of variable are the numeric constants that are not strictly speaking numbers. In the OP's problem, that includes Sqrt[3]. How these types affect the algorithm is unknown to me.

Where the difference turns up

There is an undocumented internal function that can reduce the basis. For instance, GroebnerBasis[{x, y, z} - expr, {}, t] first produces the GroebnerBasis[{x, y, z} - expr, {x, y, z}, t] basis, and then calls the following:

GroebnerBasis`Interreduce[
 {-27 y^2 + 27 y^4 + 27 y^2 z^2 + z^6, -3 Sqrt[3] y + 3 Sqrt[3] y^3 + 
   3 Sqrt[3] y z^2 + x z^3, 9 x y - Sqrt[3] z^3, -1 + x^2 + y^2 + z^2},
 {}, t,
 {CoefficientDomain -> RationalFunctions, Modulus -> 0, 
  MonomialOrder -> Lexicographic, ParameterVariables -> {}, 
  Tolerance -> 0}]

(* {9 x y - Sqrt[3] z^3, -1 + x^2 + y^2 + z^2} *)

Some types of variables:

traceDump1 = Trace[
   GroebnerBasis[{x, y, z} - expr, {}, t],
   TraceInternal -> True];
DeleteDuplicates@
 Cases[traceDump1,
  _Solve`SolvVar | _Solve`ElimVar | _Solve`ParmVar | 
  _Solve`RecipVar | _Solve`RadVar,
  Infinity]
(*
{Solve`ElimVar[t], Solve`RecipVar[1/(1 + Solve`ElimVar[t]^2)], 
 Solve`SolvVar[x], Solve`SolvVar[y], Solve`ParmVar[Sqrt[3]], 
 Solve`SolvVar[z]}
*)

You can see how the variables are tagged. Some of these are eliminated as the given system is converted to a polynomial system (such as RecipVar[]). Note that x, y, and z are not tagged ParmVar[]; but they are if you specify ParameterVariables -> {x, y, z}. It's not clear whether these tags are used in computing the basis or only in preprocessing the input.

The square-root variable

It may be surprising that Sqrt[3] is treated as a variable. For that reason, I wish to point out a couple of things that might not be of central importance to the OP's question. You can include Sqrt[3] in the list of variables. For instance, {x, Sqrt[3], y, z} gives a different Groebner basis than {x, y, z}. If we include it in the variables to be eliminated, the result is disappointing and has the wrong dimension (maybe a bug?):

GroebnerBasis[{x, y, z} - expr, {x, y, z}, {t, Sqrt[3]}]

(* {-1 + 3 x^2 - 3 x^4 + x^6 + 3 y^2 + 21 x^2 y^2 + 3 x^4 y^2 - 3 y^4 + 3 x^2 y^4 + y^6} *)

But I've had trouble with over-eliminating before. If we're going to eliminate two variables, I should start with four equations. But it's hard to get a rational polynomial relation for Sqrt[3] that does not automatically evaluate to 0; for instance Sqrt[3]^2 - 3 does not work. But we can use an indirect method:

GroebnerBasis[
 Join[{x, y, z} - expr, {a - Sqrt[3], a^2 - 3}],
 {x, y, z}, {t, Sqrt[3], a}]

(* {-27 y^2 + 27 y^4 + 27 y^2 z^2 + z^6, -1 + x^2 + y^2 + z^2} *)

Michael E2
  • 235,386
  • 17
  • 334
  • 747
  • How do explain this example: `expr={x,y,z}-{t,Sqrt[2]t^2,t^3};

    GroebnerBasis[expr,{t,x,y,z},{t},ParameterVariables->{x,y,z}] GroebnerBasis[expr,{},{t}]`, which give different results.

    – Lacia Aug 19 '23 at 16:26
  • @Lacia ParameterVariables variables and implicit parameter variables are not treated the same, even though the docs imply they are. (Which I said above: "And despite the documentation implying that omitted variables are treated like explicitly declared ParameterVariables, it is unclear to me that that is actually true.") – Michael E2 Aug 19 '23 at 17:27
  • Thx! I'm quite confused about ParameterVariables. It's mentioned in the option examples but without any detailed explanation. – Lacia Aug 19 '23 at 17:54