Ask Your Question
0

solve stuck in infinite loop?

asked 2013-01-11 04:55:47 +0200

user1131467 gravatar image

I enter the following into a freshly built version of sage 5.5...

var('x0 x1 y0 y1 r0 r1 x2 y2')
eq1 = (x2 - x0)^2 + (y2 - y0)^2 == r0^2
eq2 = (x2 - x1)^2 + (y2 - y1)^2 == r1^2
solve([eq1,eq2], x2, y2)

There is no response. It seems like it is stuck in an infinite loop.

Anyone know where I have gone wrong?

edit retag flag offensive close merge delete

Comments

There are many conditions here under which there is no solution. Reformulating this so that you guarantee a solution may resolve the issue.

calc314 gravatar imagecalc314 ( 2013-01-11 08:24:08 +0200 )edit

1 Answer

Sort by ยป oldest newest most voted
0

answered 2013-01-11 11:38:30 +0200

achrzesz gravatar image

updated 2013-01-11 11:54:00 +0200

Perhaps you have too many parameters. Maybe some more concrete approach can be more successful:

var('x2 y2')
Z=[1,2]
for x0 in Z:
  for y0 in Z:
    for x1 in Z:
      for y1 in Z:
        for r0 in Z:
          for r1 in Z:
            eq1 = (x2 - x0)^2 + (y2 - y0)^2 == r0^2    
            eq2 = (x2 - x1)^2 + (y2 - y1)^2 == r1^2
            print solve([eq1,eq2], [x2, y2])
edit flag offensive delete link more

Comments

If this is the approach, I think it's simpler to use `CartesianProduct` (or `itertools.product`)` rather than nesting loops.

DSM gravatar imageDSM ( 2013-01-11 13:18:15 +0200 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

Stats

Asked: 2013-01-11 04:55:47 +0200

Seen: 617 times

Last updated: Jan 11 '13