In
A Singular Introduction to Commutative Algebra, the exercise says: "Write a Singular procedure, depending on two integers p, d, with
p a prime, which returns all polynomials in F_p[x] of degree d such that the corresponding polynomial function vanishes. Use the procedure to display all f ∈ (Z/5Z)[x] of degree ≤ 6 such that f = 0."
My solution:
Code:
proc zeroFunctions (int p, int d)
{ list l; //list of polynomials of degree d whose function is zero everywhere
for (int i=p^d; i<p^(d+1); i=i+1) //the decimals of i in the numeral system with basis p determine the coefficients of f
{ poly f=0; int j,e=i,0; //e is the exponent
while(j>0){ f=f+(j%p)*x^e; e=e+1; j=j / p; }
int b=1; //boolean expression 'true'
for (int k=0; k<p; k=k+1)
{ b = b and subst(f,x,k)==0; } //b remains true if f(j)=0
if (b==1) { l = l + list(f); } //if f is the zero function, we append it to l }
return(l);}
int p=5; ring R=p,(x),dp; zeroFunctions(p,6);
This works correctly for p=2, d=3. I don't know exactly what happens for p=5, d=6. The computer seems to be stuck/frozen. Out of memory? Endless loop? Too long output?
Question: How can I fix my procedure to work flawlessly?
Question: How can I tell Singular not to print every message "redefining b" and "int division", i.e. I'd like to switch to 'silent mode'.