1

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.

resnon
  • 111
  • 1

1 Answers1

1
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..

george2079
  • 38,913
  • 1
  • 43
  • 110