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$
4
  • 2
    $\begingroup$ How about using replacement rules instead? Eg a + b + c /. b -> c - a $\endgroup$
    – MarcoB
    Jun 19, 2018 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, 2018 at 22:17
  • $\begingroup$ @Diego what result are you trying to achieve? could you provide more information? $\endgroup$
    – user45937
    Jun 20, 2018 at 20:09
  • $\begingroup$ Force it to eliminate c in favor of a and b, or any other combination $\endgroup$
    – Diego
    Jun 21, 2018 at 0:22

1 Answer 1

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$
1
  • $\begingroup$ Hah! thanks. That does work. I tried using Eliminate before but couldn't make it work. $\endgroup$
    – Diego
    Jun 21, 2018 at 20:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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