// This is how to include a library // teachstd.lib is one provided by Singular folks // for teaching standard bases LIB "teachstd.lib"; // I'm using the example given in my slides // From slide gb.pdf slide #15 // Z_5[x, y], LEX x>y ring R = 5, (x, y), lp; poly f = x^2+y^2+1; poly g = x^2*y + 2*x*y+ x; ideal J = f, g; // ideal of vanishing polynomials in Z_5 = F_5 // Note: x^q - x = 0 in F_q. ideal J5 = x^5 - x, y^5-y; poly h; // use the spoly() function from "teachstd.lib" h = spoly(f, g); //print h printf("Spoly of f, g:"); h; // The reduce function performs polynomial division // reduce(poly h, ideal J): reduce poly h modulo the ideal J poly r; r = reduce(h, J); printf("Spoly of f, g reduced modulo J:"); r; // Sum of ideals J + J5 = f, g, x^5-x, y^5-y // Put together the polynomials of J and J5 ideal G = J + J5; // This is how you print an ideal printf("Ideal G of J+J5"); G; // Singular has an option to compute a reduced GB, // or a non-reduced (vanilla) GB. Use the option() command // This is how you compute a non-reduced GB option(noredSB); // noredSB = non-reduced Std bases option(); printf("Non-reduced Groebner basis GB(J+J5):"); groebner(G); // This is how you compute a Reduced GB option(redSB); option(); printf("Reduced Groebner basis GB(J+J5):"); groebner(G); printf("Reduced Groebner basis of only J, GB(J):"); groebner(J);