Question: How do I classify a list of polynomials w.r.t. their leading monomials?

Dear friends,

I need a procedure to classify a list of polynomials by their leading monomials. For example, if F = [x^2 - y - 1, y^2 - y, x^2 - 4, y^3 - 1, z^2 - 4] and a < be the lex ordering s.t. z<y<x, it should return [[x^2 - y - 1, x^2 - 4], [y^3 - y, y^3 - 1], [z^2 - 4]]. 

I appreciate any help you can provide.

Sincerely,

Please Wait...