0
$\begingroup$

Consider the following code :

$Assumptions = 
 p >= 0 && p <= 1 && Theta > 0 && Phi >= 0 && Phi <= 2*Pi

(* p >= 0 && p <= 1 && Theta > 0 && Phi >= 0 && Phi <= 2 \[Pi] *)

equations = {(1 - p)^3 == 3*p^2 (1 - p), (1 - p)^3 == 3*(1 - p)^2*p, 
   p^3 == 3*p^2 (1 - p), p^3 == 3*(1 - p)^2*p};

Simplify[Solve[#1, p] & /@ equations]

(* {{{p -> 1}, {p -> 1/2 (-1 - Sqrt[3])}, {p -> 
    1/2 (-1 + Sqrt[3])}}, {{p -> 1/4}, {p -> 1}, {p -> 1}}, {{p -> 
    0}, {p -> 0}, {p -> 3/4}}, {{p -> 0}, {p -> 
    1/2 (3 - Sqrt[3])}, {p -> 1/2 (3 + Sqrt[3])}}} *)

FullSimplify[Solve[#1, p] & /@ equations]

(* {{{p -> 1}, {p -> 1/2 (-1 - Sqrt[3])}, {p -> 
    1/2 (-1 + Sqrt[3])}}, {{p -> 1/4}, {p -> 1}, {p -> 1}}, {{p -> 
    0}, {p -> 0}, {p -> 3/4}}, {{p -> 0}, {p -> 
    1/2 (3 - Sqrt[3])}, {p -> 1/2 (3 + Sqrt[3])}}} *)

As you can see, my $Assumptions is not taken in account after my Solve, either I do use Simplify or FullSimplify.

Indeed, the second solution for $p$ is $1/2 (-1-\sqrt{3})$ which is negative.

Where is the problem here ?

$\endgroup$
  • $\begingroup$ In the above, p is nowhere equal to 1/2(-1-Sqrt[3]). There is simply a rule to replace p by that value. A standard way to achieve the desired result is via Select: In[164]:= solns = Flatten[Solve[#1, p] & /@ equations]; goodsolns = Select[solns, With[{p = p /. #}, p >= 0 && p <= 1] &] Out[165]= {p -> 1, p -> 1/2 (-1 + Sqrt[3]), p -> 1/4, p -> 1, p -> 1, p -> 0, p -> 0, p -> 3/4, p -> 0, p -> 1/2 (3 - Sqrt[3])} $\endgroup$ – Daniel Lichtblau Jan 10 at 16:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.