Extracting Coefficients and Powers
- To: mathgroup at smc.vnet.net
- Subject: [mg48254] Extracting Coefficients and Powers
- From: "Bruce W. Colletti" <bcolletti at compuserve.com>
- Date: Wed, 19 May 2004 05:20:50 -0400 (EDT)
- Sender: owner-wri-mathgroup at wolfram.com
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? Thanks. Bruce
- Follow-Ups:
- Re: Extracting Coefficients and Powers
- From: Daniel Lichtblau <danl@wolfram.com>
- Re: Extracting Coefficients and Powers