# coefficients of power series with Laurent series coefficients

I want to be able to pick out the different monomials in a power series ring with coefficient ring Laurent series in another variable (or more). For example:

Q.<q> = LaurentSeriesRing(QQ)
S.<X> = LaurentSeriesRing(Q)
SS.<s> = PowerSeriesRing(S)

U = 1 + 2*X^3*s^4 + 5*q^6*X^7*s^8


What's the best way to extract the different monomials together with their coefficients?

edit retag close merge delete

Reformatted for intelligibility : to quote code, isolate it with blank lines and indent it four spaces (or use the "101010" button).

( 2023-06-01 21:45:07 +0200 )edit

FWIW :

sage: U.list()
[1, 0, 0, 0, 2*X^3, 0, 0, 0, 5*q^6*X^7]


which is consitent with:

sage: U.parent()
Power Series Ring in s over Laurent Series Ring in X over Laurent Series Ring in q over Rational Field


Is that what you want ?

( 2023-06-01 21:47:12 +0200 )edit

Thank you! I always forget "list" and never find it in my documentation searches! Since this list will begin with the power series coefficient of 0, that's easy -- but to get the coefficient of a power of X, I'll need to know where the Laurent series starts. I typically do a zip of exponents and coefficients, but that seems rather clunky. Is there a better way? Thanks again.

( 2023-06-01 22:48:06 +0200 )edit

Try conversion to polynomial via U.polynomial()

( 2023-06-02 14:23:04 +0200 )edit