Re: polynomial operations through CoefficientList

*To*: mathgroup at smc.vnet.net*Subject*: [mg44761] Re: polynomial operations through CoefficientList*From*: "Carl K. Woll" <carlw at u.washington.edu>*Date*: Tue, 25 Nov 2003 00:45:29 -0500 (EST)*Organization*: University of Washington*References*: <bps3jo$9pu$1@smc.vnet.net>*Sender*: owner-wri-mathgroup at wolfram.com

Paolo, For multiplying polynomials, the simplest solution is to use ListConvolve. For example, In[7]:= ListConvolve[cf1, cf2, {1, -1}, 0] Out[7]= {-2, -2 k1 - k3, 4 k2 - k1 k3, 2 k2 k3} For adding polynomials, the simplest solution is to use padding. For example, In[8]:= cf1 + PadRight[cf2, 3] Out[8]= {-1, k1 - k3, -2 k2} Carl Woll "Paolo Bientinesi" <pauldj at cs.utexas.edu> wrote in message news:bps3jo$9pu$1 at smc.vnet.net... > Hello, > does anybody have 2 functions ready to multiply and add > 2 polynomials directly from their CoefficientList's? > > example: the polynomials I'm considering are > p1[x_] := 1 + k1 x - 2 k2 x^2 > p2[x_] := -2 -k3 x > > Given > cf1 = {1,k1,-2 k2} > and > cf2 = {-2,-k3} > > I would like to get the list > {-2,-2 k1-k3,4 k2-k1 k3,2 k2 k3} > for p1[x]*p2[x] > > and the list > {-1,k1-k3,-2 k2} > for p1[x]+p2[x] > > without performing operations like > > CoefficientList[ > cf1.Table[x^i,{i,0,Length[cf1]-1}]* > cf2.Table[x^i,{i,0,Length[cf2]-1}], x] > > Thanks! > -- > Paolo > > pauldj at cs.utexas.edu paolo.bientinesi at iit.cnr.it >