# Output of Apart as a list?

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?

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

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 + z^2 a + z^2 a - z a b - z a b - z a b -
z a b + a b b - z a b - z a b + a b b +
a b b)/(z^3 - z^2 b - z^2 b + z b b - z^2 b +
z b b + z b b - b b b) *)


Function to extract terms

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


Check

pf[f, z]

(* {{a, a, a}, {b, b, b}} *)