Problem
I want to generalize a solution I already have for a simpler situation. In my case I need to collect coefficients from a variable assuming fractional powers and on. First I'll present some context and after that I'll show you my struggle.
Context
I have a code alre
ady working in a simple situation. Maybe that's not the more precise way of doing it but it does what needs to be done.
First, considering that
formulaA= 9 - 20 c z^2 + (15 + 16 c^2) z^4 -
20 c z^6 - (9 + 6 z^4 + 16 c^2 z^4 + 9 z^8 - 20 c (z^2 + z^6)) P[c];
Coefficient[formulaA,P[c],1]//FullSimplify
CoefficientList[%,z]//FullSimplify
I get:
-9 - 6 z^4 - 16 c^2 z^4 - 9 z^8 + 20 c (z^2 + z^6)`
{-9, 0, 20 c, 0, -2 (3 + 8 c^2), 0, 20 c, 0, -9}
as expected.
So what I want is this last list of coefficients of powers of z.
The struggle
Now, formulaA is way more complicated. The variable z will have different powers, fractional powers sometimes and more, it could have variables as powers! Look at that:
formulaA= (-r (1 - 2 c z^m + z^(2 m)))^(1/
r) (2 m (2 m (-1 + r) - r) (1 + r) z^(3 m) (-c + z^m) +
z^((2 (m + r))/
r) ((-1 + 2 m) r (2 m + r) +
2 c r (2 r + m (3 - 5 r + m (-5 + 2 r))) z^
m + ((-1 + 2 m) r (2 m + r) +
4 c^2 (m + r) (-r + m (-1 + 2 r))) z^(2 m) -
2 c (r + m (2 + r)) (-r + m (-1 + 2 r)) z^(3 m))) + (-1)^(1/r)
r^(1/r) z (z^m)^(1/m + 2/r) (1 - 2 c z^m + z^(2 m))^(1/
r) (-2 m (-1 + r) r (1 - 2 c z^m + z^(2 m))^2 +
r^2 (1 - 2 c z^m + z^(2 m))^2 +
2 m^2 (-2 r + c (-2 + 5 r) z^m -
2 (-1 + r + c^2 (-1 + 2 r)) z^(2 m) + c (-2 + 5 r) z^(3 m) -
2 r z^(4 m))) P[c]
When proceeding in the way I already did it is not enough.
(-1)^(1/r) r^(1/r) z (z^m)^(
1/m + 2/r) (1 - 2 c z^m + z^(
2 m))^(1/r) (-2 m (-1 + r) r (1 - 2 c z^m + z^(2 m))^2 +
r^2 (1 - 2 c z^m + z^(2 m))^2 +
2 m^2 (-2 r + c (-2 + 5 r) z^m -
2 (-1 + r + c^2 (-1 + 2 r)) z^(2 m) + c (-2 + 5 r) z^(3 m) -
2 r z^(4 m)))
(-1)^(1/r) r^(1/r) z (z^m)^(
1/m + 2/r) (1 - 2 c z^m + z^(
2 m))^(1/r) (-2 m (-1 + r) r (1 - 2 c z^m + z^(2 m))^2 +
r^2 (1 - 2 c z^m + z^(2 m))^2 +
2 m^2 (-2 r + c (-2 + 5 r) z^m -
2 (-1 + r + c^2 (-1 + 2 r)) z^(2 m) + c (-2 + 5 r) z^(3 m) -
2 r z^(4 m)))
How can I create a list, that will group factors of the same power of z and more, in a way that it is possible to know which power it is (I mean, this factors are factors of who?)?
zrepresent a positive real number? Doesmrepresent an integer? Ismalways positive? Any other assumptions? $\endgroup$