Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

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?

share|improve this question
add comment

1 Answer

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]
share|improve this answer
    
That solution is excellent, however is there a way to modify the second answer to accept the list of monomials instead of the original polynomial? –  Lee Feb 7 '13 at 5:25
    
Sure, do something like Map[Cases[CoefficientRules[#], v_?VectorQ, 2] &, (* monomials *)]... –  J. M. Mar 23 '13 at 12:34
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.