Re: Q: Factor with Polynominals?
- To: mathgroup at smc.vnet.net
- Subject: [mg26784] Re: Q: Factor with Polynominals?
- From: "Allan Hayes" <hay at haystack.demon.co.uk>
- Date: Wed, 24 Jan 2001 04:18:30 -0500 (EST)
- References: <943d4e$chm@smc.vnet.net> <9461cq$gaa@smc.vnet.net> <948rc8$kku@smc.vnet.net> <94gqbh$qsj@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
Here is a technique that works, with little thought, for both of the examples given so far in this thread. poly = (x^2 + y^2)^4 + y (x^2 + y^2) + y; poly2 = 3 x^2 + 3 y^2 + x + y^3 + y x^2; tf[u___ + a_ b_ + v___ + a_ c_ + w___] := u + a(b + c) + v + w; tf[z_] := z; fs = FullSimplify[poly, TransformationFunctions -> {Automatic, tf}, ComplexityFunction -> (Length[#] &) ] y + (x^2 + y^2)*(y + (x^2 + y^2)^3) fs = FullSimplify[poly2, TransformationFunctions -> {Automatic, tf}, ComplexityFunction -> (Length[#] &) ] x + (3 + y)*(x^2 + y^2) -- Allan --------------------- Allan Hayes Mathematica Training and Consulting Leicester UK www.haystack.demon.co.uk hay at haystack.demon.co.uk Voice: +44 (0)116 271 4198 Fax: +44 (0)870 164 0565 "Allan Hayes" <hay at haystack.demon.co.uk> wrote in message news:94gqbh$qsj at smc.vnet.net... > Robert > > poly = Expand[(x^2 + y^2)^4 + y (x^2 + y^2) + y]; > > We can help FullSimplify (please check in HelpBrowser) > > rules = {x^2 + y^2 -> v}; > > tf[u_] := u /. rules; > > fs = FullSimplify[poly, TransformationFunctions -> {Automatic, tf}, > ComplexityFunction -> Length > ] > > y + v*(v^3 + y) > > % /. Reverse /@ rules > > y + (x^2 + y^2)*(y + (x^2 + y^2)^3) > > You might find the the Horner package useful: > > Algebra`Horner` > > -- > Allan > --------------------- > Allan Hayes > Mathematica Training and Consulting > Leicester UK > www.haystack.demon.co.uk > hay at haystack.demon.co.uk > Voice: +44 (0)116 271 4198 > Fax: +44 (0)870 164 0565 > > "Robert" <robert.schuerhuber at gmx.at> wrote in message > news:948rc8$kku at smc.vnet.net... > > thanks for this solution, it works very well in some cases. > > > > but unfortunately this is not exactly the solution i was looking for, > maybe i > > stated the problem unprecise: > > > > i'd like to single out a polynomial from an other (longer polynomial), > e.g. > > > > Expand[(x^2 + y^2)^4 + y (x^2 + y^2)+y] > > > > yields > > > > y+x^2 y+y^3+(x^2+y^2)^4 > > > > with the method suggested by you. > > > > but i would like to get > > > > (x^2+y^2) ((x^2+y^2)^3 + y) + y, > > > > therefore in this example i'd like to single out the polynomial x^2+y^2. > > > > is there a way to do this? > > > > thanks, robert > > > > > > >