Question: coeff with negative powers

what is the most elegant way to get coefficients of a series that contains negative powers.

for example in this:

tt := a*N__s^3 + N__s + CSxSx__0 + CSxSx__1/N__s + CSxSx__2/N__s^2 + CSxSx__3/N__s^3;

i would like

fancy_coeff(tt, 1/N__s, 3)

to give me `CSxSx__3`


fancy_coeff(tt, 1/N__s, -3)

give me `a`

(the standard coeff call doesn't work with this, as would be known to people here)


Please Wait...