Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

Is Solve[] very inefficient in solving equations involving square roots?

The input below attempts to find out the explicit expression of either x or y in terms of other variables {x|y, a, c}, and c is the focal length, a is directrix.

F = (Sqrt[(x+c)^2+y^2]-Sqrt[(x-c)^2+y^2]==2a && x>0 && c>0 && a>0 && c>a)

Solve[F,y]

Solve[F,x]

After running on my Acer dual core laptop for over 4 hours this input is still shown in “running” state.

http://reference.wolfram.com/mathematica/ref/Solve.html

“Solve deals primarily with linear and polynomial equations.”

So is the equation above an example that Solve[] works not so well with equations involving square roots (and likely other order roots) ?

share|improve this question
add comment

1 Answer 1

In this case, the main issue is that we should restrict the domain of x and y to be in the real numbers. Therefore, use the following:

Reduce[F, y, Reals]

(*
==> x > 0 && 0 < a <= x && 
 c > a && (y == -Sqrt[((a^4 - a^2 c^2 - a^2 x^2 + c^2 x^2)/a^2)] || 
   y == Sqrt[(a^4 - a^2 c^2 - a^2 x^2 + c^2 x^2)/a^2])
*)

Reduce[F, x, Reals]

(*
==> c > 0 && 0 < a < c && 
 x == Sqrt[(a^4 - a^2 c^2 - a^2 y^2)/(a^2 - c^2)]
*)

It's done in the blink of an eye.

If you prefer, Solve can also do it but gives a different formulation of the answer:

Solve[F, y, Reals]

(*
==> {{y -> 
   ConditionalExpression[-Sqrt[((a^4 - a^2 c^2 - a^2 x^2 + c^2 x^2)/
     a^2)], 0 < a < x && c > a && x > 0]}, {y -> 
   ConditionalExpression[Sqrt[(a^4 - a^2 c^2 - a^2 x^2 + c^2 x^2)/
    a^2], 0 < a < x && c > a && x > 0]}}
*)

Solve[F, x, Reals]

(*
==> {{x -> 
   ConditionalExpression[Sqrt[(a^4 - a^2 c^2 - a^2 y^2)/(
    a^2 - c^2)], (0 < a < c && c > 0 && y > 0) || (0 < a < c && 
       y < 0 && c > 0)]}}
*)
share|improve this answer
    
(Sqrt[(x+a)^2+y^2]-Sqrt[(x-a)^2+y^2]==c&&c>0&&a>0&&c>2a) -Sqrt[(-a+x)^2+y^2]+Sqrt[(a+x)^2+y^2]==c&&c>0&&a>0&&c>2 a Solve[%,x,Reals] {} Reduce[%%,x,Reals] False Thanks very much for your help. I did try your solution , however it worked only ONCE and gave the correct result in "ConditionalExpression"; in all subsequent runnings I got the above. –  JimmyLin Jun 5 '13 at 2:00
    
Reduce[] returns false, and Solve[] returns empty set. I cannot find an apparent error that has caused the failure. The link for the failed notebook file "hyperbola.nb" is here –  JimmyLin Jun 5 '13 at 2:05
    
Dear @user, please do not use answers to post comments to answers; if the comment box is too small, you might consider splitting into two comments, or shortening what you've written. –  J. M. Jun 5 '13 at 2:36
    
Thanks for doing the conversion. –  JimmyLin Jun 5 '13 at 3:40
    
You must have made a mistake, but I can only guess what it is because your syntax is wrong again. Do not use % in Solve, use a name for the equation to be solved and refer to that name in Solve. –  Jens Jun 5 '13 at 4:00
show 1 more comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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