MathGroup Archive 2013

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: How can I force mathematica to collect a symbol from a polynomial


Am 09.04.2013 10:04, schrieb syzhaoyu at gmail.com:
> Let's say I have a polynomial:
>            a+b+c
> Is there any way I can force mathematica to produce the following result:
>            a*(1+b/a+c/a)
>
> I think such transformation of polynomials should be very common; however, I have been trying all day and still can not get mathematica to do so automatically.
>

Try this:

FactorOut[pol_, var_] := var*HoldForm@Expand[pol/var] // ReleaseHold

FactorOut[a + b + c, a]
--> a (1 + b/a + c/a)

Collect[Expand[(a + b)^4 (x + y)^3 - (a - b)^4 (x - y)^3],  x | y,
         FactorOut[#, a^Exponent[#, a]] &]

--> a^3 (8 b + (8 b^3)/a^2) x^3 +
     a^4 (6 + (36 b^2)/a^2 + (6 b^4)/a^4) x^2 y +
     a^3 (24 b + (24 b^3)/a^2) x y^2 +
     a^4 (2 + (12 b^2)/a^2 + (2 b^4)/a^4) y^3

etc.

Peter




  • Prev by Date: Re: Reading a file in reverse order --- How?
  • Next by Date: Timing puzzle
  • Previous by thread: Re: How can I force mathematica to collect a symbol from a polynomial
  • Next by thread: Re: How can I force mathematica to collect a symbol from a polynomial