Re: Split Polynom into Sum of Monomials
- To: mathgroup at smc.vnet.net
- Subject: [mg34084] Re: [mg34072] Split Polynom into Sum of Monomials
- From: Daniel Lichtblau <danl at wolfram.com>
- Date: Thu, 2 May 2002 03:49:25 -0400 (EDT)
- References: <200205011200.IAA14744@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
Detlef Mueller wrote: > > Hello, > > 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 Resorting to some undocumented functionality: In[15]:= InputForm[Internal`FromDistributedTermsList[ Internal`DistributedTermsList[f, {n,x}]]] Out[15]//InputForm= (a + b)*n + n^2 + n*x Daniel Lichtblau Wolfram Research
- References:
- Split Polynom into Sum of Monomials
- From: Detlef Mueller <dmueller@mathematik.uni-kassel.de>
- Split Polynom into Sum of Monomials