1
$\begingroup$

I have the following expression:

(1 - a) (H - 3 L*r + L)

and I would like to `simplify' this to

(1 - a) (H - L(3 r +1))

I thought that maybe Simplify or Collect could work, but to no avail.

What's the right function to achieve this?

$\endgroup$
1
  • 1
    $\begingroup$ expr = (1 - a) (H - 3 L*r + L); Collect[#, L] & /@ expr $\endgroup$
    – Bob Hanlon
    Feb 2, 2021 at 21:34

1 Answer 1

1
$\begingroup$

You can map HornerForm to each factor:

expr = (1 - a) (H - 3 L*r + L); 

HornerForm /@ expr
(1 - a) (H + L (1 - 3 r))
$\endgroup$

Your Answer

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

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