3
$\begingroup$

I've been using Simplify/FullSimplify to simplify some nasty equations, and by and large it does well but sometimes it rearranges equations in an unhelpful way.

Here's a simple example. Say x is a positive number (standing in for some generally much more complicated factors),

$Assumptions=x>0

I have an equation like

eq = x^2 (a + b - 2 c^2 b) == 0
eq // Simplify
a + b == 2 b c^2

But I don't want it to move terms from the LHS to the RHS, splitting up terms proportional to b. I want them grouped together.

I can use Collect to keep these terms together, but then I have no way of dividing out the x^2. I could use Collect then divide out the x^2 manually, but the terms I'm using x^2 to stand in for are quite unwieldy, and it would be quite laborious to do this case-by-case, especially when Simplify does it right away.

My question: Is there any simple way to take eq and output

a + b - 2c^2 b == 0 
(* or *)
a + (1-2c^2)b ==0

without explicitly specifying that I want to divide out x^2 (since Simplify divides this out automatically)?

$\endgroup$
1
$\begingroup$

What Simplify does is not very well defined. It tries to put expressions in a simpler form, but what is usefully simpler is both subjective and depends on the context. Simplify aims for "smaller" expressions, for some definition of smaller.

Because of the nature of this function the user doesn't have a lot of control over what it does (though it does have a few options).

For this reason I recommend you post-process the result. Your requirement seems to be simple and well-defined: have 0 on one side of the equation. So use this transformation rule:

Simplify[eq] /. lhs_ == rhs_ :> Simplify[lhs - rhs] == 0

Since you'll have zero on one side, you might only want to get the other side, and use

Subtract @@ Simplify[eq]

A fancier way would be

Simplify[ Subtract @@ Simplify[eq], 
   TransformationFunctions -> {Automatic, Last@FactorTermsList[#]& }
]

This allows Simplify to drop any numerical factor from the resulting expression (e.g. a minus sign that might have been introduced by Subtract).

$\endgroup$
  • $\begingroup$ Thanks for these two solutions! To clarify for other users, I've found with the first example that ... should be Simplify[eq], is that right? $\endgroup$ – Adam Mar 5 '14 at 22:57
  • $\begingroup$ @Adam Yes. I actually changed the ... to Simplify[eq] a while ago. If you reload this page, it should show up. $\endgroup$ – Szabolcs Mar 5 '14 at 23:03

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.