1
$\begingroup$

I have an assumption relating three variables and Simplify (and all functions that use assumptions) seem to take preference on one of these variables. For example:

In[80]:= Assuming[b == -a + c, FullSimplify[a + b + c]]
Assuming[a == -b + c, FullSimplify[a + b + c]]

Out[80]= 2 c

Out[81]= 2 c

Is there a way to force it to eliminate one of these a b c in particular?

$\endgroup$
  • 2
    $\begingroup$ How about using replacement rules instead? Eg a + b + c /. b -> c - a $\endgroup$ – MarcoB Jun 19 '18 at 5:21
  • $\begingroup$ That would work. In fact I think that's what I'll do if no better solution comes. The thing is my example isn't simple like these two lines example; the assumptions are global. So I would have to clear the assumptions and use this replacement at least for this specific calculation. $\endgroup$ – Diego Jun 19 '18 at 22:17
  • $\begingroup$ @Diego what result are you trying to achieve? could you provide more information? $\endgroup$ – roman465 Jun 20 '18 at 20:09
  • $\begingroup$ Force it to eliminate c in favor of a and b, or any other combination $\endgroup$ – Diego Jun 21 '18 at 0:22
1
$\begingroup$

If I understood you right, you can use Eliminate. Since it works with equations only, let x==a+b+cand use the condition b==-a+c to eliminate a, b, or c, so x will be rewritten in terms of other two variables.

In[50]:= Eliminate[{x == a + b + c, b == -a + c}, a] // Solve[#, x] &
Eliminate[{x == a + b + c, b == -a + c}, b] // Solve[#, x] &
Eliminate[{x == a + b + c, b == -a + c}, c] // Solve[#, x] &

Out[50]= {{x -> 2 c}}

Out[51]= {{x -> 2 c}}

Out[52]= {{x -> 2 (a + b)}}

Or you can use replacement rules, as mentioned in comments.

$\endgroup$
  • $\begingroup$ Hah! thanks. That does work. I tried using Eliminate before but couldn't make it work. $\endgroup$ – Diego Jun 21 '18 at 20:04

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.