MathGroup Archive 1995

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Recombining CoefficientList

  • Subject: [mg2531] Re: [mg2501] Recombining CoefficientList
  • From: hay at haystack.demon.co.uk (Allan Hayes)
  • Date: Thu, 16 Nov 1995 06:46:38 GMT
  • Approved: usenet@wri.com
  • Distribution: local
  • Newsgroups: wri.mathgroup
  • Organization: Wolfram Research, Inc.
  • Sender: daemon at wri.com ( )

sherod at boussinesq.Colorado.EDU (Scott Herod)
in mathgroup at smc.vnet.net
writes

> CoefficientList[poly, {x1,x2,...,xn}] returns an array of
> coefficients of the various powers of the xi in poly.  Has someone 
> got a code segment to recreate poly from the list of xi and the
>output?

Here is a slight modification of tmj  5.3 p24 (In[] and Out[])

ToPolynomial[cl_, vars_] :=
   Plus@@Flatten[
   	MapIndexed[#1 Times@@(vars^(#2-1))&,cl,{Depth[cl]-1}]
   ]

Example:

poly = a x^3 + b x^4 y + c x y + d y^2 + e

          3              4        2
   e + a x  + c x y + b x  y + d y

cl = CoefficientList[poly, {x,y}]

   {{e, 0, d}, {0, c, 0}, {}, {a, 0, 0}, {0, b, 0}}

ToPolynomial[cl, {x,y}]

          3              4        2
   e + a x  + c x y + b x  y + d y


Allan Hayes
hay at haystack.demon.co.uk



  • Prev by Date: Re: Positive[a] = True ???
  • Next by Date: Re: Problems with high-dimensional lists
  • Previous by thread: Re: Recombining CoefficientList
  • Next by thread: Re: Recombining CoefficientList