Re: Split Polynom into Sum of Monomials
- To: mathgroup at smc.vnet.net
- Subject: [mg34098] Re: [mg34072] Split Polynom into Sum of Monomials
- From: "Dr. Reinhard Simonovits" <Reinhard.Simonovits at uni-graz.at>
- Date: Thu, 2 May 2002 03:49:56 -0400 (EDT)
- Sender: owner-wri-mathgroup at wolfram.com
Dear Detlef,
A substitution helps Expand:
In[8]:=
Clear[k];
Expand[(a+b+n+x)*n /.a+b->k ] /.k-> a+b //InputForm
Out[9]//InputForm=
(a + b)*n + n^2 + n*x
Best wishes, Reinhard
>I have the following Problem:
>
>Given a Set of Variables, i.e.
>L = {x,n},
>
>I want transform a given expression, polynomial
>in theese variables, say
>f = (a+b+n+x)*n
>
>into Monomials in the given Variables, here
>
>f = (a+b+n+x)*n -> (a+b) n + n^2 + x n
>
>is desired.
>
>The Problem is, that
>Expand[f, x_ /; MemberQ[L, x]] yields
>
>a n + b n + n^2 + n x
>
>which is "too expanded", while
>
>Collect[f, x_ /; MemberQ[L, x]] yields
>
>n\^2 + n(a + b + x)
>
>But this is "not expanded enough", because
>collect works recursively. So I didn't find
>an implemented Command doing the thing.
>
>(The whole thing is a bit timecritical, large
> polynomials may appear, and the Command will
> be used frequently).
>
>Any Ideas?
>
>Greetings
> Detlef
********************************************
Dr. Reinhard Simonovits
Handelsakademie | Karl Franzens University
Math Department | Inst. of Th. Physics
Grazbachgasse 71 | Universitaetsplatz 5
A-8010 Graz, Austria
Email: Reinhard.Simonovits at uni-graz.at
*********************************************