Best way to extract weighted homogenous parts of a polynomial lying on its Newton polytope
Given a polynomial in two variables $f(x,y)$, I would like to extract a list of the weighted homogeneous polynomials which lay on the Newton polytope of $f$ in SageMath
.
For example, given as input a polynomial f(x,y)=x^3*y+2*x^2y^2+x*y^3+y^7+x^5
, I would like to get as output the following list: (y^7+x*y^3,x^3*y+2*x^2*y^2+x*y^3,x^3*y+x^5)
. The function f.newton_polytope()
returns a Newton polytope geometric object, but gives no way to extract the polynomials directly. I suppose that one could work with the vertices of the polytope, to compute the normals to the facets of the polytope which define the weights of each facet, and then compute homogeneous parts with respect to the monomial orders defined by each weights, but I'm not sure how to change orders "dynamically" (i.e. without changing the ring each time, ideally). Thank you!