First, define a function to get an exponent from a factor. If it's a Power
, it's explicit, if it's a numeric quantity, it's 0
, otherwise it's 1
.
getExponent[Power[_, n_]] := n
getExponent[_?NumericQ] := 0
getExponent[_] := 1
Next, deconstruct a product into factors and map getExponent
to the factors. Handle the special case where there's only one factor.
getExponents[product_Times] := getExponent /@ (product /. Times -> List)
getExponents[poly_] := {getExponent[poly]}
Finally, map it to a list of polynomials.
exponentList[polys_List] := getExponents /@ polys
exponentList[{x^3, x^2 (1 + x), x (1 + x)^2, x (1 + x + x^2), (1 + x) (1 + x + x^2), 1 + x^2 + x^3, 1 + x + x^3, (1 + x)^3}]
(* {{3}, {2, 1}, {1, 2}, {1, 1}, {1, 1}, {1}, {1}, {3}} *)
In[314]:= Map[ Rest[FactorList[#]][[All, 2]] &, {x^3, x^2 (1 + x), x (1 + x)^2, x (1 + x + x^2), (1 + x) (1 + x + x^2), 1 + x^2 + x^3, 1 + x + x^3, (1 + x)^3}] Out[314]= {{3}, {2, 1}, {1, 2}, {1, 1}, {1, 1}, {1}, {1}, {3}}
$\endgroup$