| // We call the procedure 'cyclic':
proc cyclic (int n)
{
string vs = varstr(basering)+varstr(basering);
int c=find(vs,",");
while ( c!=0 )
{
vs=vs[1,c-1]+vs[c+1,size(vs)];
c=find(vs,",");
}
string t,s;
int i,j;
for ( j=1; j<=n-1; j=j+1 )
{
t="";
for ( i=1; i <=n; i=i+1 )
{
t = t + vs[i,j] + "+";
}
t = t[1,size(t)-1] + ","+newline;
s=s+t;
}
s=s+vs[1,n]+"-1";
return (s);
}
ring r=0,(a,b,c,d,e),lp; // basering, char 0, lex ordering
string sc=cyclic(nvars(basering));
sc; // the string of the ideal
→ a+b+c+d+e,
→ ab+bc+cd+de+ea,
→ abc+bcd+cde+dea+eab,
→ abcd+bcde+cdea+deab+eabc,
→ abcde-1
execute("ideal i="+sc+";"); // this defines the ideal of cyclic roots
i;
→ i[1]=a+b+c+d+e
→ i[2]=ab+bc+cd+ae+de
→ i[3]=abc+bcd+abe+ade+cde
→ i[4]=abcd+abce+abde+acde+bcde
→ i[5]=abcde-1
timer=1;
ideal j=std(i);
→ //used time: 7.5 sec
size(j); // number of elements in the std basis
→ 11
degree(j);
→ // codimension = 5
→ // dimension = 0
→ // degree = 70
|