Re: Re: coefficient of a polynomial term
- To: mathgroup at smc.vnet.net
- Subject: [mg59406] Re: [mg59397] Re: coefficient of a polynomial term
- From: Andrzej Kozlowski <akozlowski at gmail.com>
- Date: Mon, 8 Aug 2005 06:17:09 -0400 (EDT)
- References: <dd4em8$hm6$1@smc.vnet.net> <200508080734.DAA03484@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
On 8 Aug 2005, at 09:34, Bhuvanesh wrote: >> There are also undocumented algebra functions whose >> output contains the coefficients of a polynomial, >> for example >> >> s=Internal`DistributedTermsList[poly,{x,y}] >> >> {{{{3, 0}, 1}, {{2, 0}, 2}, {{1, 1}, 3}, {{0, 2}, 4}}, >> {x, y}} >> >> You can extract the coefficients with, for example: >> >> s[[1,All,1]][[All,1]] >> >> {3,2,1,0} >> > > You meant: > > In[1]:= poly = 2 x^2 +3 x*y +4 y^2+x^3; > > In[2]:= s = Internal`DistributedTermsList[poly,{x,y}] > > Out[2]= {{{{3, 0}, 1}, {{2, 0}, 2}, {{1, 1}, 3}, {{0, 2}, 4}}, {x, y}} > > In[3]:= s[[1,All,2]] > > Out[3]= {1, 2, 3, 4} > > The result of DistributedTermsList looks like: > > {{{expvec1,coef1}, {expvec2,coef2}, ...}, variables} > > where "expvec" stands for "exponent vector". There's also the > inverse, which converts the result of DistributedTermsList back to > the explicit polynomial form: > > In[4]:= Internal`FromDistributedTermsList[s] > > 2 3 2 > Out[4]= 2 x + x + 3 x y + 4 y > > Bhuvanesh, > Wolfram Research. > > Thanks. I must have have been affected by insanity (temporary, I hope) when I wrote that last line... Andrzej
- References:
- Re: coefficient of a polynomial term
- From: Bhuvanesh <lalu_bhatt@yahoo.com>
- Re: coefficient of a polynomial term