Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

See this example :

Solve[x^2 == (a - b)^2, x]   (* {{x -> a - b}, {x -> -a + b}} *)

Solve[x^2 == 4 (a - b)^2, x]
 (*{{x -> -2 Sqrt[a^2 - 2 a b + b^2]}, {x -> 2 Sqrt[a^2 - 2 a b + b^2]}}*)

Reduce[x^2 == 4 (a - b)^2, x]
(*x == 2 a - 2 b || x == -2 a + 2 b*)

More complicated,

Solve[{(x - x1)^2 + (y - y1)^2 == (x1 - x2)^2 + (y1 - y2)^2, 
 (x - x2)^2 + (y - y2)^2 == (x1 - x2)^2 + (y1 - y2)^2}, {x,  y}] // FullSimplify

gives $\left\{\left\{x\to \frac{1}{2} \left(\text{x1}+\text{x2}-\sqrt{3} \sqrt{(\text{y1}-\text{y2})^2}\right),y\to \frac{\sqrt{3} (\text{x1}-\text{x2}) \sqrt{(\text{y1}-\text{y2})^2}+\text{y1}^2-\text{y2}^2}{2 (\text{y1}-\text{y2})}\right\},\left\{x\to \frac{1}{2} \left(\text{x1}+\text{x2}+\sqrt{3} \sqrt{(\text{y1}-\text{y2})^2}\right),y\to \frac{\sqrt{3} (\text{x2}-\text{x1}) \sqrt{(\text{y1}-\text{y2})^2}+\text{y1}^2-\text{y2}^2}{2 (\text{y1}-\text{y2})}\right\}\right\}$

but I excepted result is

$\left\{\left\{x\to \frac{\text{x1}}{2}+\frac{\text{x2}}{2}-\frac{\sqrt{3} \text{y1}}{2}+\frac{\sqrt{3} \text{y2}}{2},y\to \frac{\sqrt{3} \text{x1}}{2}-\frac{\sqrt{3} \text{x2}}{2}+\frac{\text{y1}}{2}+\frac{\text{y2}}{2}\right\},\left\{x\to \frac{\text{x1}}{2}+\frac{\text{x2}}{2}+\frac{\sqrt{3} \text{y1}}{2}-\frac{\sqrt{3} \text{y2}}{2},y\to -\frac{\sqrt{3} \text{x1}}{2}+\frac{\sqrt{3} \text{x2}}{2}+\frac{\text{y1}}{2}+\frac{\text{y2}}{2}\right\}\right\}$

both Reduce and FullSimplify can't gives a better result, How can I get the result as I want?

share|improve this question
2  
You can try FullSimplify[ Solve[{(x - x1)^2 + (y - y1)^2 == (x1 - x2)^2 + (y1 - y2)^2, (x - x2)^2 + (y - y2)^2 == (x1 - x2)^2 + (y1 - y2)^2}, {x, y}], Assumptions -> {y1 - y2 > 0}] // Expand. – b.gatessucks Jul 23 '13 at 5:58
up vote 1 down vote accepted
Solve[{(x - x1)^2 + (y - y1)^2 == (x1 - x2)^2 + (y1 - y2)^2, (x - 
           x2)^2 + (y - y2)^2 == (x1 - x2)^2 + (y1 - y2)^2}, {x, y}] //
     Factor // PowerExpand // Simplify // Expand

(*{{x -> x1/2 + x2/2 - (Sqrt[3] y1)/2 + (Sqrt[3] y2)/2, 
  y -> (Sqrt[3] x1)/2 - (Sqrt[3] x2)/2 + y1/2 + y2/2}, {x -> 
   x1/2 + x2/2 + (Sqrt[3] y1)/2 - (Sqrt[3] y2)/2, 
  y -> -((Sqrt[3] x1)/2) + (Sqrt[3] x2)/2 + y1/2 + y2/2}}*)
share|improve this answer

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.