# Singular

#### D.15.17.37 isHomogeneous

Procedure from library `multigrading.lib` (see multigrading_lib).

Usage:
isHomogeneous(a[, f]); a polynomial/vector/ideal/module

Return:
boolean, TRUE if a is (multi)homogeneous, and FALSE otherwise

Example:
 ```LIB "multigrading.lib"; ring r = 0,(x,y,z),dp; //Grading and Torsion matrices: intmat M[3][3] = 1,0,0, 0,1,0, 0,0,1; intmat T[3][1] = 1,2,3; setBaseMultigrading(M,T); attrib(r); ==> attr:cf_class, type int ==> attr:global, type int ==> attr:maxExp, type int ==> attr:ring_cf, type int ==> attr:isLPring, type int ==> attr:gradingGroup, type list ==> attr:mgrad, type intmat poly f = x-yz; multiDegPartition(f); ==> _[1]=-yz ==> _[2]=x print(multiDeg(_)); ==> 0 1 ==> 1 0 ==> 1 0 isHomogeneous(f); // f: is not homogeneous ==> 0 poly g = 1-xy2z3; isHomogeneous(g); // g: is homogeneous ==> 1 multiDegPartition(g); ==> _[1]=-xy2z3+1 kill T; ///////////////////////////////////////////////////////// // new Torsion matrix: intmat T[3][4] = 3,3,3,3, 2,1,3,0, 1,2,0,3; setBaseMultigrading(M,T); f; ==> -yz+x isHomogeneous(f); ==> 0 multiDegPartition(f); ==> _[1]=-yz ==> _[2]=x // --------------------- g; ==> -xy2z3+1 isHomogeneous(g); ==> 0 multiDegPartition(g); ==> _[1]=-xy2z3 ==> _[2]=1 kill r, T, M; ring R = 0, (x,y,z), dp; intmat A[2][3] = 0,0,1, 3,2,1; intmat T[2][1] = -1, 4; setBaseMultigrading(A, T); isHomogeneous(ideal(x2 - y3 -xy +z, x*y-z, x^3 - y^2*z + x^2 -y^3)); // 1 ==> 1 isHomogeneous(ideal(x2 - y3 -xy +z, x*y-z, x^3 - y^2*z + x^2 -y^3), "checkGens"); ==> 0 isHomogeneous(ideal(x+y, x2 - y2)); // 0 ==> 0 // Degree partition: multiDegPartition(x2 - y3 -xy +z); ==> _[1]=-y3+x2 ==> _[2]=-xy+z multiDegPartition(x3 -y2z + x2 -y3 + z + 1); ==> _[1]=x3-y2z ==> _[2]=-y3+x2 ==> _[3]=z ==> _[4]=1 module N = gen(1) + (x+y) * gen(2), z*gen(3); intmat V[2][3] = 0; // 1, 2, 3, 4, 5, 6; // column-wise weights of components!!?? vector v1, v2; v1 = setModuleGrading(N[1], V); v1; ==> x*gen(2)+y*gen(2)+gen(1) multiDegPartition(v1); ==> _[1]=x*gen(2) ==> _[2]=y*gen(2) ==> _[3]=gen(1) print( multiDeg(_) ); ==> 0 0 0 ==> 3 2 0 v2 = setModuleGrading(N[2], V); v2; ==> z*gen(3) multiDegPartition(v2); ==> _[1]=z*gen(3) print( multiDeg(_) ); ==> 1 ==> 1 N = setModuleGrading(N, V); isHomogeneous(N); ==> 0 print( multiDeg(N) ); ==> 0 1 ==> 3 1 /////////////////////////////////////// V = 1, 2, 3, 4, 5, 6; v1 = setModuleGrading(N[1], V); v1; ==> x*gen(2)+y*gen(2)+gen(1) multiDegPartition(v1); ==> _[1]=x*gen(2) ==> _[2]=y*gen(2) ==> _[3]=gen(1) print( multiDeg(_) ); ==> 2 2 1 ==> 8 7 4 v2 = setModuleGrading(N[2], V); v2; ==> z*gen(3) multiDegPartition(v2); ==> _[1]=z*gen(3) print( multiDeg(_) ); ==> 4 ==> 7 N = setModuleGrading(N, V); isHomogeneous(N); ==> 0 print( multiDeg(N) ); ==> 2 4 ==> 8 7 /////////////////////////////////////// V = 0, 0, 0, 4, 1, 0; N = gen(1) + x * gen(2), z*gen(3); N = setModuleGrading(N, V); print(N); ==> 1,0, ==> x,0, ==> 0,z isHomogeneous(N); ==> 1 print( multiDeg(N) ); ==> 0 1 ==> 4 1 v1 = getGradedGenerator(N,1); print(v1); ==> [1,x] multiDegPartition(v1); ==> _[1]=x*gen(2)+gen(1) print( multiDeg(_) ); ==> 0 ==> 4 N = setModuleGrading(N, V); print(N); ==> 1,0, ==> x,0, ==> 0,z isHomogeneous(N); ==> 1 print( multiDeg(N) ); ==> 0 1 ==> 4 1 ```