MathGroup Archive 2004

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

Search the Archive

Extracting Coefficients and Powers

  • To: mathgroup at
  • Subject: [mg48254] Extracting Coefficients and Powers
  • From: "Bruce W. Colletti" <bcolletti at>
  • Date: Wed, 19 May 2004 05:20:50 -0400 (EDT)
  • Sender: owner-wri-mathgroup at

I have a sum of terms, each of the form "a * x^r" or "a * 1/x^r", where 
a and (positive) r are real numbers (if a is missing, it's presumably 1 
or -1 and if there is no x-term, r is understood to be 0). 

In my application, the complete expression is given by Expand[p], where 
p is a product of terms having form a t^b + c t^d (p is actually a 
factorial moment generating function).

I want to extract all coefficients into a list (including 1 or -1 
coefficients), and exponents into another (to include 0 for any constant 
term).  For instance,

x^3.2 + 5 - 3 / x^5.2 - x^5

yields the coefficients' list {1, 5, -3, -1} and exponents' list {3.2, 
0, -5.2,5}.

How would I build these lists?  Must Cases[ ] be used or are there 
built-in functions?



  • Prev by Date: RE: Searching algorithm
  • Next by Date: RE: solving implicit function with symbolic expressions
  • Previous by thread: Re: From C/C++ to Mathematica?--> MathLink programs in C for Windows
  • Next by thread: Re: Extracting Coefficients and Powers