3

I am trying to get an exponent vector from a list of monomials. I am using the CoefficientRules command; however, it is returning a list that includes the coefficients of the monomial. I don't need the coefficient and need to remove it before I can use the exponent vector, however I am finding this quite difficult.

poly = x^2 + 2 x*y + y^2;
monomialList = MonomialList[poly];
alpha = CoefficientRules[monomialList]

{{{2, 0} -> 1}, {{1, 1} -> 2}, {{0, 2} -> 1}}

Is there a way to remove the -> and the value that follows it, or a better way to generate the exponent vector?

Sjoerd C. de Vries
  • 65,815
  • 14
  • 188
  • 323
Lee
  • 31
  • 2

1 Answers1

3

One quick method (also used in this answer):

GroebnerBasis`DistributedTermsList[x^2 + 2 x*y + y^2, {x, y}][[1, All, 1]]
   {{2, 0}, {1, 1}, {0, 2}}

Another one, based on this answer:

Cases[CoefficientRules[x^2 + 2 x*y + y^2], v_?VectorQ, 2]
J. M.'s missing motivation
  • 124,525
  • 11
  • 401
  • 574