# how to get coefficient list from a polynomial with negative powers

Say a polynomial x^2-x^(-2), I need to extract its coefficient. I tried the command CoefficientList[x^2-x^(-2)], but no result comes out. I am confused why it happens. How can I get the desired result {-1,0,0,0,1}?

It should be an easy question, but I do not know the suitable command. Would you please give me some tips?

## 3 Answers

Would it be OK for you to look separately for the list of coefficients with positive and that with negative powers? If yes, try this. Let us introduce a rule transforming, say, x^-2 into y^2:

rule = Power[x, n_] /; n < 0 -> y^-n;


Here is your polynomial:

p = x^2 - x^(-2);


Now this:

CoefficientList[p /. rule, x] /. y -> 0
CoefficientList[p /. rule, y] /. x -> 0
(* {0, 0, 1}
{0, 0, -1}   *)


gives us the answers separately for positive and negative powers.

Have fun!

• Thank you for your answer! It is ok to separate items with positive and negative powers. But I still wonder why there is no such a direct command to gain coefficients for both items with positive and negative powers:) – Robin_Lyn Nov 16 '18 at 12:14
• It is a general situation. Mma has no all functions that one can wish. In this case, we may write our own functions and use when needed. Taking my idea as a basis you might like to construct such a function. – Alexei Boulbitch Nov 16 '18 at 13:02

Could find the min exponent, then make it an explicit polynomial.

laurentCoefficientList[lpol_, x_] := With[
{min = Exponent[lpol, x, Min]}, CoefficientList[lpol/x^min, x]]

In:= laurentCoefficientList[x^2 - x^(-2), x]

(* Out= {-1, 0, 0, 0, 1} *)


Check your spelling (upper-case L):

CoefficientList[x^2 - x^(-2), x]


From the documentation: "Terms that do not contain positive integer powers of a particular variable are included in the first element of the list for that variable."

• It is a spelling mistake, and is trivial. The question has been updated. – Robin_Lyn Nov 16 '18 at 7:55