# rational functions in Python

I would like use Python to verify the following identities:

• $\frac{1}{1-z} = 1 + z + z^2 + z^3 + \dots$

• $\frac{1}{1-z - z^2} = 1 + z + 2z^2 + 3z^3 + \dots$

• $q \prod_{n \geq 1} (1 - q^n)^{24} = q - 24 q^2 + 252 q^3 + \dots$

The last one could be evaluated by checking the poly1d class in numpy.

Python doesn't seem to have a Laurent series or rational functions capability for the first two examples.

Perhaps there are numerical methods for generating these coefficients very quickly. I am not sure what a good data type for storing series with potentially negative exponents.

Another possibility might be to manipulate generators.

• Do you mean that you want to verify the above equalities for any values of $z$ and $q$ or for specific values? – Dominique Dec 28 '13 at 0:00
• try the web site Wolfram alpha. use the series command. very easy. – Nasser Dec 28 '13 at 6:38