# Why is my GroebnerBasis = 0 in this case?

I recently asked a question: Finding Intersections Between Arbitrary Surface and A Line whose solution required me to use the GroebnerBasis function. I successfully applied the solution to several other cases, but am having trouble acquiring a basis for the following parametrization. Essentially, I was trying to find the intersections of an arbitrary surface with a line. The problematic surface is defined as:

M = 0; phi = Pi/2;
t = 1; t2 = 0.5; t3 = 0.35;

b1 = {{-Sqrt/2}, {3/2}};
b2 = {{-Sqrt/2}, {-3/2}};
b3 = {{Sqrt}, {0}};

hx[kx_, ky_] :=
t ((1 + Cos[{kx, ky}.b1] + Cos[{kx, ky}.b2])) +
t3 (2 Cos[{kx, ky}.(b1 + b2)] + Cos[{kx, ky}.(b1 - b2)]);
hy[kx_, ky_] :=
t ((Sin[{kx, ky}.b1] - Sin[{kx, ky}.b2])) +
t3 Sin[{kx, ky}.(b1 - b2)];
hz[kx_, ky_] :=
M - 2  t2 Sin[
phi] (Sin[{kx, ky}.b1] + Sin[{kx, ky}.b2] + Sin[{kx, ky}.b3])
H[kx_, ky_] =
Flatten[{hx[kx, ky], hy[kx, ky], hz[kx, ky]}, 1] // Simplify;


I tried getting a basis using the following:

eqs = Thread[{x, y,
z} == {t ((1 + Cos[{kx, ky}.b1] + Cos[{kx, ky}.b2])) +
t3 (2 Cos[{kx, ky}.(b1 + b2)] + Cos[{kx, ky}.(b1 - b2)]),
t ((Sin[{kx, ky}.b1] - Sin[{kx, ky}.b2])) +
t3 Sin[{kx, ky}.(b1 - b2)],
M - 2  t2 Sin[
phi] (Sin[{kx, ky}.b1] + Sin[{kx, ky}.b2] + Sin[{kx, ky}.b3])}]
impl = GroebnerBasis[Join[TrigExpand[eqs],
{Cos[(Sqrt kx)/2 - 3 ky/2]^2 +
Sin[(Sqrt kx)/2 - 3 ky/2]^2 == 1,
Cos[(Sqrt kx)/2 + 3 ky/2]^2 +
Sin[(Sqrt kx)/2 + 3 ky/2]^2 == 1,
Cos[(Sqrt kx)]^2 + Sin[(Sqrt kx)]^2 == 1,
Cos[(3 ky)]^2 + Sin[(3 ky)]^2 == 1}],
{x, y, z},
{Cos[(Sqrt kx)/2 - 3 ky/2],
Sin[(Sqrt kx)/2 - 3 ky/2],
Cos[(Sqrt kx)/2 + 3 ky/2],
Sin[(Sqrt kx)/2 + 3 ky/2],
Cos[(Sqrt kx)],
Sin[(Sqrt kx)],
Cos[(3 ky)],
Sin[(3 ky)]}][] // FullSimplify


However, I get 0 as the answer, instead of an equation of three variables.

I apologize if this question is too specific, but does anyone see what I am doing wrong? Thanks!

• The reason for the TrigExpand[] is that we are helping GroebnerBasis[] out by making sure all cosines and sines are of the form f[c u] with u being either of kx or ky. So, you should not need to put in something like Cos[(Sqrt kx)/2 - 3 ky/2]^2 + Sin[(Sqrt kx)/2 - 3 ky/2]^2 == 1, and the extra Pythagorean relations you need should be Cos[(Sqrt kx)/2]^2 + Sin[(Sqrt kx)/2]^2 == 1 and Cos[ky/2]^2 + Sin[ky/2]^2 == 1. Oct 17, 2018 at 7:01
• Also: why do you keep setting up b1 and the other ones as $2 \times 1$ matrices? If you set them up as vectors, you wouldn't have to use Flatten[] at the end. Have you seen this? Oct 17, 2018 at 7:18
• @J.M., thank you for the clarification! I think I figured out what's up. The result of impl = -1. + Cos[0.5 ky]^2 + Sin[0.5 ky]^2 is simply 0 with FullSimplify. Do you have any ideas as to how I would solve for intersections in this case? (And thanks for the reference! My biggest excuse is that I started working on this with MATLAB and wasn't efficient with translating to Mathematica, but I need to change this.) Oct 17, 2018 at 18:45
• You may have to wait until I can get to a computer. But, to start you off: look carefully at the forms of the sines and cosines in the result of TrigExpand[]. Pair up what you can with the Pythagorean relation, and add those conditions. Then you can do your Gröbner basis. Oct 17, 2018 at 22:56
• @J.M. thanks for the suggestion. I did that before posting and I think that only those terms in your first expression matter. Oct 18, 2018 at 5:13

Let me show another way to derive implicit Cartesian equations from a given set of parametric equations with trigonometric components. It consists of applying the Weierstrass substitution to the parameters to convert the trigonometric parametrization to a fully algebraic parametrization, which is more easily handled by GroebnerBasis[]. In this specific case, we tweak the substitution a bit to also get rid of the inconvenient Sqrt factor in one of the parameters:

M = 0; φ = π/2;
t = 1; t2 = 1/2; t3 = 35/100;
b1 = {-Sqrt/2, 3/2}; b2 = {-Sqrt/2, -3/2}; b3 = {Sqrt, 0};

eqs = Thread[{x, y, z} ==
TrigExpand[{t ((1 + Cos[{kx, ky}.b1] + Cos[{kx, ky}.b2])) +
t3 (2 Cos[{kx, ky}.(b1 + b2)] + Cos[{kx, ky}.(b1 - b2)]),
t ((Sin[{kx, ky}.b1] - Sin[{kx, ky}.b2])) +
t3 Sin[{kx, ky}.(b1 - b2)],
M - 2 t2 Sin[φ] (Sin[{kx, ky}.b1] + Sin[{kx, ky}.b2] +
Sin[{kx, ky}.b3])} /.
{kx -> 2 ArcTan[u]/Sqrt, ky -> 2 ArcTan[v]}]];


after which, we can do

impl = FullSimplify[First[GroebnerBasis[eqs, {x, y, z}, {v, u}]]]
(729 (-81 + 20 x) (1 + 20 x) + 672400 y^2)^2 ((27 - 20 x)^2 (-81 + 20 x) (-1 + 20 x) +
800 (307 + 80 x (-17 + 5 x)) y^2 + 160000 y^4) + 16 (729 (-27 + 20 x) (1 + 20 x)
(1053847503 + 80 x (-90404019 + 400 x (-1108566 + 740698 x + 95305 x^2))) -
400 (176103072729 + 80 x (-145848451527 + 10 x (36677942019 + 1400 x
(-41368297 + 2626127 x)))) y^2 - 160000 (9061532919 + 280 x (-177361853 + 80353910 x))
y^4 - 1534040256000000 y^6) z^2 + 384160 (499023099 + 4723215840 y^2 +
16 (x (227870091 + 10 x (-130613229 + 40 x (-271883 + 1691815 x))) +
400 x (-1560891 + 684710 x) y^2 + 503462000 y^4)) z^4 +
1475789056 (40 x (-2187 + 3890 x) - 3 (10323 + 38800 y^2)) z^6 + 3543369523456 z^8

ContourPlot3D[impl == 0, {x, -1, 5}, {y, -3, 3}, {z, -3, 3}, PlotPoints -> 45] • Thank you very much for your time and solution! Oct 20, 2018 at 22:26