// this is a comment /* This too is a comment */ // This is how you declare a ring // This is r = Q[x, y, z] with LEX x>y>z ring r = 0, (x, y, z), lp; // You may also solve the same problem in Z (mod 11) // ring r = 11, (x, y, z), dp; // Uncomment this ring declaration for more experiments // lp = LEX, dp = DEGREVLEX, Dp = deglex poly f = 3*x2y + z; // different from poly ff = 3yx^2 + z; //print f; f; //print ff; printf("Poly ff:"); ff; poly g = xy + y; poly h = y3 + z3; // This is ideal J = generated by polynomials f, g, h ideal J = f, g, h; poly t; // This a 1-step reduction (1 step of division) if (lead(f)/lead(g) != 0) { t = f - lead(f)/lead(g) * g; } //print t printf("t = 1-step reduction of f by g:"); t; // This is how you print a value printf("Leading Coefficient of t:"); leadcoef(t); printf("Leading Coefficient of t:"); leadmonom(t); // Compute a Grobner Basis // two algorithms implemented in singular to compute GB //J = groebner(J); J = slimgb(J); //print the GB printf("GB of Ideal J"); J; // Divide f by the groebner basis of ideal J poly l = reduce(f, J); //print poly l; l; // l has to be 0 as f is already in J // you can also access individual polynomials in the GB J[3]; leadcoef(J[3]);