Equation with 2 unknowns


I want to automate the process of solving two equations, that they have the same two unknowns.

d= math.sqrt((x1-x2)^2 + (y1-y2)^2)
2d+d2 = math.sqrt((x3-x2)^2 + (y3-y2)^2)

d=50 , x1=30 , y1 = 25
d2=70 , x3 = 60, y3 = 55

I tried with sympy, but I think I have to analyze the equations step by step and make the final replacements of x2,y2 on the initial equations.

Any ideas?

Thank you for your time.

Your equations have eight unknowns, not two:

  • x1, x2, x3
  • y1, y2, y3
  • d, d2

and eight equations. That allows you to substitute values for six of the variables, reduce the set of equations down to two, and eliminate all but two unknowns, :

  1. 50 = sympy.sqrt((40-x2)**2 + (25-y2)**2)
  2. 170 = sympy.sqrt((60-x2)**2 + (55-y2)**2)

I am pretty sure that you have to use sympy.sqrt and not math.sqrt for sympy to be able to solve these.

If that doesn’t help, I suggest you try squaring both sides of each equation, then try again.