1
$\begingroup$

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.

$\endgroup$
  • 2
    $\begingroup$ PolynomialReduce[(poly/.Thread[vars->t*vars],t^5][[2]]/.t->1 $\endgroup$ – Daniel Lichtblau Feb 7 '14 at 22:53
  • $\begingroup$ @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?.. $\endgroup$ – george2079 Feb 7 '14 at 23:41
  • $\begingroup$ note the subject says "up to" while the question says "combined degree 4" .. which do you want? $\endgroup$ – george2079 Feb 7 '14 at 23:50
  • $\begingroup$ @george2079 If you remove the lparen and don't worry too much about the missing 3rd argument it should work out better. $\endgroup$ – Daniel Lichtblau Feb 8 '14 at 0:08
  • $\begingroup$ Ok.. for those who cant stand the front end sticking a red mark in their code the third arg should be a t .. $\endgroup$ – george2079 Feb 10 '14 at 17:25
1
$\begingroup$
p = Total@Flatten@Table[ a[i, j] x^i  y^j , {i, 0,5}, {j, 0, 5}]

   Total@Flatten@ 
       MapIndexed[ 
           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..

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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