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.

Why is there a difference in the output of the following codes?

First:

ClearAll["Global`*"]

a = {0, -m};
b = {-(Sqrt[-2 + m^2]/Sqrt[m]), -m - (-2 + m^2)^2/m};
c = {-1, 1} b;
d = 1024 m (-2 + m^2)^3;
o = {0, 0};

Reduce[{d > 0, EuclideanDistance[a, o] == EuclideanDistance[b, c]}, m]
m == 2 || m == 1 - Sqrt[5] || m == 1 + Sqrt[5]

And then with Reals:

Reduce[{d > 0, EuclideanDistance[a, o] == EuclideanDistance[b, c]}, m, Reals]
m == 2 || m == 1 + Sqrt[5]
share|improve this question
2  
By the way ClearAll; is not a command; try: ClearAll["Global`*"]. The All in ClearAll does not mean all Symbols, but rather all Symbol properties, including Attributes, Default, etc. –  Mr.Wizard Jul 23 '13 at 11:27
4  
My guess would be that, because some subexpression (in particular Sqrt[-2 + m^2] in EuclideanDistance[b, c]) becomes imaginary for the value m == 1 - Sqrt[5], Reduce throws that solution away, even though all variables are real. But because I don't know the internals of Reduce, it's a pure guess ... –  Teake Nutma Jul 23 '13 at 13:03
    
I think @TeakeNutma is right. Change b = {Sqrt[(-2 + m^2)/m],..} and 1 - Sqrt[5] shows up again as a Real solution. –  Michael E2 Jul 23 '13 at 13:51

1 Answer 1

up vote 8 down vote accepted

Try

Reduce[d > 0 && EuclideanDistance[a, o] == EuclideanDistance[b, c] && 
  m \[Element] Reals, m, Complexes]
m == 2 || m == 1 - Sqrt[5] || m == 1 + Sqrt[5]

As from the documentation page of Reduce we have

enter image description here

It seems to me Teake Nutma was right.

share|improve this answer
2  
Well, I wasn't right about this being some undocumented internal behaviour of Reduce. Thankfully some people still know how to read docs :). –  Teake Nutma Jul 23 '13 at 14:34

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.