3
$\begingroup$

Let's say that I have a polynomial like this:

a + b + c

Is there any way that I can get Mathematica to transform it to:

a*(1 + b/a + c/a)

I found such a manipulation on polynomials very common when deducing equations by hand; however, I have been trying all day and still can not figure out how to make Mathematica do this automatically.

$\endgroup$
2
  • 1
    $\begingroup$ Does tst = a + b + c; a Expand[tst/a] not do what you want? $\endgroup$ Apr 8, 2013 at 11:35
  • $\begingroup$ Oh my god it's so simple. I'm all hooked up on functions like Collect and stuff. Now I just feel stupid. Any way, thanks for this solution. $\endgroup$ Apr 8, 2013 at 11:42

1 Answer 1

5
$\begingroup$

You can try a pattern matching approach (for a bit more advanced users) e.g. :

(a + b + c) /. Plus[c___, x_, b___] :> a Expand[Plus[c, x/a, b]]
a (1 + b/a + c/a)

or simpler :

(a + b + c) /. Plus[x___] :>  a Expand[Plus[x/a]]
$\endgroup$
1
  • $\begingroup$ Thanks, this is actually a better idea. It can be used on the manipulation of complicated expressions. $\endgroup$ Apr 8, 2013 at 12:05

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.