CoefficientList

CoefficientList[p, var] returns the list of coefficients associated with variable var.

Attributes[CoefficientList] := {Protected}

Simple examples

In[1]:= CoefficientList[b + 3*x + 5*x^2, x]
Out[1]= {b, 3, 5}
In[2]:= CoefficientList[5*x^2, x]
Out[2]= {0, 0, 5}
In[3]:= CoefficientList[(a*-1 + x)/(b), x]
Out[3]= {(a)/(b)*-1, (1)/(b)}