0
$\begingroup$

can you help me to return NOT[A==B] for Solve operation. in below code it does not return zP!=14

 Simplify[Solve[
       Exists[{xPP, yPP, zPP}, Element[{x, y, z, xP}, Integers], 
        false == false && xPP == x && yPP == y && 
         zPP == z && ((zPP == 13 && xP == xPP && yP == 67 && 
             zP == zPP) || (Not [zPP == 14] && xP == xPP && yP == 24))]], 
      Element[{x, y, z, xP}, Integers]] /.  ConditionalExpression :> And

Answer:
{{xP -> x, yP -> 24}, {xP -> x, yP -> 67, z -> 13, zP -> 13}}

What I Expect:
{{xP -> x && z!=14, yP -> 24 && z!=14}, {xP -> x, yP -> 67, z -> 13, zP -> 13}}

Now if I use Reduce instead of Solve it will show me, but for some reasons i MUST use solve, if it is possible. Reduce:
x == xP && ((yP == 67 && z == 13 && zP == 13) || (yP == 24 && z != 14))

$\endgroup$
3
  • $\begingroup$ Can you apply Solve to the output of Reduce? $\endgroup$
    – mikado
    Oct 13, 2021 at 7:02
  • 2
    $\begingroup$ Why do you need Solve? The requirement to use only Solve feels like an XY problem ... Do you know ToRules? $\endgroup$
    – Szabolcs
    Oct 13, 2021 at 7:18
  • $\begingroup$ @Szabolcs the reason I need Solve is ; solve returns me x -> a. based on my equations, I need every xP ->.... in a structured way. but reduce returns in various format each time $\endgroup$
    – Azzurro94
    Oct 13, 2021 at 15:09

1 Answer 1

3
$\begingroup$

Making use of the MaxExtraConditions -> All] option, one obtains

Simplify[Solve[Exists[{xPP, yPP, zPP}, Element[{x, y, z, xP}, Integers], 
false == false && xPP == x && yPP == y && 
zPP == z && ((zPP == 13 && xP == xPP && yP == 67 && 
zP == zPP) || (Not[zPP == 14] && xP == xPP && yP == 24))], 
Element[{x, y, z, xP}, Integers], MaxExtraConditions -> All]] /.  
 ConditionalExpression :> And

{{xP -> x && (x | y | z) \[Element] Integers && z != 14 && yP == 24}, {z -> 13 && (x | y) \[Element] Integers && yP == 67 && zP == 13, xP -> x && (x | y) \[Element] Integers && yP == 67 && zP == 13}}

and a warning "Solve::svars: Equations may not give solutions for all "solve" variables."

The command

Simplify[Resolve[Exists[{xPP,yPP,zPP},Element[{x,y,z,xP},Integers],false==false&&xPP==x&&yPP==y&&zPP==z&&((zPP==13&&xP==xPP&&yP==67&&zP==zPP)||(Not[zPP==14]&&xP==xPP&&yP==24))],Element[{x,y,z,xP},Integers]]]/.  ConditionalExpression:>And

produces

(xP | z | y | x) \[Element] Integers && x == xP && ((yP == 24 && z != 14) || (yP == 67 && z == 13 && zP == 13))

without any warning.

$\endgroup$

Your Answer

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

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