Re: Q: Collect, Coefficient, and non-integer exponents [2]
- To: mathgroup at smc.vnet.net
- Subject: [mg8766] Re: [mg8733] Q: Collect, Coefficient, and non-integer exponents [2]
- From: Allan Hayes <hay at haystack.demon.co.uk>
- Date: Sun, 21 Sep 1997 20:51:09 -0400
- Sender: owner-wri-mathgroup at wolfram.com
Sergio,
Here is a development based on Coefficient working for inexact
exponents.
unZip[expr_] :=
Rest[Thread[Rest[
FixedPointList[
{Expand[#1 - #2*x^#3], #2, x^#3} & [
#1, Coefficient[#1, x^#2], #2] & [
#1[[1]], Exponent[#1[[1]], x]] & ,
{expr, 0, 0},
SameTest -> (#2[[1]] === 0 &)
]
]]]
expr = Expand[Sum[(a*n +b*n -c)*x^(n+0.12/n),{n,1,4}]];
unZip[expr]
{{4a + 4b - c, 3a + 3b - c, 2a + 2b - c, a + b - c},
{x^4.03, x^3.04, x^2.06, x^1.12}
}
Check:
Dot@@%
(a + b - c) x^1.12 + (2a + 2b - c) x^2.06 +
(3a + 3b - c) x^3.04 + (4a + 4b - c)x^4.03
expr-%//Expand
0
Allan
Allan Hayes
hay at haystack.demon.co.uk
http://www.haystack.demon.co.uk/training.html
voice:+44 (0)116 2714198
fax: +44 (0)116 2718642
Leicester, UK