13
$\begingroup$

Bug introduced in 13.0 or earlier and fixed in 13.1.0


Let me look at a circle case:

sol = SolveValues[{x1, y1} ∈ Circle[] && {x2, y2} ∈ 
     Circle[{4, 5}, 2] && 
    GeometricTest[{Circle[], 
      InfiniteLine[{{x1, y1}, {x2, y2}}]}, {"Tangent", {x1, y1}}] && 
    GeometricTest[{Circle[{4, 5}, 2], 
      InfiniteLine[{{x1, y1}, {x2, y2}}]}, {"Tangent", {x2, 
       y2}}], {x1, y1, x2, y2}];
Graphics[{Circle[], Circle[{4, 5}, 2], Red, 
  Line /@ ArrayReshape[sol, {4, 2, 2}]}]

enter image description here

I can find the common tangent lines perfect. Then let change the circle into a ellipse:

sol = SolveValues[{x1, y1} ∈ 
     Circle[{0, 0}, {1, 2}] && {x2, y2} ∈ 
     Circle[{4, 5}, {2, 3}] && 
    GeometricTest[{Circle[{0, 0}, {1, 2}], 
      InfiniteLine[{{x1, y1}, {x2, y2}}]}, {"Tangent", {x1, y1}}] && 
    GeometricTest[{Circle[{4, 5}, {2, 3}], 
      InfiniteLine[{{x1, y1}, {x2, y2}}]}, {"Tangent", {x2, 
       y2}}], {x1, y1, x2, y2}];
Graphics[{Circle[{0, 0}, {1, 2}], Circle[{4, 5}, {2, 3}], Red, 
  InfiniteLine /@ ArrayReshape[sol, {4, 2, 2}]}]

enter image description here

Obviously what I found is no longer a tangent. Is this a bug about function GeometricTest? Please help to check..

$\endgroup$

2 Answers 2

19
$\begingroup$

Yep, it's a simple mistake by WRI, that is, a bug.

GeometricTest[{Circle[{x0, y0}, {a, b}], 
  InfiniteLine[{{x1, y1}, {x2, y2}}]}, {"Tangent", {x1, y1}}]
(*
Exists[{C[1]},
     x0 + a*Cos[C[1]] == x1 && 
     y0 + b*Sin[C[1]] == y1 && 
     b (x0 - x1) (x1 - x2) + a (y0 - y1) (y1 - y2) == 0 && 
     a > 0 && b > 0 && 0 <= C[1] <= 2*Pi]
*)

The fourth line

b (x0 - x1) (x1 - x2) + a (y0 - y1) (y1 - y2) == 0

should be (note a^2 and b^2)

b^2 (x0 - x1) (x1 - x2) + a^2 (y0 - y1) (y1 - y2) == 0

There are many ways to fix it, probably. Here's one:

fix = Function[Null, 
   Hold[#] /. 
    Hold[
      GeometricTest[{Circle[p0_, {a_, b_}], 
        InfiniteLine[{p1_, p2_}]}, {"Tangent", 
        p_}]] :> (GeometricTest[{Circle[p0, {a, b}^2], 
         InfiniteLine[{p1, p2}]}, {"Tangent", p}] /. {c_Cos :> c/a, 
        s_Sin :> s/b}),
   HoldAll];
sol = SolveValues[{x1, y1} \[Element] 
     Circle[{0, 0}, {1, 2}] && {x2, y2} \[Element] 
     Circle[{4, 5}, {2, 3}] && 
    fix@GeometricTest[{Circle[{0, 0}, {1, 2}], 
       InfiniteLine[{{x1, y1}, {x2, y2}}]}, {"Tangent", {x1, y1}}] && 
    fix@GeometricTest[{Circle[{4, 5}, {2, 3}], 
       InfiniteLine[{{x1, y1}, {x2, y2}}]}, {"Tangent", {x2, y2}}],
   {x1, y1, x2, y2}];
Graphics[{Circle[{0, 0}, {1, 2}], Circle[{4, 5}, {2, 3}], Red, 
  InfiniteLine /@ ArrayReshape[sol, {4, 2, 2}],
  Blue, Point /@ ArrayReshape[sol, {4, 2, 2}]}]
$\endgroup$
2
  • $\begingroup$ And GeometricTest doesn't work with ImplicitRegion at all. Do you think this is also a bug? $\endgroup$
    – yode
    Commented Jan 4, 2022 at 9:17
  • 3
    $\begingroup$ @yode Since it doesn’t evaluate at all in my single test, I would guess it is unimplemented on implicit regions. The Basic Geometric Objects in the guide Synthetic Geometry do not include any general regions. It’s really a question for WRI whether synthetic geometry will include analytic geometry at some point. Given the direction indicated by the geometric scenes, assertions, and conjectures, I doubt it is easy to make everything work well with arbitrary regions. If you need it, you should ask WRI. $\endgroup$
    – Michael E2
    Commented Jan 4, 2022 at 17:56
1
$\begingroup$

In the 13.1:

sol = SolveValues[{GeometricTest[{Circle[{0, 0}, {1, 2}], 
      InfiniteLine[{{x1, y1}, {x2, y2}}]}, {"Tangent", {x1, y1}}], 
    GeometricTest[{Circle[{4, 5}, {3, 2}], 
      InfiniteLine[{{x1, y1}, {x2, y2}}]}, {"Tangent", {x2, y2}}]}, {x1, y1, x2, y2}, Reals];
Graphics[{Circle[{0, 0}, {1, 2}], Circle[{4, 5}, {3, 2}], Red, 
  InfiniteLine /@ ArrayReshape[sol, {4, 2, 2}]}]

enter image description here

$\endgroup$
4
  • 1
    $\begingroup$ That looks bad. Here is my screenshot from 13.1 wolfram cloud. i.imgur.com/TXneLRp.png $\endgroup$ Commented Oct 13, 2022 at 19:33
  • $\begingroup$ @ВалерийЗаподовников That's...magic..... $\endgroup$
    – yode
    Commented Oct 14, 2022 at 12:53
  • $\begingroup$ Nope. Just bad sibpixel rendering in the windows app or whatever OS you have. $\endgroup$ Commented Oct 15, 2022 at 13:08
  • $\begingroup$ @ВалерийЗаподовников I have just tested several platforms and confirmed that this is indeed a specific bug in Windows $\endgroup$
    – yode
    Commented Oct 16, 2022 at 4:21

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.