0
$\begingroup$

Reduce[{x == z, y == z}] gives y == z && x == z but say I'm only interested in constraints that appear between x and y.

The desired result of this hypothetical reduce would be. x==y. Don't know if it helps, but I'm only working with equalities.

$\endgroup$
4
  • 3
    $\begingroup$ There's undocumented syntax for that specific case: Reduce[{x == z, y == z}, {x, y}, z]. $\endgroup$
    – J. M.'s torpor
    Apr 17 '20 at 3:33
  • $\begingroup$ Eliminate[{x == y, y == z}, z] $\endgroup$
    – wuyudi
    May 17 '20 at 4:18
  • $\begingroup$ @J.M. As with Solve, it's best practice to put the eliminated variable(s) in braces, to tell MMA that it's not a domain specification, e.g., Reduce[{x == z, y == z}, {x, y}, {z}]. $\endgroup$
    – theorist
    Jun 11 at 14:19
  • $\begingroup$ @theorist, yes, that's a recent development. $\endgroup$
    – J. M.'s torpor
    Jun 13 at 15:27
1
$\begingroup$
Clear["Global`*"]

With Solve you can specify a list of variables to be eliminated. The list brackets are required even for a single variable to preclude interpretation as an attempt to specify a domain specification.

Solve[{x == z, y == z}, y, {z}][[1]]

(* {y -> x} *)

% /. Rule -> Equal

(* {y == x} *)
$\endgroup$
2
  • $\begingroup$ Is this documented? Where to find? $\endgroup$
    – Acus
    Jun 11 at 8:19
  • $\begingroup$ @Acus - It is an outdated capability that still works (presumably for backward compatibility). See Version 7 "Solve[eqns, vars, elims] attempts to solve the equations for vars, eliminating the variables elims." There are other uses of it on this forum. $\endgroup$
    – Bob Hanlon
    Jun 11 at 11:25
0
$\begingroup$

Eliminate seems to do the job, but dosent work well when the resulting constraint should be an inequality (for example y==x*x, eliminating x, I would like to get y>=0. The operation Resolve with Exists over the unwanted variables and Reals as domain should get the correct answer, the downside being that quantifier elimination might be computationally expensive.

$\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.