# Expand expression into quotient of negative power series

I have a function T(z)

and want to expand it to the following form:

At the end I want to have a list of equations, which can calculate a0, a1, a2, b0, b1 and b2 with different values of h1, h2, w01, w02 and T. The variable z does not matter.

In the code I replaced T(z) with f to not get confused.

f = (((1 - z^-1)/(1 + z^-1))^2 + 2*h1*Tan[(w1*T)/2]*((1 - z^-1)/(1 + z^-1)) + (Tan[(w1*T)/2])^2)/(((1 - z^-1)/(1 + z^-1))^2 + 2*h2*Tan[(w2*T)/2]*((1 - z^-1)/(1 + z^-1)) + (Tan[(w2*T)/2])^2)


At first I tried to expand f with the Mathematica-fuction Series in the way it is described here: How to expand a function into a power series with negative powers?

Series[f, {z, Infinity, 2}]


But the result is not what I need.

(2 h1 tan((T w1)/2)+tan^2((T w1)/2)+1)/(2 h2 tan((T w2)/2)+tan^2((T w2)/2)+1)+((-4 h1 tan((T w1)/2)-4)/(2 h2 tan((T w2)/2)+tan^2((T w2)/2)+1)+(4 (2 h1 tan((T w1)/2)+tan^2((T w1)/2)+1) (h2 tan((T w2)/2)+1))/(2 h2 tan((T w2)/2)+tan^2((T w2)/2)+1)^2)/z+((4 (2 h1 tan((T w1)/2)+tan^2((T w1)/2)+1) (2 h2^2 tan^2((T w2)/2)-h2 tan^3((T w2)/2)+3 h2 tan((T w2)/2)-2 tan^2((T w2)/2)+2))/(2 h2 tan((T w2)/2)+tan^2((T w2)/2)+1)^3+(4 h1 tan((T w1)/2)+8)/(2 h2 tan((T w2)/2)+tan^2((T w2)/2)+1)+(4 (-4 h1 tan((T w1)/2)-4) (h2 tan((T w2)/2)+1))/(2 h2 tan((T w2)/2)+tan^2((T w2)/2)+1)^2)/z^2+O((1/z)^3)


I would like to have, more or less, one polynomial series in the enumerator and a second in the denominator.

Thank you.

• If my answer is along the lines of what you seek, you might consider changing the word "series" to "polynomial." Apr 19, 2014 at 17:44

There isn't a unique answer, especially if (infinite) series are used. But if, as the example formula indicates, you want a polynomial in 1/z, then the result is unique up to multiplying the numerator and denominator by a scalar factor.

Divide @@ Map[
Collect[Factor @ #, u] &,
(1 + u)^2 Through[{Numerator, Denominator}[f /. z -> 1/u]]
] /. u -> 1/z


Or perhaps simply this:

Simplify[f /. z -> 1/u] /. u -> 1/z


Since Numerator@f == (Denominator@f /. {h2 -> h1, w2 -> w1}) it should be suficient to have only the series decomposition of the numerator, no? Or are you aiming for something else? Series[Numerator@f, {z, 0, 2}]