# How can I get a list of the exponents of a polynomial? [closed]

I have a polynomial 1 + x^2 + x^4 + x^8 + x^9. I want a list of the exponents. {0,2,4,8,9}.

• He is asking for Exponents not coefficients – Enrique Pérez Herrero Dec 27 '15 at 18:06

Try:

  Exponent[1 + x^2 + x^4 + x^8 + x^9, x, List]


Here you go!

Flatten[StringCases[
StringCases["1 + x^2 + x^4 + x^8 + x^9", "x" ~~ __], DigitCharacter]]


Now here is one you can use later:

Flatten[StringCases[
StringCases["polynomial goes here", "variable goes here" ~~ __], DigitCharacter]]

• And where is the 0 ??? – eldo Dec 27 '15 at 22:05
• @eldo sorry, I couldn't figure out how :( – benji b-k Dec 27 '15 at 22:33