0
$\begingroup$

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?)?

$\endgroup$
3
  • $\begingroup$ Does z represent a positive real number? Does m represent an integer? Is m always positive? Any other assumptions? $\endgroup$ Commented Jun 28, 2024 at 13:35
  • 1
    $\begingroup$ Z should be any complex number different than 0, m and r integers greater than 1 $\endgroup$ Commented Jun 28, 2024 at 15:12
  • $\begingroup$ If formulaA were expressed as a finite sum c_1 z^p1 + ... + c_n z^pn, then it is easy to collect all the coefficients along with powers of z. That is why the first example worked. But your second formulaA is not of this form but contains a factor like (1 - 2 c z^m + z^2m)^(1/r), it impossible to get finite list. $\endgroup$ Commented Jun 30, 2024 at 12:34

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.