Message Boards Message Boards

0
|
3015 Views
|
5 Replies
|
1 Total Likes
View groups...
Share
Share this post:

Solve does not finish

Posted 3 years ago

I am calculating the points where a line touches a circle. The following calculation finishes instantaneously:

Solve[{x, y} \[Element] 
    InfiniteLine[{{1/4 (-1 + Sqrt[5]), -(1/2) Sqrt[
        1/2 (5 + Sqrt[5])]}, {1/4 (-1 + Sqrt[5]), 
       1/2 Sqrt[1/2 (5 - Sqrt[5])]}}] && {x, y} \[Element] 
    Circle[{-(1/2), 1/2 Sqrt[5 + 2 Sqrt[5]]}, 1/4 (1 + Sqrt[5])], {x, 
   y}] // FullSimplify

However if I change the second point of the line, the calculation never finishes, and has to be aborted manually. Notice that the only change is a sign in the x-axis of the second point. Geometrically, this is the second tangent to the circle through the first point.

Solve[{x, y} \[Element] 
   InfiniteLine[{{1/4 (-1 + Sqrt[5]), -(1/2) Sqrt[
       1/2 (5 + Sqrt[5])]}, {1/4 (-1 - Sqrt[5]), 
      1/2 Sqrt[1/2 (5 - Sqrt[5])]}}] && {x, y} \[Element] 
   Circle[{-(1/2), 1/2 Sqrt[5 + 2 Sqrt[5]]}, 1/4 (1 + Sqrt[5])], {x, 
  y}]
POSTED BY: Ivan Pavlov
5 Replies

The question which remains is, does it makes sense to file a bug?

I don't know, but it should do no harm to draw the attention of the developers to this.

POSTED BY: Hans Dolhaine

If you use Reduce instead of Solve, it is instantaneous.

POSTED BY: Gianluca Gorni
Posted 3 years ago

Thanks!!

POSTED BY: Ivan Pavlov

I have no idea why the 2nd solution never finishes. But you could of course reformulate your problem in an old fashioned way (avoiding "modern" constructs") and you get - at least on my system - almost immediately more or less complicated answers:

p1 = {1/4 (-1 + Sqrt[5]), -(1/2) Sqrt[1/2 (5 + Sqrt[5])]}
p2 = {1/4 (-1 + Sqrt[5]), 1/2 Sqrt[1/2 (5 - Sqrt[5])]}
p3 = {1/4 (-1 - Sqrt[5]), 1/2 Sqrt[1/2 (5 - Sqrt[5])]}
cc = Circle[{-(1/2), 1/2 Sqrt[5 + 2 Sqrt[5]]}, 1/4 (1 + Sqrt[5])]

l1 = p1 (1 - t1) + p2  t1;
l2 = p1 (1 - t2) + p3 t2;
cc1 = {1/4 (1 + Sqrt[5]) Cos[tau] - 1/2, 
   1/4 (1 + Sqrt[5]) Sin[tau] + 1/2 Sqrt[5 + 2 Sqrt[5]]};

lsg1 = Solve[Thread[cc1 == l1], {tau, t1}]
lsg2 = Solve[Thread[cc1 == l2], {tau, t2}]
lsg1N = NSolve[Thread[cc1 == l1], {tau, t1}]
lsg2N = NSolve[Thread[cc1 == l2], {tau, t2}]
POSTED BY: Hans Dolhaine
Posted 3 years ago

This is a smart change in variables. I did a similar thing to make it work, I changed the circle with another which I know touches at the same point from geometry considerations.

The question which remains is, does it makes sense to file a bug?

POSTED BY: Ivan Pavlov
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract