Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

I have 5(x-1)-(y+1)-(z+1)==0. If I use FullSimplify on it it returns 5x==7+x+y. This is not what I want: I want it to return 5x-y-z==7.

share|improve this question
    
Closely related question: Is is possible to have mathematica move all terms to one side of an equation? –  Jens Jun 1 '12 at 15:45

4 Answers 4

Another option:

expr = 5 (x - 1) - (y + 1) - (z + 1) == 0;
Expand[expr]//.{a_==b:Except[_?NumericQ]:>a-b==0,a___+b_?NumericQ==c_:>Plus@a==c-b}
share|improve this answer

One way is

body = 5 (x - 1) - (y + 1) - (z + 1);
(#[[2]].Variables[body] == -1*#[[1]]) &@
Flatten[Normal@CoefficientArrays[{body == 0}, {x, y, z}], 1]

BR

share|improve this answer

Try this:

eq = 5 (x - 1) - (y + 1) - (z + 1) == 0
Map[Plus[7, #] &, Expand[eq]]

(*  5 x - y - z == 7  *)
share|improve this answer

The following works nicely:

Block[{cf = CoefficientArrays[#]}, Last[cf].Variables[Subtract @@ #] == -First[cf]] &[
       5 (x - 1) - (y + 1) - (z + 1) == 0]
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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