Mathematica Stack Exchange is a question and answer site for users of Mathematica. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a polynomial in x and y. I want to keep all the terms with (combined) degree 4. Any pointers will be appreciated. Simple tricks for doing the same with univariate polynomial don't seem to work.

share|improve this question
PolynomialReduce[(poly/.Thread[vars->t*vars],t^5][[2]]/.t->1 – Daniel Lichtblau Feb 7 '14 at 22:53
@DanielLichtblau - I'd like to understand that but the syntax is a bit off (unbalanced parentheses and PolyReduce wants three args). Can you correct it?.. – george2079 Feb 7 '14 at 23:41
note the subject says "up to" while the question says "combined degree 4" .. which do you want? – george2079 Feb 7 '14 at 23:50
@george2079 If you remove the lparen and don't worry too much about the missing 3rd argument it should work out better. – Daniel Lichtblau Feb 8 '14 at 0:08
Ok.. for those who cant stand the front end sticking a red mark in their code the third arg should be a t .. – george2079 Feb 10 '14 at 17:25
p = Total@Flatten@Table[ a[i, j] x^i  y^j , {i, 0,5}, {j, 0, 5}]

           If[Total@#2 - 2  == 4  , x^(#2[[1]] - 1) y^(#2[[2]] - 1)   #1,  0]&,      
             CoefficientList[p, {x, y}], {2}]

y^4 a[0, 4] + x y^3 a[1, 3] + x^2 y^2 a[2, 2] + x^3 y a[3, 1] + x^4 a[4, 0]

Obviously put <=4 in there to keep the lower terms..

share|improve this answer

Your Answer


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.