up previous next
IsHomog

test whether given polynomials are homogeneous

Syntax
IsHomog(F: RINGELEM|MODULEELEM): BOOL
IsHomog(L: LIST): BOOL
IsHomog(I: IDEAL|MODULE): BOOL

Description
The first form of this function returns true if F is homogeneous. The second form returns true if every element of L is homogeneous. Otherwise, they return false . The third form returns true if the ideal/module can be generated by homogeneous elements, and false if not.

NOTE: when the grading dimension is 0 everything is homogeneous. For safety reasons (from version CoCoALib-5.0.3) IsHomog throws an error in this case, e.g. IsHomog(x-1) gives error instead of a possibly misleading true .

Example
/**/  use R ::= QQ[x,y];
/**/  IsHomog(x^2-x*y);
true

/**/  IsHomog(x-y^2);
false

/**/  IsHomog([x^2-x*y, x-y^2]);
false

/**/  R := NewPolyRing(QQ, "x,y", mat([[2,3],[1,2]]), 1);
/**/  use R;
/**/  IsHomog(x^3*y^2+y^4);
true

/**/  R := NewPolyRing(QQ, "x,y", mat([[2,3],[1,2]]), 2);
/**/  use R;
/**/  IsHomog(x^3*y^2+y^4);
false

/**/  use R ::= QQ[x,y];
/**/  IsHomog(ideal(x^2+y,y));
true

/**/  use R ::= QQ[x,y], Lex;  -- note: GradingDim = 0
-- /**/  IsHomog(x-1); -- !!! ERROR !!! as expected, instead of "true"

See Also