Skip to main content
edited tags
Link
Tweeted twitter.com/StackMma/status/924799992577093632
Source Link
quantum
  • 287
  • 1
  • 7

Get the homogeneous part of a polynomial

What is the easiest or fastest way to extract the homogeneous part of a polynomial in Mathematica. For instance, if there were a function homog_part[f,n], I could use it to extract the second, first and zeroth degree homogeneous part of $f=x^2+y^2+xy+x+y+7$ by writing homog_part[f,2] to get $x^2+y^2+xy$, homog_part[f,1] to get $x+y$ and homog_part[f,0] to get $7$.

I was thinking of using Series, but here you would give individual degrees of each variable while for the homogeneous part you need the total degree.