0
$\begingroup$

The distance from a moving point in the plane to (0,0) is lambda times the distance from (a, 0). And lambda is not equal to 1. Find the equation

Clear["Global`*"]
expr = EuclideanDistance[{0, 0}, {x, 
    y}] == \[Lambda] EuclideanDistance[{a, 0}, {x, y}]
eqn = Assuming[Element[{x, y, a, \[Lambda]}, Reals], Simplify[expr]]
ApplySides[#^2 &, eqn]
eq = ApplySides[#^2 &, eqn] // Simplify
CompleteTheSquare::notquad = 
  "The expression is not quadratic in the variables `1`";
CompleteTheSquare[expr_] := CompleteTheSquare[expr, Variables[expr]]
CompleteTheSquare[expr_, Vars_Symbol] := 
 CompleteTheSquare[expr, {Vars}]
CompleteTheSquare[expr_, Vars : {__Symbol}] := 
 Module[{array, A, B, C, s, vars, sVars}, 
  vars = Intersection[Vars, Variables[expr]];
  Check[array = CoefficientArrays[expr, vars], Return[expr], 
   CoefficientArrays::poly];
  If[Length[array] != 3, Message[CompleteTheSquare::notquad, vars]; 
   Return[expr]];
  {C, B, A} = array; A = Symmetrize[A];
  s = Simplify[1/2 Inverse[A] . B, Trig -> False];
  sVars = Hold /@ (vars + s); A = Map[Hold, A, {2}];
  Expand[A . sVars . sVars] + Simplify[C - s . A . s, Trig -> False] //
    ReleaseHold]
eq /. Equal -> Subtract
CompleteTheSquare[eq /. Equal -> Subtract, {x, y}]
ApplySides[#/Coefficient[%, y^2] &, % == 0]
Assuming[Element[{x, y, a, \[Lambda]}, Reals], Simplify[%]]
CompleteTheSquare[% /. Equal -> Subtract, {x, y}]
% == 0

get the result:

y^2 - (a^2 \[Lambda]^2)/(-1 + \[Lambda]^2)^2 + (x - (
    a \[Lambda]^2)/(-1 + \[Lambda]^2))^2 == 0

How to optimize the code and finally get this result?

y^2 + (x - (a \[Lambda]^2)/(-1 + \[Lambda]^2))^2 == (
 a^2 \[Lambda]^2)/(-1 + \[Lambda]^2)^2
$\endgroup$

1 Answer 1

2
$\begingroup$

Your solution appears to be very extensive.

Here a more direct approach:

 p = {x, y} (* moving point *)
 eq = p . p - (p - {a, 0}) . (p - {a, 0}) \[Lambda] ^2 // Expand //FullSimplify
 (* x^2 + y^2 - ((a - x)^2 + y^2) \[Lambda]^2 *)

Equation describes a conic section. We try to shift x->m+dx to get a symmetrical form(eliminate linaer term dx)

solm = Solve[Coefficient[ eqm, dx] == 0, m][[1]] (* {m -> (a\[Lambda]^2)/(-1 + \[Lambda]^2)} *)

The remaining equation gl describes a circle with radius=(a \[Lambda])/(-1 + \[Lambda]^2) around centre {(a \[Lambda]^2)/(-1 + \[Lambda]^2),0}

gl = Simplify[(deq /. solm)] /  (-1 + \[Lambda]^2) //Collect[#, {dx, y},Simplify] & 
(*-dx^2 - y^2 + (a^2 \[Lambda]^2)/(-1 + \[Lambda]^2)^2*) 

Final form you asked for:

gl /. dx -> (m - x) /. solm
(*-y^2 + (a^2 \[Lambda]^2)/(-1 + \[Lambda]^2)^2 - (-x + (a \[Lambda]^2)/(-1 + \[Lambda]^2))^2*)
$\endgroup$

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.