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.

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.

share|improve this question
1  
Does tst = a + b + c; a Expand[tst/a] not do what you want? –  J. M. Apr 8 '13 at 11:35
    
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. –  user2256793 Apr 8 '13 at 11:42
add comment

1 Answer

up vote 3 down vote accepted

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]]
share|improve this answer
    
Thanks, this is actually a better idea. It can be used on the manipulation of complicated expressions. –  user2256793 Apr 8 '13 at 12:05
add comment

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.