1
$\begingroup$

I have a rational funtion of one variable that I know will always have a simple partial fraction decomposition of the form

$$\sum_{n=1}^N\frac{\alpha_n}{z- \beta_n},$$

but I do not know the values of the $\{\alpha_n\}$ or the $\{\beta_n\}$ in advance of doing the partial fraction decomposition, and $N$ can take larger values (say up to 20 or 30). I would like to write a program that automatically puts the $\{\alpha_n\}$ in one list and the $\{\beta_n\}$ in another. Is there a way to do this using the Apart[] output?

$\endgroup$
  • $\begingroup$ It would be useful to have a concrete example, in Mathematica input format. $\endgroup$ – Daniel Lichtblau Nov 10 '18 at 15:48
1
$\begingroup$

Create test case

m = 3;

t = Total[Array[a, m]/(z - Array[b, m])] // Together;

Test function

f = Numerator[t]/Expand[Denominator[t]]

(* (z^2 a[1] + z^2 a[2] + z^2 a[3] - z a[2] b[1] - z a[3] b[1] - z a[1] b[2] - 
   z a[3] b[2] + a[3] b[1] b[2] - z a[1] b[3] - z a[2] b[3] + a[2] b[1] b[3] +
    a[1] b[2] b[3])/(z^3 - z^2 b[1] - z^2 b[2] + z b[1] b[2] - z^2 b[3] + 
   z b[1] b[3] + z b[2] b[3] - b[1] b[2] b[3]) *)

Function to extract terms

pf[func_, var_Symbol] := Module[
  {af = List @@ Apart[func, var]},
  {Numerator /@ af, z - (Denominator /@ af)}]

Check

pf[f, z]

(* {{a[1], a[2], a[3]}, {b[1], b[2], b[3]}} *)
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.