source: git/Singular/LIB/noether.lib @ 431fe1

spielwiese
Last change on this file since 431fe1 was 431fe1, checked in by Hans Schönemann <hannes@…>, 17 years ago
*hannes: satiety->nsatiety (see mregular.lib) git-svn-id: file:///usr/local/Singular/svn/trunk@9581 2c84dea3-7e68-4137-9b89-c4e89433aadc
  • Property mode set to 100644
File size: 27.1 KB
Line 
1// AH/GP last modified:  12.05.2006
2//////////////////////////////////////////////////////////////////////////////
3version = "$Id: noether.lib,v 1.3 2006-12-11 18:57:42 Singular Exp $";
4category="Commutative Algebra";
5info="
6LIBRARY: noether.lib   Noether normalization of an ideal (not nessecary homogeneous)
7AUTHORS: A. Hashemi,  Amir.Hashemi@lip6.fr
8
9
10OVERVIEW:
11 A library for computing the Noether normalization of an ideal that DOES NOT require the computation of the dimension of the ideal.
12It checks whether an ideal is in Noether position.  A modular version of these algorithms is also provided.
13The procedures are based on a paper of Amir Hashemi 'Efficient Algorithms for Computing Noether Normalization'
14Submitted to: Special Issue of Mathematics in Computer Science on Symbolic and Numeric Computation.
15
16This library computes also Castelnuovo-Mumford regularity and satiety of an ideal.  A modular version of these algorithms is also provided.
17The procedures are based on a paper of Amir Hashemi 'Computation of  Castelnuovo-Mumford regularity and satiety'
18Submitted to: ISSAC 2007.
19
20
21PROCEDURES:
22 NP_test(id);  checks whether monomial ideal id is in Noether position
23 MNP_test(id);  checks whether ideal id is in Noether position by modular methods
24 NP(id);  Noether normalization of ideal id
25 MNP(id);  Noether normalization of ideal id by modular methods
26 nsatiety(id);  Satiety of ideal id
27 msatiety(id)  Satiety of ideal id by modular methods
28 regCM(id);  Castelnuovo-Mumford regularity of ideal id
29 mregCM(id);  Castelnuovo-Mumford regularity of ideal id by modular methods
30";
31LIB "elim.lib";
32LIB "algebra.lib";
33LIB "poly.lib";
34LIB "ring.lib";
35LIB "presolve.lib";
36
37///////////////////////////////////////////////////////////////////////////////
38proc NP_test (ideal I)
39"
40USAGE:  NP-test (I); I monomial ideal
41RETURN:  A list which first element is 1 if i is in Noether position
42  0  otherwise. The second element of this list is the list of variable which
43  its first part is the variable such that a power of this varaibles belong to the initial of i.
44  It return also the dimension of i if i is in Noether position
45ASSUME:  i is a nonzero monomial ideal.
46"
47{
48//--------------------------- initialisation ---------------------------------
49   int  time,ii,j,k,l,d,t,jj;
50   intvec v;
51   def r0 = basering;
52   int n = nvars(r0)-1;
53   list L,Y,P1,P2,P3;
54   if (I[1]==1)
55   {
56   print("The ideal is 1");return(1);
57   }
58   for ( ii = 1; ii <= n+1; ii++ )
59     {
60  L[ii]=0;
61     }
62   for ( ii = 1; ii <= size(I); ii++ )
63   {
64    Y=findvars(I[ii],1)[1];
65  l=rvar(Y[1][1]);
66  if (size(Y[1])==1)
67  {
68    L[l]=1;
69    P1=insert(P1,Y[1][1]);
70  }
71  if (L[l]==0)
72  {
73    L[l]=-1;
74  }
75    }
76   t=size(P1);
77   if (t==0)
78   {
79         for ( jj = 1; jj <= n+1; jj++ )
80         {
81         P3=insert(P3,varstr(jj));
82         }
83   }
84   else
85   {
86         P2=findvars(ideal(P1[1..t]),1)[3];
87         for ( jj = 1; jj <= size(P2[1]); jj++ )
88         {
89         P3=insert(P3,P2[1][jj]);
90         }
91   }
92   if (L[n+1]==-1)
93        {
94     return(list(0,P1+P3));
95  }
96   for ( ii = 1; ii <= n; ii++ )
97     {
98  if (L[ii]==-1)
99        {
100     return(list(0,P1+P3));
101  }
102  if (L[ii]==0 and L[ii+1]==1)
103        {
104     return(list(0,P1+P3));
105  }
106    }
107    d=n+1-sum(L);
108    print("The dimension of the ideal is:");print(d);
109    return(list(1,P1+P3));
110
111}
112//////////////////////////////////////////
113proc MNP_test (ideal i)
114"USAGE:  MNP-test (i); i an ideal
115RETURN:  1 if i is in Noether position 0  otherwise.
116NOTE:  This test is a probabilistic test, and it computes the initial of the ideal modulo the prime number 2147483647 (the biggest prime less than 2^31).
117"
118{
119       "// WARNING:
120// The procedure is probabilistic and  it computes the initial of the ideal modulo the prime number 2147483647";
121   int p;
122   def br=basering;
123   setring br;
124   ideal I;
125   list #;
126   option(redSB);
127   p=2147483647;
128   #=ringlist(br);
129   #[1]=p;
130   def oro=ring(#);
131   setring oro;
132   ideal sbi,lsbi;
133   sbi=fetch(br,i);
134   lsbi=lead(std(sbi));
135   setring br;
136   I=fetch(oro,lsbi);
137   I=simplify(I,1);
138   attrib(I,"isSB",1);
139   return(NP_test(I));
140}
141
142
143///////////////////////////////////////////////////////////////////////////////
144proc NP (ideal i)
145"
146USAGE:   NP (i); i ideal
147RETURN:  A linear map phi such that  phi(i) is in Noether position
148"
149{
150//--------------------------- initialisation ---------------------------------
151   int ii,jj,d,time,n,nl;
152   intmat ran;
153   def r0 = basering;
154   ideal K,chcoord;
155   n = nvars(r0)-1;
156   string s = "ring r1 = ",charstr(r0),",x(0..n),dp;";
157   execute(s);
158   ideal i,sbi,I,K,chcoord,m,L;
159   list #;
160   poly P;
161   map phi;
162   i = fetch(r0,i);
163   time=rtimer;
164   system("--ticks-per-sec",10);
165   i=std(i);
166   sbi=sort(lead(i))[1];
167   #=NP_test(sbi);
168   if ( #[1]== 1 )
169     {
170  return ("The ideal is in Noether position and the time of this computation is:",rtimer-time,"/10 sec.");
171     }
172   else
173     {
174    L=maxideal(1);
175    chcoord=maxideal(1);
176     for ( ii = 1; ii<=n+1; ii++ )
177    {
178       chcoord[rvar(#[2][ii])]=L[ii];
179    }
180    phi=r1,chcoord;
181                sbi=phi(sbi);
182                if ( NP_test(sbi)[1] == 1 )
183              {
184            setring r0;
185            chcoord=fetch(r1,chcoord);
186     return (chcoord,"and the time of this computation is:",rtimer-time,"/10 sec.");
187                }
188     }
189   while ( nl < 30 )
190   {
191     nl=nl+1;
192     I=i;
193     L=maxideal(1);
194     for ( ii = n; ii>=0; ii-- )
195     {
196       chcoord=select1(maxideal(1),1,(ii));
197       ran=random(100,1,ii);
198       ran=intmat(ran,1,ii+1);
199       ran[1,ii+1]=1;
200       m=select1(maxideal(1),1,(ii+1));
201       for ( jj = 1; jj<=ii+1; jj++ )
202       {
203           P=P+ran[1,jj]*m[jj];
204       }
205       chcoord[ii+1]=P;
206  L[ii+1]=P;
207       P=0;
208       phi=r1,chcoord;
209       I=phi(I);
210       if ( NP_test(sort(lead(std(I)))[1])[1] == 1 )
211         {
212     K=x(ii..n);
213            setring r0;
214            K=fetch(r1,K);
215                 ideal L=fetch(r1,L);
216     return (L,"and the time of this computation is:",rtimer-time,"/10 sec.");
217           }
218
219     }
220   }
221       "// WARNING:
222// The procedure has entered in more than 30 loops: in your example
223// the method may enter an infinite loop over a finite field!";
224       return (-1);
225}
226///////////////////////////////////////////////////////////////////////////////
227proc MNP (ideal i)
228"USAGE:  MNP (i); i ideal
229RETURN:  A linear map phi such that  phi(i) is in Noether position
230NOTE:  It uses the procedure  MNP_test to test Noether position.
231"
232{
233//--------------------------- initialisation ---------------------------------
234   int ii,jj,d,time,n,nl;
235   intmat ran;
236   def r0 = basering;
237   ideal K,chcoord;
238   n = nvars(r0)-1;
239   string s = "ring r1 = ",charstr(r0),",x(0..n),dp;";
240   execute(s);
241   ideal i,sbi,I,K,chcoord,m,L;
242   poly P;
243   list #;
244   map phi;
245   i = fetch(r0,i);
246   time=rtimer;
247   system("--ticks-per-sec",10);
248    #=MNP_test(i);
249   if ( #[1]== 1 )
250     {
251  return ("The ideal is in Noether position and the time of this computation is:",rtimer-time,"/10 sec.");
252     }
253   else
254     {
255    L=maxideal(1);
256    chcoord=maxideal(1);
257     for ( ii = 1; ii<=n+1; ii++ )
258    {
259       chcoord[rvar(#[2][ii])]=L[ii];
260    }
261    phi=r1,chcoord;
262                I=phi(i);
263                if ( MNP_test(I)[1] == 1 )
264              {
265            setring r0;
266            chcoord=fetch(r1,chcoord);
267     return (chcoord,"and the time of this computation is:",rtimer-time,"/10 sec.");
268                }
269     }
270   while ( nl < 30 )
271   {
272     nl=nl+1;
273     I=i;
274     L=maxideal(1);
275     for ( ii = n; ii>=0; ii-- )
276     {
277       chcoord=select1(maxideal(1),1,(ii));
278       ran=random(100,1,ii);
279       ran=intmat(ran,1,ii+1);
280       ran[1,ii+1]=1;
281       m=select1(maxideal(1),1,(ii+1));
282       for ( jj = 1; jj<=ii+1; jj++ )
283       {
284           P=P+ran[1,jj]*m[jj];
285       }
286       chcoord[ii+1]=P;
287       L[ii+1]=P;
288       P=0;
289       phi=r1,chcoord;
290       I=phi(I);
291       if ( MNP_test(I)[1] == 1 )
292         {
293     K=x(ii..n);
294            setring r0;
295            K=fetch(r1,K);
296                 ideal L=fetch(r1,L);
297     return (L,"and the time of this computation is:",rtimer-time,"/10 sec.");
298           }
299
300     }
301   }
302       "// WARNING:
303// The procedure has entered in more than 30 loops: in your example
304// the method may enter an infinite loop over a finite field!";
305       return (-1);
306}
307
308////////////////////////////////////////////////////////////////////////////////////
309proc Test (ideal i)
310"
311USAGE:   Test (i); i a monomial ideal,
312RETURN:  1 if the last variable is in generic position for i and 0 otherwise.
313THEORY:  The last variable is in generic position if the quotient of the ideal
314   with respect to this variable is equal to the quotient of the ideal with respect to the maximal ideal.
315"
316{
317//--------------------------- initialisation ---------------------------------
318   int n,ret;
319   def r0 = basering;
320   n = nvars(r0)-1;
321   string s = "ring r1 = ",charstr(r0),",x(0..n),dp;";
322   execute(s);
323   ideal I,i;
324   i = fetch(r0,i);
325   attrib(i,"isSB",1);
326   I=quotient(select(i,n+1),x(n));
327   I=I*maxideal(1);
328   ret=1;
329   if (size(reduce(I,i)) <> 0)
330   {
331  ret=0;
332   }
333return(ret);
334}
335
336
337////////////////////////////////////////////////////////////////////////////////////
338proc nsatiety (ideal i)
339"
340USAGE:   nsatiety (i); i ideal,
341RETURN:  an integer, the satiety of i.
342         (returns -1 if i is not homogeneous)
343ASSUME:  i is a homogeneous ideal of the basering R=K[x(0)..x(n)].
344THEORY:  The satiety, or saturation index, of a homogeneous ideal i is the
345         least integer s such that, for all d>=s, the degree d part of the
346         ideals i and isatiety=satiety(i,maxideal(1))[1] coincide.
347"
348{
349//--------------------------- initialisation ---------------------------------
350   int e,ii,jj,h,d,time,lastv,nl,ret;
351   intmat ran;
352   def r0 = basering;
353   int n = nvars(r0)-1;
354   string s = "ring r1 = ",charstr(r0),",x(0..n),dp;";
355   execute(s);
356   ideal i,sbi,I,K,chcoord,m,L;
357   poly P;
358   map phi;
359   i = fetch(r0,i);
360   time=rtimer;
361   system("--ticks-per-sec",100);
362   sbi=std(i);
363//----- Check ideal homogeneous
364   if ( homog(sbi) == 0 )
365   {
366       dbprint(2,"The ideal is not homogeneous, and time for this test is: " + string(rtimer-time) + "/100sec.");
367  return ();
368   }
369   I=simplify(lead(sbi),1);
370   attrib(I,"isSB",1);
371   K=select(I,n+1);
372   if (size(K) == 0)
373   {
374  dbprint(2,"satiety(i)=0 and the time of this computation: " + string(rtimer-time) + "/100sec.");
375  return();
376   }
377   if (Test(I) == 1 )
378   {
379  dbprint(2,"satiety(i)=" + string(maxdeg1(K)) + " and the time of this computation: " + string(rtimer-time) + "/100sec.");
380  return();
381   }
382   while ( nl < 5 )
383   {
384     nl=nl+1;
385     chcoord=select1(maxideal(1),1,(n));
386     ran=random(100,1,n);
387     ran=intmat(ran,1,n+1);
388     ran[1,n+1]=1;
389     m=select1(maxideal(1),1,(n+1));
390     for ( jj = 1; jj<=n+1; jj++ )
391       {
392           P=P+ran[1,jj]*m[jj];
393       }
394     chcoord[n+1]=P;
395     P=0;
396     phi=r1,chcoord;
397     L=std(phi(i));
398     I=simplify(lead(L),1);
399     attrib(I,"isSB",1);
400     K=select(I,n+1);
401     if (size(K) == 0)
402     {
403  dbprint(2,"satiety(i)=0 and the time of this computation: " + string(rtimer-time) + "/100sec.");
404  return();
405     }
406     if (Test(I) == 1 )
407     {
408  dbprint(2,"satiety(i)=" + string(maxdeg1(K)) + " and the time of this computation: " + string(rtimer-time) + "/100sec.");
409  return();
410     }
411   }
412}
413
414
415//////////////////////////////////////////////////////////////////////////////
416proc msatiety (ideal i)
417"
418USAGE:   msatiety (i); i ideal,
419RETURN:  an integer, the satiety of i.
420         (returns -1 if i is not homogeneous)
421ASSUME:  i is a homogeneous ideal of the basering R=K[x(0)..x(n)].
422THEORY:  The satiety, or saturation index, of a homogeneous ideal i is the
423         least integer s such that, for all d>=s, the degree d part of the
424         ideals i and isatiety=satiety(i,maxideal(1))[1] coincide.
425NOTE:   This is a probabilistic procedure, and it computes the initial of the ideal modulo the prime number 2147483647 (the biggest prime less than 2^31).
426"
427{
428//--------------------------- initialisation ---------------------------------
429       "// WARNING:
430// The procedure is probabilistic and  it computes the initial of the ideal modulo the prime number 2147483647";
431   int e,ii,jj,h,d,time,lastv,nl,ret,s1,d1,siz,j,si,u,k,p;
432   intvec v1;
433   intmat ran;
434   def r0 = basering;
435   int n = nvars(r0)-1;
436   string s = "ring r1 = ",charstr(r0),",x(0..n),dp;";
437   execute(s);
438   ideal i,sbi,I,K,chcoord,m,L,sbi1,lsbi1,id1;
439   vector V1;
440   list #,LL,PL,Gb1,VGb1,Gb2,VGb2,Res1,Res2;
441   poly P;
442   map phi;
443   time=rtimer;
444   system("--ticks-per-sec",100);
445   i = fetch(r0,i);
446//----- Check ideal homogeneous
447   if ( homog(i) == 0 )
448   {
449       "// WARNING: The ideal is not homogeneous.";
450       dbprint(2,"Time for this test is: " + string(rtimer-time) + "/100sec.");
451  return ();
452   }
453   option(redSB);
454   p=2147483647;
455   list r2=ringlist(r1);
456   r2[1]=p;
457   def oro=ring(r2);
458   setring oro;
459   ideal sbi=fetch(r1,i);
460   sbi=std(sbi);
461   setring r1;
462   sbi=fetch(oro,sbi);
463   kill oro;
464   I=simplify(lead(sbi),1);
465   attrib(I,"isSB",1);
466   K=select(I,n+1);
467   if (size(K) == 0)
468   {
469  dbprint(2,"msatiety(i)=0 and the time of this computation: " + string(rtimer-time) + "/100sec.");
470  return();
471   }
472   if (Test(I) == 1 )
473   {
474  dbprint(2,"msatiety(i)=" + string(maxdeg1(K)) + " and the time of this computation: " + string(rtimer-time) + "/100sec.");
475  return();
476   }
477   while ( nl < 30 )
478   {
479     nl=nl+1;
480     chcoord=select1(maxideal(1),1,(n));
481     ran=random(100,1,n);
482     ran=intmat(ran,1,n+1);
483     ran[1,n+1]=1;
484     m=select1(maxideal(1),1,(n+1));
485     for ( jj = 1; jj<=n+1; jj++ )
486       {
487           P=P+ran[1,jj]*m[jj];
488       }
489     chcoord[n+1]=P;
490     P=0;
491     phi=r1,chcoord;
492     sbi=phi(i);
493     list r2=ringlist(r1);
494     r2[1]=p;
495     def oro=ring(r2);
496     setring oro;
497     ideal sbi=fetch(r1,sbi);
498     sbi=std(sbi);
499     setring r1;
500     sbi=fetch(oro,sbi);
501     kill oro;
502     lsbi1=lead(sbi);
503     attrib(lsbi1,"isSB",1);
504     K=select(lsbi1,n+1);
505     if (size(K) == 0)
506     {
507  dbprint(2,"msatiety(i)=0 and the time of this computation: " + string(rtimer-time) + "/100sec.");
508  return();
509     }
510     if (Test(lsbi1) == 1 )
511     {
512  dbprint(2,"msatiety(i)=" + string(maxdeg1(K)) + " and the time of this computation: " + string(rtimer-time) + "/100sec.");
513  return();
514     }
515   }
516}
517
518//////////////////////////////////////////////////////////////////////////////
519//
520proc regCM (ideal i)
521"
522USAGE:  regCM (i); i ideal
523RETURN:  the Castelnuovo-Mumford regularity of i.
524         (returns -1 if i is not homogeneous)
525ASSUME:  i is a homogeneous ideal.
526"
527{
528//--------------------------- initialisation ---------------------------------
529   int e,ii,jj,H,h,d,time,lastv,nv,nl;
530   int lastind,ch,nesttest,NPtest,nl,N,acc;
531   intmat ran;
532   def r0 = basering;
533   int n = nvars(r0)-1;
534   string s = "ring r1 = ",charstr(r0),",x(0..n),dp;";
535   execute(s);
536   ideal i,sbi,I,J,K,chcoord,m,L;
537   list #;
538   poly P;
539   map phi;
540   i = fetch(r0,i);
541   time=rtimer;
542   sbi=std(i);
543//----- Check ideal homogeneous
544   if ( homog(sbi) == 0 )
545   {
546       "// The ideal is not homogeneous!";
547       return (-1);
548   }
549   I=simplify(lead(sbi),1);
550   attrib(I,"isSB",1);
551   d=dim(I);
552   K=select(I,n+1);
553   if (size(K) == 0)
554   {
555  h=0;
556   }
557   if (Test(I) == 1)
558   {
559  h=maxdeg1(K);
560   }
561   else
562   {
563  while ( nl < 5 )
564  {
565    nl=nl+1;
566         chcoord=select1(maxideal(1),1,(n));
567         ran=random(100,1,n);
568         ran=intmat(ran,1,n+1);
569         ran[1,n+1]=1;
570         m=select1(maxideal(1),1,(n+1));
571         for ( jj = 1; jj<=n+1; jj++ )
572           {
573             P=P+ran[1,jj]*m[jj];
574           }
575         chcoord[n+1]=P;
576         P=0;
577         phi=r1,chcoord;
578    i=phi(i);
579         I=simplify(lead(std(i)),1);
580         attrib(I,"isSB",1);
581         K=select(I,n+1);
582         if (size(K) == 0)
583         {
584      h=0;break
585         }
586         if (Test(I) == 1 )
587         {
588      h=maxdeg1(K);break;
589    }
590  }
591    }
592   for ( ii = n; ii>=n-d+1; ii-- )
593   {
594  i=subst(i,x(ii),0);
595  s = "ring mr = ",charstr(r0),",x(0..ii-1),dp;";
596  execute(s);
597  ideal i,sbi,I,J,K,chcoord,m,L;
598     poly P;
599     map phi;
600  i=imap(r1,i);
601  sbi=std(i);
602        I=simplify(lead(sbi),1);
603  attrib(I,"isSB",1);
604       K=select(I,ii);
605       if (size(K) == 0)
606       {
607    H=0;
608       }
609  if (Test(I) == 1)
610  {
611    H=maxdeg1(K);
612     }
613     else
614     {
615    while ( nl < 5 )
616    {
617      nl=nl+1;
618           chcoord=select1(maxideal(1),1,(ii-1));
619           ran=random(100,1,ii-1);
620           ran=intmat(ran,1,ii);
621           ran[1,ii]=1;
622           m=select1(maxideal(1),1,(ii));
623           for ( jj = 1; jj<=ii; jj++ )
624             {
625               P=P+ran[1,jj]*m[jj];
626             }
627           chcoord[ii]=P;
628           P=0;
629           phi=mr,chcoord;
630           i=phi(i);
631           I=simplify(lead(std(i)),1);
632           attrib(I,"isSB",1);
633           K=select(I,ii);
634           if (size(K) == 0)
635           {
636        H=0;break;
637           }
638           if (Test(I) == 1 )
639           {
640        H=maxdeg1(K);break;
641      }
642    }
643    setring r1;
644    i=imap(mr,i);
645    kill mr;
646      }
647  if (H > h)
648  {
649    h=H;
650  }
651   }
652dbprint(2,"regCM(i)=" + string(h) + " and the time of this computation: " + string(rtimer-time) + "/100sec.");
653return();
654}
655//////////////////////////////////////////////////////////////////////////////
656//
657proc mregCM (ideal i)
658"
659USAGE:  mregCM (i); i ideal
660RETURN:  an integer, the Castelnuovo-Mumford regularity of i.
661         (returns -1 if i is not homogeneous)
662ASSUME:  i is a homogeneous ideal.
663NOTE:   This is a probabilistic procedure, and it computes the initial of the ideal modulo the prime number 2147483647 (the biggest prime less than 2^31).
664"
665{
666//--------------------------- initialisation ---------------------------------
667       "// WARNING:
668// The procedure is probabilistic and  it computes the initial of the ideal modulo the prime number 2147483647";
669   int e,ii,jj,H,h,d,time,lastv,sat,firstind,nv,nl,p;
670   int lastind,ch,nesttest,NPtest,nl,N,acc;
671   intmat ran;
672   def r0 = basering;
673   int n = nvars(r0)-1;
674   string s = "ring r1 = ",charstr(r0),",x(0..n),dp;";
675   execute(s);
676   ideal i,sbi,I,J,K,chcoord,m,L,lsbi1,lsbi2;
677   list #;
678   poly P;
679   map phi;
680   i = fetch(r0,i);
681   time=rtimer;
682//----- Check ideal homogeneous
683   if ( homog(i) == 0 )
684   {
685       "// The ideal is not homogeneous!";
686       return (-1);
687   }
688   option(redSB);
689   p=2147483647;
690   #=ringlist(r1);
691   #[1]=p;
692   def oro=ring(#);
693   setring oro;
694   ideal sbi,lsbi;
695   sbi=fetch(r1,i);
696   lsbi=lead(std(sbi));
697   setring r1;
698   lsbi1=fetch(oro,lsbi);
699   lsbi1=simplify(lsbi1,1);
700   attrib(lsbi1,"isSB",1);
701   kill oro;
702   I=lsbi1;
703   d=dim(I);
704   K=select(I,n+1);
705   if (size(K) == 0)
706   {
707  h=0;
708   }
709   if (Test(I) == 1)
710   {
711  h=maxdeg1(K);
712   }
713   else
714   {
715  while ( nl < 5 )
716  {
717    nl=nl+1;
718         chcoord=select1(maxideal(1),1,(n));
719         ran=random(100,1,n);
720         ran=intmat(ran,1,n+1);
721         ran[1,n+1]=1;
722         m=select1(maxideal(1),1,(n+1));
723         for ( jj = 1; jj<=n+1; jj++ )
724           {
725             P=P+ran[1,jj]*m[jj];
726           }
727         chcoord[n+1]=P;
728         P=0;
729         phi=r1,chcoord;
730    i=phi(i);
731       #=ringlist(r1);
732       #[1]=p;
733       def oro=ring(#);
734       setring oro;
735       ideal sbi,lsbi;
736       sbi=fetch(r1,i);
737       lsbi=lead(std(sbi));
738       setring r1;
739       lsbi1=fetch(oro,lsbi);
740       lsbi1=simplify(lsbi1,1);
741       attrib(lsbi1,"isSB",1);
742       kill oro;
743    I=lsbi1;
744         K=select(I,n+1);
745         if (size(K) == 0)
746         {
747      h=0;break
748         }
749         if (Test(I) == 1 )
750         {
751      h=maxdeg1(K);break;
752    }
753  }
754    }
755   for ( ii = n; ii>=n-d+1; ii-- )
756   {
757  i=subst(i,x(ii),0);
758  s = "ring mr = ",charstr(r0),",x(0..ii-1),dp;";
759  execute(s);
760  ideal i,sbi,I,J,K,chcoord,m,L,lsbi1;
761     poly P;
762        list #;
763     map phi;
764  i=imap(r1,i);
765     #=ringlist(mr);
766     #[1]=p;
767     def oro=ring(#);
768     setring oro;
769     ideal sbi,lsbi;
770     sbi=fetch(mr,i);
771     lsbi=lead(std(sbi));
772     setring mr;
773     lsbi1=fetch(oro,lsbi);
774     lsbi1=simplify(lsbi1,1);
775     attrib(lsbi1,"isSB",1);
776     kill oro;
777  I=lsbi1;
778       K=select(I,ii);
779       if (size(K) == 0)
780       {
781    H=0;
782       }
783  if (Test(I) == 1)
784  {
785    H=maxdeg1(K);
786     }
787     else
788     {
789    while ( nl < 5 )
790    {
791      nl=nl+1;
792           chcoord=select1(maxideal(1),1,(ii-1));
793           ran=random(100,1,ii-1);
794           ran=intmat(ran,1,ii);
795           ran[1,ii]=1;
796           m=select1(maxideal(1),1,(ii));
797           for ( jj = 1; jj<=ii; jj++ )
798             {
799               P=P+ran[1,jj]*m[jj];
800             }
801           chcoord[ii]=P;
802           P=0;
803           phi=mr,chcoord;
804           i=phi(i);
805         #=ringlist(mr);
806         #[1]=p;
807         def oro=ring(#);
808         setring oro;
809         ideal sbi,lsbi;
810         sbi=fetch(mr,i);
811         lsbi=lead(std(sbi));
812         setring mr;
813         lsbi1=fetch(oro,lsbi);
814         lsbi1=simplify(lsbi1,1);
815         attrib(lsbi1,"isSB",1);
816         kill oro;
817      I=lsbi1;
818           K=select(I,ii);
819           if (size(K) == 0)
820           {
821        H=0;break;
822           }
823           if (Test(I) == 1 )
824           {
825        H=maxdeg1(K);break;
826      }
827    }
828    setring r1;
829    i=imap(mr,i);
830    kill mr;
831      }
832  if (H > h)
833  {
834    h=H;
835  }
836  }
837dbprint(2,"mregCM(i)=" + string(h) + " and the time of this computation: " + string(rtimer-time) + "/100sec.");
838return();
839}
840example
841{ "EXAMPLE:"; echo = 2;
842ring r=0,(X,Y,a,b),dp;
843poly f=X^8+a*Y^4-Y;
844poly g=Y^8+b*X^4-X;
845poly h=diff(f,X)*diff(g,Y)-diff(f,Y)*diff(g,X);
846ideal i=f,g,h;
847}
848example
849{ "EXAMPLE:"; echo = 2;
850ring r=0,(x,y,z,a,b),dp;
851ideal i=2*y^2*(y^2+x^2)+(b^2-3*a^2)*y^2-2*b*y^2*(x+y)+2*a^2*b*(y+x)-a^2*x^2+a^2*(a^2-b^2),4*y^3+4*y*(y^2+x^2)-2*b*y^2-4*b*y*(y+x)+2*(b^2-3*a^2)*y+2*a^2*b,4*x*y^2-2*b*y^2-2*a^2*x+2*a^2*b;
852}
853example
854{ "EXAMPLE:"; echo = 2;
855ring r=0,(t,a,b,c,d),dp;
856ideal i=b4-a3d, ab3-a3c, bc4-ac3d-bcd3+ad4, c6-bc3d2-c3d3+bd5, ac5-b2c3d-ac2d3+b2d4, a2c4-a3d3+b3d3-a2cd3, b3c3-a3d3, ab2c3-a3cd2+b3cd2-ab2d3, a2bc3-a3c2d+b3c2d-a2bd3, a3c3-a3bd2, a4c2-a3b2d;
857}
858example
859{ "EXAMPLE:"; echo = 2;
860ring r=0,(a,b,c,d,e),dp;
861ideal i=6*b4*c3+21*b4*c2*d+15b4cd2+9b4d3-8b2c2e-28b2cde+36b2d2e-144b2c-648b2d-120, 9b4c4+30b4c3d+39b4c2d2+18b4cd3-24b2c3e-16b2c2de+16b2cd2e+24b2d3e-432b2c2-720b2cd-432b2d2+16c2e2-32cde2+16d2e2+576ce-576de-240c+5184,-15b2c3e+15b2c2de-81b2c2+216b2cd-162b2d2+40c2e2-80cde2+40d2e2+1008ce-1008de+5184, -4b2c2+4b2cd-3b2d2+22ce-22de+261;
862}
863example
864{ "EXAMPLE:"; echo = 2;
865ring r=0,(c,b,d,p,q),dp;
866ideal i=2*(b-1)^2+2*(q-p*q+p^2)+c^2*(q-1)^2-2*b*q+2*c*d*(1-q)*(q-p)+2*b*p*q*d*(d-c)+b^2*d^2*(1-2*p)+2*b*d^2*(p-q)+2*b*d*c*(p-1)+2*b*p*q*(c+1)+(b^2-2*b)*p^2*d^2+2*b^2*p^2+4*b*(1-b)*p+d^2*(p-q)^2,d*(2*p+1)*(q-p)+c*(p+2)*(1-q)+b*(b-2)*d+b*(1-2*b)*p*d+b*c*(q+p-p*q-1)+b*(b+1)*p^2*d, -b^2*(p-1)^2+2*p*(p-q)-2*(q-1),b^2+4*(p-q*q)+3*c^2*(q-1)*(q-1)-3*d^2*(p-q)^2+3*b^2*d^2*(p-1)^2+b^2*p*(p-2)+6*b*d*c*(p+q+q*p-1);
867}
868example
869{ "EXAMPLE:"; echo = 2;
870ring r=0,(a,b,c,d,e,f),dp;
871ideal i=2adef+3be2f-cef2,4ad2f+5bdef+cdf2,2abdf+3b2ef-bcf2,4a2df+5abef+acf2,4ad2e+3bde2+7cdef, 2acde+3bce2-c2ef, 4abde+3b2e2-4acdf+2bcef-c2f2, 4a2de+3abe2+7acef, 4acd2+5bcde+c2df, 4abd2+3b2de+7bcdf, 16a2d2-9b2e2+32acdf-18bcef+7c2f2, 2abcd+3b2ce-bc2f, 4a2cd+5abce+ac2f, 4a2bd+3ab2e+7abcf, abc2f-cdef2, ab2cf-bdef2, 2a2bcf+3be2f2-cef3, ab3f-3bdf3, 2a2b2f-4adf3+3bef3-cf4, a3bf+4aef3, 3ac3e-cde3, 3b2c2e-bc3f+2cd2ef, abc2e-cde2f, 6a2c2e-4ade3-3be4+ce3f, 3b3ce-b2c2f+2bd2ef, 2a2bce+3be3f-ce2f2, 3a3ce+4ae3f, 4bc3d+cd3e, 4ac3d-3bc3e-2cd2e2+c4f, 8b2c2d-4ad4-3bd3e-cd3f, 4b3cd+3bd3f, 4ab3d+3b4e-b3cf-6bd2f2, 4a4d+3a3be+a3cf-8ae2f2;
872}
873example
874{ "EXAMPLE:"; echo = 2;
875ring r=0,(x,y,z,t,u,v,w),dp;
876ideal i=2tw+2wy-wz,2uw2-10vw2+20w3-7tu+35tv-70tw, 6tw2+2w2y-2w2z-21t2-7ty+7tz, 2v3-4uvw-5v2w+6uw2+7vw2-15w3-42vy, 6tw+9wy+2vz-3wz-21x, 9uw3-45vw3+135w4+14tv2-70tuw+196tvw-602tw2-14v2z+28uwz+14vwz-28w2z+147ux-735vx+2205wx-294ty+98tz+294yz-98z2, 36tw3+6w3y-9w3z-168t2w-14v2x+28uwx+14vwx-28w2x-28twy+42twz+588tx+392xy-245xz, 2uvw-6v2w-uw2+13vw2-5w3-28tw+14wy, u2w-3uvw+5uw2-28tw+14wy, tuw+tvw-11tw2-2vwy+8w2y+uwz-3vwz+5w2z-21wx, 5tuw-17tvw+33tw2-7uwy+22vwy-39w2y-2uwz+6vwz-10w2z+63wx, 20t2w-12uwx+30vwx-15w2x-10twy-8twz+4wyz, 4t2w-6uwx+12vwx-6w2x+2twy-2wy2-2twz+wyz, 8twx+8wxy-4wxz;
877}
878example
879{ "EXAMPLE:"; echo = 2;
880ring r=0,(a,b,c,d,x,w,u,v),dp;
881ideal i=a+b+c+d,u+v+w+x, 3ab+3ac+3bc+3ad+3bd+3cd+2,bu+cu+du+av+cv+dv+aw+bw+dw+ax+bx+cx,bcu+bdu+cdu+acv+adv+cdv+abw+adw+bdw+abx+acx+bcx,abc+abd+acd+bcd,bcdu+acdv+abdw+abcx;
882}
883example
884{ "EXAMPLE:"; echo = 2;
885ring r=0,(b,x,y,z,s,t,u,v,w),dp;
886ideal i=su+bv, tu+bw,tv+sw,sx+by,tx+bz,ty+sz,vx+uy,wx+uz,wy+vz;
887}
888example
889{ "EXAMPLE:"; echo = 2;
890ring r=0,(t,a,b,c,d,e,f,g,h),dp;
891ideal i=a+c+d-e-h,2df+2cg+2eh-2h2-h-1,3df2+3cg2-3eh2+3h3+3h2-e+4h, 6bdg-6eh2+6h3-3eh+6h2-e+4h, 4df3+4cg3+4eh3-4h4-6h3+4eh-10h2-h-1, 8bdfg+8eh3-8h4+4eh2-12h3+4eh-14h2-3h-1, 12bdg2+12eh3-12h4+12eh2-18h3+8eh-14h2-h-1, -24eh3+24h4-24eh2+36h3-8eh+26h2+7h+1;
892}
893example
894{ "EXAMPLE:"; echo = 2;
895ring r=0,(a,b,c,d,e,f,g,h,k,l),dp;
896ideal i=f2h-1,ek2-1,g2l-1, 2ef2g2hk2+f2g2h2k2+2ef2g2k2l+2f2g2hk2l+f2g2k2l2+ck2, 2e2fg2hk2+2efg2h2k2+2e2fg2k2l+4efg2hk2l+2fg2h2k2l+2efg2k2l2+2fg2hk2l2+2bfh, 2e2f2ghk2+2ef2gh2k2+2e2f2gk2l+4ef2ghk2l+2f2gh2k2l+2ef2gk2l2+2f2ghk2l2+2dgl, e2f2g2k2+2ef2g2hk2+2ef2g2k2l+2f2g2hk2l+f2g2k2l2+bf2, 2e2f2g2hk+2ef2g2h2k+2e2f2g2kl+4ef2g2hkl+2f2g2h2kl+2ef2g2kl2+2f2g2hkl2+2cek, e2f2g2k2+2ef2g2hk2+f2g2h2k2+2ef2g2k2l+2f2g2hk2l+dg2, -e2f2g2hk2-ef2g2h2k2-e2f2g2k2l-2ef2g2hk2l-f2g2h2k2l-ef2g2k2l2-f2g2hk2l2+a2;
897}
898example
899{ "EXAMPLE:"; echo = 2;
900ring r=0,(b,c,d,e,f,g,h,j,k,l),dp;
901ideal i=-k9+9k8l-36k7l2+84k6l3-126k5l4+126k4l5-84k3l6+36k2l7-9kl8+l9, -bk8+8bk7l+k8l-28bk6l2-8k7l2+56bk5l3+28k6l3-70bk4l4-56k5l4+56bk3l5+70k4l5-28bk2l6-56k3l6+8bkl7+28k2l7-bl8-8kl8+l9, ck7-7ck6l-k7l+21ck5l2+7k6l2-35ck4l3-21k5l3+35ck3l4+35k4l4-21ck2l5-35k3l5+7ckl6+21k2l6-cl7-7kl7+l8, -dk6+6dk5l+k6l-15dk4l2-6k5l2+20dk3l3+15k4l3-15dk2l4-20k3l4+6dkl5+15k2l5-dl6-6kl6+l7, ek5-5ek4l-k5l+10ek3l2+5k4l2-10ek2l3-10k3l3+5ekl4+10k2l4-el5-5kl5+l6, -fk4+4fk3l+k4l-6fk2l2-4k3l2+4fkl3+6k2l3-fl4-4kl4+l5, gk3-3gk2l-k3l+3gkl2+3k2l2-gl3-3kl3+l4, -hk2+2hkl+k2l-hl2-2kl2+l3, jk-jl-kl+l2;
902}
903example
904{ "EXAMPLE:"; echo = 2;
905ring r=0,x(0..10),dp;
906ideal i=x(1)*x(0),x(1)*x(2),x(2)*x(3),x(3)*x(4),x(4)*x(5),x(5)*x(6),x(6)*x(7),x(7)*x(8),x(8)*x(9),x(9)*x(10),x(10)*x(0);
907}
908example
909{ "EXAMPLE:"; echo = 2;
910ring r=0,(a,b,c,d,e,f,g,h,j,k,l,m,n,o,p,q,s),dp;
911ideal i=ag,gj+am+np+q,bl,nq,bg+bk+al+lo+lp+b+c,ag+ak+jl+bm+bn+go+ko+gp+kp+lq+a+d+f+h+o+p,gj+jk+am+an+mo+no+mp+np+gq+kq+e+j+q+s-1,jm+jn+mq+nq,jn+mq+2nq,gj+am+2an+no+np+2gq+kq+q+s,2ag+ak+bn+go+gp+lq+a+d,bg+al, an+gq, 2jm+jn+mq, gj+jk+am+mo+2mp+np+e+2j+q, jl+bm+gp+kp+a+f+o+2p,lp+b,jn+mq,gp+a;
912}
913example
914{ "EXAMPLE:"; echo = 2;
915ring r=0,(a,b,c,d,e,f,g,h,v,w,k,l,m,n,o,p,q,s,t,u),dp;
916ideal i=af+bg+ch+dv+ew-1/2, a2f+b2g+c2h+d2v+e2w-1/3,tdw+agk+ahl+bhm+avn+bvo+cvp+awq+bwu+cws-1/6, a3f+b3g+c3h+d3v+e3w-1/4, tdew+abgk+achl+bchm+advn+bdvo+cdvp+aewq+bewu+cews-1/8, td2w+a2gk+a2hl+b2hm+a2vn+b2vo+c2vp+a2wq+b2wu+c2ws-1/12, ahkm+tawn+tbwo+avko+tcwp+avlp+bvmp+awku+awls+bwms-1/24, a4f+b4g+c4h+d4v+e4w-1/5, tde2w+ab2gk+ac2hl+bc2hm+ad2vn+bd2vo+cd2vp+ae2wq+be2wu+ce2ws-1/10, td2ew+a2bgk+a2chl+b2chm+a2dvn+b2dvo+c2dvp+a2ewq+b2ewu+c2ews-1/15,achkm+taewn+tbewo+advko+tcewp+advlp+bdvmp+aewku+aewls+bewms-1/30,t2d2w+a2gk2+a2hl2+2abhlm+b2hm2+a2vn2+2abvno+b2vo2+2acvnp+2bcvop+c2vp2+2tadwq+a2wq2+2tbdwu+2abwqu+b2wu2+2tcdws+2acwqs+2bcwus+c2ws2-1/20,td3w+a3gk+a3hl+b3hm+a3vn+b3vo+c3vp+a3wq+b3wu+c3ws-1/20,abhkm+tadwn+tbdwo+abvko+tcdwp+acvlp+bcvmp+abwku+acwls+bcwms-1/40,a2hkm+ta2wn+tb2wo+a2vko+tc2wp+a2vlp+b2vmp+a2wku+a2wls+b2wms-1/60,tawko+tawlp+tbwmp+avkmp+awkms-1/20;
917}
918
919
Note: See TracBrowser for help on using the repository browser.