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.

  • 1
    $\begingroup$ Does tst = a + b + c; a Expand[tst/a] not do what you want? $\endgroup$ – J. M. will be back soon Apr 8 '13 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$ – user2256793 Apr 8 '13 at 11:42

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]]
  • $\begingroup$ Thanks, this is actually a better idea. It can be used on the manipulation of complicated expressions. $\endgroup$ – user2256793 Apr 8 '13 at 12:05

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.