Many generating series can be expressed as rational functions, and such expressions provide useful information. We illustrate this. First we create a ring of polynomials, and the corresponding field of fractions. (We will not need the latter, as it happens.)

Qu.<u> = QQ[] F = FractionField( Qu) Qu

Univariate Polynomial Ring in u over Rational Field

Now we can work with our series $L(t)$ from the previous section.

rf = (1-2*u+ u^3/(1+u+u^2))^(-1) rf.numerator(), rf.denominator()

(u^2 + u + 1, -u^3 - u^2 - u + 1)

rf.subs( u=1/2)

14

rf.subs( u=t).O(9)

1 + 2*t + 4*t^2 + 7*t^3 + 13*t^4 + 24*t^5 + 44*t^6 + 81*t^7 + 149*t^8 + O(t^9)

Note that `t`

is the generator of `Rt`

, which is $\rats[[t]]$.
So we have used `subs()`

to convert a rational function to
a power series.

We can also compute partial fraction decompositions. For these to be useful the zeros of the denominator should belong to the field we are working over.

Cs = FractionField( PolynomialRing( CDF, 's')) whole, parts = rf.subs(u=Cs.gen()).partial_fraction_decomposition() for p in parts: print p

(-0.618419922319 - 4.81868832957e-17*I)/(s - 0.543689012692) (-0.19079003884 + 0.0187005831117*I)/(s + 0.771844506346 + 1.11514250804*I) (-0.19079003884 - 0.0187005831117*I)/(s + 0.771844506346 - 1.11514250804*I)