I have a bunch of implicit algebraic surfaces, and for various combinations of those surfaces, I want to check if the number of intersection points is infinite.

For example, 3 perpendicular cylinders have 8 intersection points.

In[1]:= Solve[x^2 + y^2 == 1 && y^2 + z^2 == 1 && z^2 + x^2 == 1, {x, y, z}, Reals]
Out[1]= {{x -> -(1/Sqrt[2]), y -> -(1/Sqrt[2]), z -> -(1/Sqrt[2])},
         {x -> -(1/Sqrt[2]), y -> -(1/Sqrt[2]), z ->   1/Sqrt[2] },

Whereas 2 cylinders have infinite intersection points.

In[2]:= Solve[x^2 + y^2 == 1 && x^2 + z^2 == 1, {x, y, z}, Reals]
Out[2]= {{y -> ConditionalExpression[-Sqrt[1 - x^2], -1 <= x <= 1], 
          z -> ConditionalExpression[-Sqrt[1 - x^2], -1 <= x <= 1]},

Length and CountDistinct don't help; they get the number of formulas in the list, not the number of solutions described by those formulas.

In[3]:= Solve[x^2 + y^2 == 1 && x^2 + z^2 == 1, {x, y, z}, Reals] // Length
Out[3]= 4

Nor does replacing Solve with Reduce.

I came up with a very hacky method: if FindInstance can find a "large" number of solutions, then guess that there are infinite solutions.

In[4]:= n = 1000;
In[5]:= Length[FindInstance[x^2+y^2-1==0 && y^2+z^2-1==0 && x^2+z^2-1==0, {x,y,z}, Reals, n]] == n
Out[5]= False
In[6]:= Length[FindInstance[x^2+y^2-1==0 && x^2+z^2-1==0, {x,y,z}, Reals, n]] == n
Out[6]= True

But that's unreliable and inefficient. Is there a better way?

  • 2
    $\begingroup$ (1) If you relax the reals requirement you can use NSolve. It will issue a message for solution sets with positive dimension. (2) If you have a bound on the number of solutions in the finite case, e.g. the Bezout bound, then FindInstance providing more solutions than that bound suffices to show the solution set is infinite. $\endgroup$ Oct 13, 2020 at 21:47
  • $\begingroup$ Why does Reduce not help. If the results of reduce are functions of some variables, you know that there are an infinity of solutions. $\endgroup$ Oct 14, 2020 at 12:19
  • $\begingroup$ @DanielLichtblau, (1) That seems to work, thanks! (2) I wasn't aware of Bézout. It looks like it won't help me because not all my polynomials are homogeneous (?) e.g. one of my surfaces is x^2 + y^2 + (z^2 + 1)*(z^4 - 1)/4 == 0. $\endgroup$
    – ppm
    Oct 14, 2020 at 19:02
  • $\begingroup$ @DanielHuber How can I check for functions in the output of Reduce? And is Reduce guaranteed to only output functions in the infinite case? $\endgroup$
    – ppm
    Oct 14, 2020 at 19:03
  • $\begingroup$ Use total degrees. Their product is an upper bound and hence applies in the non-homogeneous case. $\endgroup$ Oct 14, 2020 at 19:07


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Browse other questions tagged or ask your own question.