source: git/Singular/LIB/primdecint.lib @ f9ca02

spielwiese
Last change on this file since f9ca02 was f9ca02, checked in by Stefan Steidel <steidel@…>, 14 years ago
Documentation git-svn-id: file:///usr/local/Singular/svn/trunk@13288 2c84dea3-7e68-4137-9b89-c4e89433aadc
  • Property mode set to 100755
File size: 38.5 KB
Line 
1////////////////////////////////////////////////////////////////////////////////
2version="$Id: primdecint.lib,v 1.16 2010/06/01 08:01:11 Singular Exp $";
3category = "Commutative Algebra";
4info="
5LIBRARY:  primdecint.lib   primary decomposition over the integers
6
7AUTHORS:  G. Pfister      pfister@mathematik.uni-kl.de
8@*        A. Sadiq        afshanatiq@gmail.com
9@*        S. Steidel      steidel@mathematik.uni-kl.de
10
11OVERVIEW:
12
13  A library for computing the primary decomposition of an ideal in the polynomial
14  ring over the integers, Z[x_1,...,x_n].
15
16PROCEDURES:
17 primdecZ(I);       compute the primary decomposition of I
18 minAssZ(I);        compute the minimal associated primes of I
19 radicalZ(I);       compute the radical of I
20 heightZ(I);        compute the height of I
21 equidimZ(I);       compute the equidimensional part of I
22";
23
24LIB "crypto.lib";
25
26////////////////////////////////////////////////////////////////////////////////
27
28proc primdecZ(ideal I, list #)
29"USAGE:  primdecZ(I); I ideal
30NOTE:    If size(#) > 0, then #[1] is the number of available processors for
31         the computation. Parallelization is just applicable using 32-bit Singular
32         version since MP-links are not compatible with 64-bit Singular version.
33RETURN:  a list pr of primary ideals and their associated primes:
34@format
35   pr[i][1]   the i-th primary component,
36   pr[i][2]   the i-th prime component.
37@end format
38EXAMPLE: example primdecZ; shows an example
39"
40{
41   if(size(I)==0){return(list(ideal(0),ideal(0)));}
42
43   //--------------------  Initialize optional parameters  ------------------------
44   if(size(#) > 0)
45   {
46      if(size(#) == 1)
47      {
48         int n = #[1];
49         if((n > 1) && (1 - system("with","MP")))
50         {
51            "========================================================================";
52            "There is no MP available on your system. Since this is necessary to     ";
53            "parallelize the algorithm, the computation will be done without forking.";
54            "========================================================================";
55            n = 1;
56         }
57         ideal TES = 1;
58      }
59      if(size(#) == 2)
60      {
61         int n = #[1];
62         if((n > 1) && (1 - system("with","MP")))
63         {
64            "========================================================================";
65            "There is no MP available on your system. Since this is necessary to     ";
66            "parallelize the algorithm, the computation will be done without forking.";
67            "========================================================================";
68            n = 1;
69         }
70         ideal TES = #[2];
71      }
72   }
73   else
74   {
75      int n = 1;
76      ideal TES = 1;
77   }
78
79
80   if(deg(I[1])==0)
81   {
82      ideal J=I;
83   }
84   else
85   {
86      ideal J=stdZ(I);
87   }
88
89   ideal K,N;
90   def R=basering;
91   number s;
92   list rl=ringlist(R);
93   int i,j,p,m,ex,nu,k_link;
94   list P,B,IS;
95   ideal Q,JJ;
96   ideal TQ=1;
97   if(deg(J[1])==0)
98   {
99      //=== I intersected with Z is not zero
100      list rp=rl;
101      rp[1]=0;
102      //=== q is generator of I intersect Z
103      number q=leadcoef(J[1]);
104      def Rhelp=ring(rp);
105      setring Rhelp;
106      number q=imap(R,q);
107      //=== computes the primes occuring in a generator of I intersect Z
108
109      list L = primefactors(q);
110
111      list A;
112      ideal J = imap(R,J);
113
114      for(j=1;j<=size(L[3]);j++)
115      {
116         if(L[3][j] > 1){ ex = 1; break; }
117      }
118
119      if(printlevel >= 10)
120      {
121         "n = "+string(n);
122         "size(L[3]) = "+string(size(L[3]));
123      }
124
125      int RT = rtimer;
126      if((n > 1) && (n < size(L[3])))
127      {
128
129//-----  Create n1 links l(1),...,l(n1), open all of them and compute  ---------
130//-----  standard basis for the primes L[2],...,L[n + 1].              ---------
131
132         for(i = 1; i <= n; i++)
133         {
134            p=int(L[2][i + 1]);
135            nu=int(L[3][i + 1]);
136            link l(i) = "MPtcp:fork";
137//            link l(i) = "ssi:fork";
138            open(l(i));
139            write(l(i), quote(modp(eval(J), eval(p), eval(nu))));
140         }
141
142         p = int(L[2][1]);
143         nu = int(L[3][1]);
144         int t = timer;
145         A[size(A)+1] = modp(J, p, nu);
146         t = timer - t;
147         if(t > 60) { t = 60; }
148         int i_sleep = system("sh", "sleep "+string(t));
149
150         j = n + 2;
151
152         while(j <= size(L[3]) + 1)
153         {
154            for(i = 1; i <= n; i++)
155            {
156               //=== ask if link l(i) is ready otherwise sleep for t seconds
157               if(status(l(i), "read", "ready"))                         
158               {
159                  //=== read the result from l(i)
160                  A[size(A)+1] = read(l(i));                             
161
162                  if(j <= size(L[3]))
163                  {
164                     p=int(L[2][j]);
165                     nu=int(L[3][j]);
166                     write(l(i), quote(modp(eval(J), eval(p), eval(nu))));
167                     j++;
168                  }
169                  else
170                  {
171                     k_link++;
172                     close(l(i));
173                  }
174               }
175            }
176            //=== k_link describes the number of closed links
177            if(k_link == n)                                             
178            {
179               j++;
180            }
181            i_sleep = system("sh", "sleep "+string(t));
182         }
183
184      }
185      else
186      {
187         for(j=1;j<=size(L[3]);j++)
188         {
189            A[size(A)+1] = modp(J, L[2][j], L[3][j]);
190         }
191      }
192
193      setring R;
194      list A = imap(Rhelp,A);
195      if(printlevel >= 10)
196      {
197         "A is computed in "+string(rtimer - RT)+" seconds.";
198      }
199      for(i=1;i<=size(A);i++)
200      {
201      //=== computes for all p in L the minimal associated primes of IZ/p[variables]
202         p = int(A[i][2]);
203         if(printlevel >= 10)
204         {
205            "p = "+string(p);
206            RT = rtimer;
207         }
208         nu = int(A[i][3]);
209         //=== maximal power of p dividing q, generator of I intersect Z
210         s = p^nu;
211
212         rp[1] = p;
213         def S = ring(rp);
214         setring S;
215         ideal J = imap(R,J);
216         setring R;
217
218         if(nu>1)
219         {
220            //=== p is of multiplicity > 1 in q
221
222            B = A[i][1];
223            for(j=1;j<=size(B);j++)
224            {
225               //=== the minimal associated primes of I
226               K=B[j],p;
227               K=stdZ(K);
228               B[j]=K;
229            }
230            for(j=1;j<=size(B);j++)
231            {
232               K=B[j];
233               //=== compute maximal independent set for KZ/p[variables]
234
235               setring S;
236               J=imap(R,K);
237               J=simplify(J,2);
238               attrib(J,"isSB",1);
239               IS=maxIndependSet(J);
240               setring R;
241               //=== computing the pseudo primary and extract it
242               N=J,s;
243               N=stdZ(N);
244               Q=extractZ(N,j,IS,B);
245               //=== test for useless primaries
246               if(size(reduce(TES,Q))>0)
247               {
248                  TQ=intersectZ(TQ,Q);
249                  P[size(P)+1]=list(Q,K);
250               }
251            }
252         }
253         else
254         {
255            //=== p is of multiplicity 1 in q we can compute the
256            //=== primary decomposition directly
257
258            B = A[i][1];
259            for(j=1;j<=size(B);j++)
260            {
261               K=B[j][2],p;
262               K=stdZ(K);
263               Q=B[j][1],p;
264               Q=stdZ(Q);
265               if(size(reduce(TES,Q))>0)
266               {
267                  //TQ=intersectZ(TQ,Q);
268                  P[size(P)+1]=list(Q,K);
269               }
270            }
271            if(ex)
272            {
273               JJ=imap(S,J);
274               JJ=JJ,p;
275               JJ=stdZ(JJ);
276               TQ=intersectZ(TQ,JJ);
277            }
278         }
279         kill S;
280         if(printlevel >= 10)
281         {
282            string(p)+" done in "+string(rtimer - RT)+" seconds.";
283         }
284      }
285
286      setring R;
287      if(!ex){return(P);}
288      J=stdZ(J);
289      TQ=intersectZ(TQ,TES);
290      if(size(reduce(TQ,J))!=0)
291      {
292         //=== taking care about embedded components
293         K=stdZ(quotientZ(J,TQ));
294         ideal W=K;
295         m++;
296         while(size(reduce(intersectZ(W,TQ),J))!=0)
297         {
298            //W=stdZ(addIdealZ(I,K^m));
299            W=stdZ(addIdealZ(I,specialPowerZ(K,m)));
300            m++;
301         }
302         list E=primdecZ(W,n,TQ);
303         for(i=1;i<=size(E);i++)
304         {
305            P[size(P)+1]=E[i];
306         }
307      }
308      return(P);
309   }
310
311   //==== the ideal intersected with Z is zero
312   rl[1]=0;
313   def Rhelp=ring(rl);
314   setring Rhelp;
315   ideal J=imap(R,J);
316   J=std(J);
317   //=== the primary decomposition over Q which gives the primary decomposition
318   //=== of I:h for a suitable integer h
319   list pr=primdecGTZ(J);
320   for(i=1;i<=size(pr);i++)
321   {
322      pr[i]=list(std(pr[i][1]),std(pr[i][2]));
323   }
324   setring R;
325   list pr=imap(Rhelp,pr);
326   //=== intersection with Z[variables]
327   for(i=1;i<=size(pr);i++)
328   {
329      pr[i]=list(coefZ(pr[i][1])[1],coefZ(pr[i][2])[1]);
330   }
331   //=== find h in Z such that I is the intersection of I:h and <I,h>
332   //=== and I:h = IQ[variables] intersected with Z[varables]
333   list H =coefZ(J);
334   ideal Y=H[1];
335   int h=H[2];
336   J=J,h;
337   //=== call primary decomposition over Z for <I,h>
338   list M;
339   if(h!=1)
340   {
341       M=primdecZ(J,n,Y);
342       j=0;
343       //=== remove useless primary ideals
344       while(j<size(M))
345       {
346          j++;
347          M[j][1]=stdZ(M[j][1]);
348          for(i=1;i<=size(pr);i++)
349          {
350             if(size(reduce(pr[i][1],M[j][1]))==0)
351             {
352                M=delete(M,j);
353                j--;
354                break;
355             }
356          }
357      }
358      for(i=1;i<=size(M);i++)
359      {
360         pr[size(pr)+1]=M[i];
361      }
362   }
363   return(pr);
364}
365example
366{ "EXAMPLE:";  echo = 2;
367   ring R=integer,(a,b,c,d),dp;
368   ideal I1=9,a,b;
369   ideal I2=3,c;
370   ideal I3=11,2a,7b;
371   ideal I4=13a2,17b4;
372   ideal I5=9c5,6d5;
373   ideal I6=17,a15,b15,c15,d15;
374   ideal I=intersectZ(I1,I2);
375   I=intersectZ(I,I3);
376   I=intersectZ(I,I4);
377   I=intersectZ(I,I5);
378   I=intersectZ(I,I6);
379   primdecZ(I);
380   ideal J=intersectZ(ideal(17,a),ideal(17,a2,b));
381   primdecZ(J);
382   ideal K=intersectZ(ideal(9,a+3),ideal(9,b+3));
383   primdecZ(K);
384}
385
386///////////////////////////////////////////////////////////////////////////////
387
388proc minAssZ(ideal I)
389"USAGE:  minAssZ(I); I ideal
390RETURN:  a list pr of associated primes:
391EXAMPLE: example minAssZ; shows an example
392"
393{
394   if(size(I)==0){return(list(ideal(0)));}
395   if(deg(I[1])==0)
396   {
397      ideal J=I;
398   }
399   else
400   {
401      ideal J=stdZ(I);
402   }
403   ideal K;
404   def R=basering;
405   list rl=ringlist(R);
406   int i,j,p,m;
407   list P,B;
408   if(deg(J[1])==0)
409   {
410      //=== I intersected with Z is not zero
411      list rp=rl;
412      rp[1]=0;
413      number q=leadcoef(J[1]);
414      def Rhelp=ring(rp);
415      setring Rhelp;
416      number q=imap(R,q);
417      //=== computes the primes occuring in a generator of I intersect Z
418      list L=PollardRho(q,5000,1);
419      for(i=1;i<=size(L);i++)
420      {
421      //=== computes for all p in L the minimal associated primes of IZ/p[variables]
422         p=int(L[i]);
423         setring R;
424         rp[1]=p;
425         def S=ring(rp);
426         setring S;
427         ideal J=imap(R,J);
428         list A=minAssGTZ(J);
429         setring R;
430         B=imap(S,A);
431         kill S;
432         for(j=1;j<=size(B);j++)
433         {
434            //=== the minimal associated primes of I
435            if(B[j][1]!=1)
436            {
437               K=B[j],p;
438               K=stdZ(K);
439               P[size(P)+1]=K;
440            }
441         }
442         setring Rhelp;
443      }
444      setring R;
445      return(P);
446   }
447   //==== the ideal intersected with Z is zero
448   rl[1]=0;
449   def Rhelp=ring(rl);
450   setring Rhelp;
451   ideal J=imap(R,J);
452   J=std(J);
453   //=== the primary decomposition over Q which gives the primary decomposition
454   //=== of I:h for a suitable integer h
455   list pr=minAssGTZ(J);
456   for(i=1;i<=size(pr);i++)
457   {
458      pr[i]=std(pr[i]);
459   }
460   setring R;
461   list pr=imap(Rhelp,pr);
462   //=== intersection with Z[variables]
463   for(i=1;i<=size(pr);i++)
464   {
465      pr[i]=coefZ(pr[i])[1];
466   }
467   //=== find h in Z such that I is the intersection of I:h and I,h
468   //=== and I:h =IQ[variables] intersected with Z[varables]
469   list H=coefZ(J);
470   int h=H[2];
471   J=J,h;
472   //=== call associated primes over Z for I,h
473   list M;
474   if(h!=1)
475   {
476       M=minAssZ(J);
477       //=== remove non-minimal primes
478       j=0;
479       while(j<size(M))
480       {
481          j++;
482          M[j]=stdZ(M[j]);
483          for(i=1;i<=size(pr);i++)
484          {
485             if(size(reduce(pr[i],M[j]))==0)
486             {
487                M=delete(M,j);
488                j--;
489                break;
490             }
491          }
492      }
493      for(i=1;i<=size(M);i++)
494      {
495         pr[size(pr)+1]=M[i];
496      }
497   }
498   return(pr);
499}
500example
501{ "EXAMPLE:";  echo = 2;
502   ring R=integer,(a,b,c,d),dp;
503   ideal I1=9,a,b;
504   ideal I2=3,c;
505   ideal I3=11,2a,7b;
506   ideal I4=13a2,17b4;
507   ideal I5=9c5,6d5;
508   ideal I6=17,a15,b15,c15,d15;
509   ideal I=intersectZ(I1,I2);
510   I=intersectZ(I,I3);
511   I=intersectZ(I,I4);
512   I=intersectZ(I,I5);
513   I=intersectZ(I,I6);
514   minAssZ(I);
515   ideal J=intersectZ(ideal(17,a),ideal(17,a2,b));
516   minAssZ(J);
517   ideal K=intersectZ(ideal(9,a+3),ideal(9,b+3));
518   minAssZ(K);
519}
520
521///////////////////////////////////////////////////////////////////////////////
522
523proc heightZ(ideal I)
524"USAGE:  heightZ(I); I ideal
525RETURN:  the height of the input ideal
526EXAMPLE: example heightZ; shows an example
527"
528{
529   if(size(I)==0){return(0);}
530   if(deg(I[1])==0)
531   {
532      ideal J=I;
533   }
534   else
535   {
536      ideal J=stdZ(I);
537   }
538   ideal K=1;
539   def R=basering;
540   list rl=ringlist(R);
541   int i,j,p,m;
542   list P;
543   ideal B;
544   if(deg(J[1])==0)
545   {
546      //=== I intersected with Z is not zero
547      m=nvars(R);
548      list rp=rl;
549      rp[1]=0;
550      number q=leadcoef(J[1]);
551      def Rhelp=ring(rp);
552      setring Rhelp;
553      number q=imap(R,q);
554      //=== computes the primes occuring in a generator of I intersect Z
555      list L=PollardRho(q,5000,1);
556      for(i=1;i<=size(L);i++)
557      {
558      //=== computes for all p in L the std of IZ/p[variables]
559         p=int(L[i]);
560         setring R;
561         rp[1]=p;
562         def S=ring(rp);
563         setring S;
564         ideal J=imap(R,J);
565         j=nvars(R)-dim(std(J));
566         if(j<m){m=j;}
567         setring Rhelp;
568         kill S;
569      }
570      setring R;
571      return(m+1);
572   }
573   //==== the ideal intersected with Z is zero
574   rl[1]=0;
575   def Rhelp=ring(rl);
576   setring Rhelp;
577   ideal J=imap(R,J);
578   J=std(J);
579   m=nvars(R)-dim(J);
580   //=== the height over Q
581   //=== of I:h for a suitable integer h
582   setring R;
583   //=== find h in Z such that I is the intersection of I:h and I,h
584   //=== and I:h =IQ[variables] intersected with Z[varables]
585   list H=coefZ(J);
586   int h=H[2];
587   J=J,h;
588   //=== call height over Z for I,h
589   if(h!=1)
590   {
591      j=heightZ(J);
592      if(j<m){m=j;}
593   }
594   return(m);
595}
596example
597{ "EXAMPLE:";  echo = 2;
598   ring R=integer,(a,b,c,d),dp;
599   ideal I1=9,a,b;
600   ideal I2=3,c;
601   ideal I3=11,2a,7b;
602   ideal I4=13a2,17b4;
603   ideal I5=9c5,6d5;
604   ideal I6=17,a15,b15,c15,d15;
605   ideal I=intersectZ(I1,I2);
606   I=intersectZ(I,I3);
607   I=intersectZ(I,I4);
608   I=intersectZ(I,I5);
609   I=intersectZ(I,I6);
610   heightZ(I);
611}
612
613///////////////////////////////////////////////////////////////////////////////
614
615proc radicalZ(ideal I)
616"USAGE:  radicalZ(I); I ideal
617RETURN:  the radcal of the input ideal
618EXAMPLE: example radicalZ; shows an example
619"
620{
621   if(size(I)==0){return(ideal(0));}
622   if(deg(I[1])==0)
623   {
624      ideal J=I;
625   }
626   else
627   {
628      ideal J=stdZ(I);
629   }
630   ideal K=1;
631   def R=basering;
632   list rl=ringlist(R);
633   int i,j,p,m;
634   list P;
635   ideal B;
636   if(deg(J[1])==0)
637   {
638      //=== I intersected with Z is not zero
639      list rp=rl;
640      rp[1]=0;
641      number q=leadcoef(J[1]);
642      def Rhelp=ring(rp);
643      setring Rhelp;
644      number q=imap(R,q);
645      //=== computes the primes occuring in a generator of I intersect Z
646      list L=PollardRho(q,5000,1);
647      for(i=1;i<=size(L);i++)
648      {
649      //=== computes for all p in L the radical of IZ/p[variables]
650         p=int(L[i]);
651         setring R;
652         rp[1]=p;
653         def S=ring(rp);
654         setring S;
655         ideal J=imap(R,J);
656         ideal A=radical(J);
657         setring R;
658         B=imap(S,A);
659         kill S;
660         B=B,p;
661         B=stdZ(B);
662         K=stdZ(intersectZ(K,B));
663         setring Rhelp;
664      }
665      setring R;
666      return(K);
667   }
668   //==== the ideal intersected with Z is zero
669   rl[1]=0;
670   def Rhelp=ring(rl);
671   setring Rhelp;
672   ideal J=imap(R,J);
673   J=std(J);
674   //=== the radical over Q which gives the radical
675   //=== of I:h for a suitable integer h
676   ideal K=std(radical(J));
677   setring R;
678   K=imap(Rhelp,K);
679   //=== intersection with Z[variables]
680   K=coefZ(K)[1];
681   //=== find h in Z such that I is the intersection of I:h and I,h
682   //=== and I:h =IQ[variables] intersected with Z[varables]
683   list H=coefZ(J);
684   int h=H[2];
685   J=J,h;
686   //=== call radical over Z for I,h
687   if(h!=1)
688   {
689      ideal M=radicalZ(J);
690      K=intersectZ(K,M);
691   }
692   return(K);
693}
694example
695{ "EXAMPLE:";  echo = 2;
696   ring R=integer,(a,b,c,d),dp;
697   ideal I1=9,a,b;
698   ideal I2=3,c;
699   ideal I3=11,2a,7b;
700   ideal I4=13a2,17b4;
701   ideal I5=9c5,6d5;
702   ideal I6=17,a15,b15,c15,d15;
703   ideal I=intersectZ(I1,I2);
704   I=intersectZ(I,I3);
705   I=intersectZ(I,I4);
706   I=intersectZ(I,I5);
707   I=intersectZ(I,I6);
708   radicalZ(I);
709   ideal J=intersectZ(ideal(17,a),ideal(17,a2,b));
710   radicalZ(J);
711}
712
713///////////////////////////////////////////////////////////////////////////////
714
715proc equidimZ(ideal I)
716"USAGE:  equidimZ(I); I ideal
717RETURN:  the part of minimal height
718EXAMPLE: example equidimZ; shows an example
719"
720{
721   if(size(I)==0){return(ideal(0));}
722   if(deg(I[1])==0)
723   {
724      ideal J=I;
725   }
726   else
727   {
728      ideal J=stdZ(I);
729   }
730   int he=heightZ(J);
731   ideal K,N;
732   def R=basering;
733   number s;
734   list rl=ringlist(R);
735   int i,j,p,m,ex;
736   list P,IS,B;
737   ideal Q,JJ,E;
738   ideal TQ=1;
739   if(deg(J[1])==0)
740   {
741      //=== I intersected with Z is not zero
742      list rp=rl;
743      rp[1]=0;
744      //=== generator of I intersect Z
745      number q=leadcoef(J[1]);
746      def Rhelp=ring(rp);
747      setring Rhelp;
748      number q=imap(R,q);
749      number s;
750      //=== computes the primes occuring in a generator of I intersect Z
751      list L=PollardRho(q,5000,1);
752      list Le;
753      for(i=1;i<=size(L);i++)
754      {
755         L[i]=int(L[i]);
756         p=int(L[i]);
757         j=0;
758         s=q;
759         while((s mod p)==0)
760         {
761            j++;
762            s=s/p;
763         }
764         Le[i]=j;
765      }
766      for(i=1;i<=size(L);i++)
767      {
768      //=== computes for all p in L the minimal associated primes of IZ/p[variables]
769         p=int(L[i]);
770         j=Le[i];
771         setring R;
772         //=== maximal power of p dividing q, generator of I intersect Z
773         s=p^j;
774         rp[1]=p;
775         def S=ring(rp);
776         setring S;
777         ideal J=imap(R,J);
778         J=std(J);
779         if(nvars(R)-dim(J)+1==he)
780         {
781            if(j>1)
782            {
783               //=== p is of multiplicity >1 in q
784               list A=minAssGTZ(J);
785               j=0;
786               while(j<size(A))
787               {
788                  j++;
789                  if(dim(std(A[j]))!=nvars(R)-he+1)
790                  {
791                     A=delete(A,j);
792                     j--;
793                  }
794               }
795               setring R;
796               B=imap(S,A);
797               for(j=1;j<=size(B);j++)
798               {
799                  //=== the minimal associated primes of I
800                  K=B[j],p;
801                  K=stdZ(K);
802                  B[j]=K;
803               }
804               for(j=1;j<=size(B);j++)
805               {
806                  K=B[j];
807                  //=== compute maximal independent set for KZ/p[variables]
808                  setring S;
809                  J=imap(R,K);
810                  J=simplify(J,2);
811                  attrib(J,"isSB",1);
812                  IS=maxIndependSet(J);
813                  setring R;
814                  //=== computing the pseudo primary and extract it
815                  N=J,s;
816                  N=stdZ(N);
817                  Q=extractZ(N,j,IS,B);
818                  TQ=intersectZ(TQ,Q);
819               }
820               setring Rhelp;
821            }
822            else
823            {
824               //=== p is of multiplicity 1 in q we can compute the
825               //=== equidimensional part directly
826               ideal E=equidimMax(J);
827               setring R;
828               E=imap(S,E);
829               E=E,p;
830               E=stdZ(E);
831               TQ=intersectZ(TQ,E);
832            }
833            kill S;
834            setring Rhelp;
835         }
836      }
837      setring R;
838      return(TQ);
839   }
840   //==== the ideal intersected with Z is zero
841   rl[1]=0;
842   def Rhelp=ring(rl);
843   setring Rhelp;
844   ideal J=imap(R,J);
845   J=std(J);
846   //=== the equidimensional part over Q which gives the equdimensional part
847   //=== of I:h for a suitable integer h
848   ideal E=1;
849   if(nvars(R)-he==dim(J))
850   {
851      E=std(equidimMax(J));
852   }
853   setring R;
854   ideal  E =imap(Rhelp,E);
855   //=== intersection with Z[variables]
856   E=coefZ(E)[1];
857   //=== find h in Z such that I is the intersection of I:h and I,h
858   //=== and I:h =IQ[variables] intersected with Z[varables]
859   int h =coefZ(J)[2];
860   J=J,h;
861   //=== call equidimensional part over Z for I,h
862   ideal M;
863   if(h!=1)
864   {
865       M=equidimZ(J);
866       if(he==heightZ(M))
867       {
868          E=intersectZ(M,E);
869       }
870   }
871   return(E);
872}
873example
874{ "EXAMPLE:";  echo = 2;
875   ring R=integer,(a,b,c,d),dp;
876   ideal I1=9,a,b;
877   ideal I2=3,c;
878   ideal I3=11,2a,7b;
879   ideal I4=13a2,17b4;
880   ideal I5=9c5,6d5;
881   ideal I6=17,a15,b15,c15,d15;
882   ideal I=intersectZ(I1,I2);
883   I=intersectZ(I,I3);
884   I=intersectZ(I,I4);
885   I=intersectZ(I,I5);
886   I=intersectZ(I,I6);
887   equidimZ(I);
888}
889
890///////////////////////////////////////////////////////////////////////////////
891
892static proc modp(ideal J, int p, int nu)
893{
894//=== computes the minimal associated primes (if nu > 1) resp. the primary
895//=== decomposition (else) of J in Z/p and maps the result back to the basering
896   def R = basering;
897   list rp = ringlist(R);
898   rp[1] = p;
899   def Rp = ring(rp);
900   setring Rp;
901   ideal J = imap(R,J);
902   if(nu > 1)
903   {
904      //=== p is of multiplicity > 1 in q
905      list A = minAssGTZ(J);
906      setring R;
907      list A = imap(Rp,A);
908      return(list(A,p,nu));
909   }
910   else
911   {
912      list A = primdecGTZ(J);
913      setring R;
914      list A = imap(Rp,A);
915      return(list(A,p,nu));
916   }
917}
918
919////////////////////////////////////////////////////////////////////////////////
920
921static proc coefPrimeZ(ideal I)
922{
923//=== computes the primes occuring in the product of the leading coefficients of I
924   number h=1;
925   int i;
926   for(i=1;i<=size(I);i++)
927   {
928      h=h*leadcoef(I[i]);  //besser machen (gleich zerlegen, nict ausmultiplizieren)
929   }
930   def R=basering;
931   ring Rhelp=0,x,dp;
932   number h=imap(R,h);
933   list L=PollardRho(h,5000,1);
934   for(i=1;i<=size(L);i++){L[i]=int(L[i]);}
935   setring R;
936   return(L);
937}
938
939///////////////////////////////////////////////////////////////////////////////
940
941static proc coefZ(ideal I)
942{
943//=== assume IQ[variables]=<g_1,...,g_s>, Groebner basis, g_i in Z[variables]
944//=== computes an integer h such that
945//=== <g_1,...,g_s>Z[variables]:h^infinity = IQ[variables] intersected with Z[variables]
946//=== returns a list with IQ[variables] intersected with Z[variables] and h
947   int h=1;
948   int i,e;
949   ideal K=1;
950   list L=coefPrimeZ(I);
951   if(size(L)==0){return(list(I,1));}
952   int d=1;
953   while(d!=0)
954   {
955      i++;
956      K=quotientOneZ(I,L[i]);
957      if(size(reduce(K,I))!=0)
958      {
959         h=h*L[i];
960         I=stdZ(K);
961         e=1;
962      }
963      if(i==size(L))
964      {
965         i=0;
966         if(e)
967         {
968            e=0;
969         }
970         else
971         {
972           d=0;
973         }
974      }
975   }
976   if(h<0){h=-h;}
977   return(list(K,h));
978}
979
980///////////////////////////////////////////////////////////////////////////////
981
982static proc specialPowerZ(ideal I, int m)
983{
984//=== computes the ideal generated by the m-th power of the generators of I
985   int i;
986   for(i=1;i<=size(I);i++)
987   {
988      I[i]=I[i]^m;
989   }
990   return(I);
991}
992
993///////////////////////////////////////////////////////////////////////////////
994
995static proc separatorsZ(int j, list B)
996{
997//=== computes s such that s is not in B[j] but s is in B[i] for all i!=j
998   int i,k;
999   poly s=1;
1000   for(i=1;i<=size(B);i++)
1001   {
1002      if(i!=j)
1003      {
1004         for(k=1;k<=size(B[i]);k++)
1005         {
1006            if(reduce(B[i][k],B[j])!=0)
1007            {
1008               s=s*B[i][k];
1009               break;
1010            }
1011         }
1012      }
1013   }
1014   return(s);
1015}
1016
1017///////////////////////////////////////////////////////////////////////////////
1018
1019static proc extractZ(ideal J, int j, list L, list B)
1020{
1021   //=== P is an associated prime of J, the corresponding primary ideal is computed
1022   //=== L is a list of maximal independent sets for P in Z/p[variables]
1023   def R=basering;
1024   ideal P=B[j];
1025
1026   //=== first compute a pseudo primary ideal I, radical of I is P
1027   //=== method of Eisenbud
1028   //ideal I=addIdealZ(J,specialPowerZ(P,20));
1029
1030   //=== method of Shimoyama-Yokoyama
1031   poly s=separatorsZ(j,B);
1032   ideal I=satZ(J,s);
1033   //=== size(L)=0 means P is maximal ideal and I is primary
1034   if(size(L)>0)
1035   {
1036      if(L[1][3]!=0)
1037      {
1038         //=== if u in x is an independent set of L then we compute a Groebnerbasis in Z[u][x-u]
1039         execute("ring S=integer,("+L[1][1]+"),lp;");
1040         ideal I=imap(R,I);
1041         I=stdZ(I);
1042         list rl=ringlist(S);
1043         rl[1]=0;
1044         def Shelp =ring(rl);
1045         setring Shelp;
1046         ideal I=imap(S,I);
1047         I[1]=0;
1048         I=simplify(I,2);
1049         //=== this is our way to obtain the coefficients in Z[u] of the
1050         //=== leading terms of the Groebner basis above
1051         string quotring=prepareQuotientring(nvars(basering)-L[1][3]);
1052         execute(quotring);
1053         ideal I=imap(Shelp,I);
1054         list C;
1055         int i;
1056         for(i=1;i<=size(I);i++)
1057         {
1058            C[i]=leadcoef(I[i]);
1059         }
1060         setring Shelp;
1061         list C=imap(quring,C);
1062
1063         setring R;
1064         list C=imap(Shelp,C);
1065      }
1066      else
1067      {
1068         I=stdZ(I);
1069         list C;
1070         int i;
1071         for(i=1;i<=size(I);i++)
1072         {
1073            C[i]=I[i];
1074         }
1075         list rl=ringlist(R);
1076         rl[1]=0;
1077         def Shelp =ring(rl);
1078      }
1079      poly h=1;
1080      for(i=1;i<=size(C);i++)
1081      {
1082         if(deg(C[i])>0){h=h*C[i];}  //das muss noch besser gemacht werden, nicht ausmultiplizieren!
1083      }
1084      setring Shelp;
1085      poly h=imap(R,h);
1086      ideal fac=factorize(h,1);
1087      setring R;
1088      ideal fac=imap(Shelp,fac);
1089      for(i=1;i<=size(fac);i++)
1090      {
1091         I=satZ(I,fac[i]);
1092      }
1093   }
1094   I=stdZ(I);
1095   return(I);
1096}
1097///////////////////////////////////////////////////////////////////////////////
1098
1099static proc normalizeZ(ideal I)
1100{
1101//=== if I[1]=q in Z, it replaces all other coeffs of polys in I by there value mod q
1102//=== std should do this automatically and then tis procedure should be removed
1103   if(deg(I[1])>0){return(I);}
1104   int i,j;
1105   number n;
1106   poly p;
1107   for(i=2;i<=size(I);i++)
1108   {
1109      j=1;
1110      while(j<=size(I[i]))
1111      {
1112         n=leadcoef(I[i][j]) mod leadcoef(I[1]);
1113         p=n*leadmonom(I[i][j]);
1114         I[i]=I[i]-I[i][j]+p;
1115         if(p!=0){j++;}
1116      }
1117   }
1118   return(I);
1119}
1120
1121///////////////////////////////////////////////////////////////////////////////
1122
1123static proc satZ(ideal I,poly h)
1124{
1125//=== saturates I by h
1126   ideal J=quotientOneZ(I,h);
1127   while(size(reduce(J,stdZ(I)))!=0)
1128   {
1129      I=J;
1130      J=quotientOneZ(I,h);
1131      J=normalizeZ(J);
1132   }
1133   return(J);
1134}
1135
1136///////////////////////////////////////////////////////////////////////////////
1137
1138static proc prepareQuotientring (int nnp)
1139{
1140//=== this is from primdec.lib, it is static there, should be imported later
1141//=== if it is no more static
1142  ideal @ih,@jh;
1143  int npar=npars(basering);
1144  int @n;
1145
1146  string quotring= "ring quring = ("+charstr(basering);
1147  for(@n=nnp+1;@n<=nvars(basering);@n++)
1148  {
1149     quotring=quotring+",var("+string(@n)+")";
1150     @ih=@ih+var(@n);
1151  }
1152
1153  quotring=quotring+"),(var(1)";
1154  @jh=@jh+var(1);
1155  for(@n=2;@n<=nnp;@n++)
1156  {
1157     quotring=quotring+",var("+string(@n)+")";
1158     @jh=@jh+var(@n);
1159  }
1160  quotring=quotring+"),(C,lp);";
1161
1162  return(quotring);
1163}
1164
1165///////////////////////////////////////////////////////////////////////////////
1166
1167static proc maxIndependSet (ideal j)
1168{
1169//=== this is from primdec.lib, it is static there, should be imported later
1170//=== if it is no more static
1171  int n,k,di;
1172
1173  list resu,hilf;
1174  if(size(j)==0)
1175  {
1176     resu[1]=varstr(basering);
1177     resu[2]=ordstr(basering);
1178     resu[3]=0;
1179     return(list(resu));
1180  }
1181  string var1,var2;
1182  list v=indepSet(j,0);
1183
1184  for(n=1;n<=size(v);n++)
1185  {
1186    di=0;
1187    var1="";
1188    var2="";
1189    for(k=1;k<=size(v[n]);k++)
1190    {
1191      if(v[n][k]!=0)
1192      {
1193        di++;
1194        var2=var2+"var("+string(k)+"),";
1195      }
1196      else
1197      {
1198        var1=var1+"var("+string(k)+"),";
1199      }
1200    }
1201    if(di>0)
1202    {
1203      var1=var1+var2;
1204      var1=var1[1..size(var1)-1];
1205      hilf[1]=var1;
1206      hilf[2]="lp";
1207      hilf[3]=di;
1208      resu[n]=hilf;
1209    }
1210    else
1211    {
1212      resu[n]=varstr(basering),ordstr(basering),0;
1213    }
1214  }
1215  return(resu);
1216}
1217
1218///////////////////////////////////////////////////////////////////////////////
1219
1220static proc quotientOneZ(ideal I, poly f)
1221{
1222//=== this is needed because quotient(I,f) does not work properly, should be
1223//=== replaced by quotient later
1224   def R=basering;
1225   int i;
1226   ideal K=intersectZ(I,ideal(f));
1227   //=== K[i]/f; does not work in rings with integer! This should be replaced later
1228   execute("ring Rhelp=0,("+varstr(R)+"),dp;");
1229   ideal K=imap(R,K);
1230   poly f=imap(R,f);
1231   for(i=1;i<=size(K);i++)
1232   {
1233      K[i]=K[i]/f;
1234   }
1235   setring R;
1236   K=imap(Rhelp,K);
1237   return(K);
1238}
1239
1240///////////////////////////////////////////////////////////////////////////////
1241
1242static proc quotientZ(ideal I, ideal J)
1243{
1244//=== this is needed because quotient(I,J) does not work properly, should be
1245//=== replaced by quotient later
1246   int i;
1247   ideal K=quotientOneZ(I,J[1]);
1248   for(i=2;i<=size(J);i++)
1249   {
1250      K=intersectZ(K,quotientOneZ(I,J[i]));
1251   }
1252   return(K);
1253}
1254
1255///////////////////////////////////////////////////////////////////////////////
1256
1257static proc reduceZ(poly f, ideal I)
1258{
1259//=== this is needed because reduce(f,I) does not work properly, should be
1260//=== replaced by reduce later
1261   if(f==0){return(f);}
1262   def R=basering;
1263   execute("ring Rhelp=0,("+varstr(R)+"),dp;");
1264   ideal I=imap(R,I);
1265   poly f=imap(R,f);
1266   int i,j;
1267   poly m;
1268   number n;
1269   while(!i)
1270   {
1271      i=1;
1272      j=0;
1273      while(j<size(I))
1274      {
1275         j++;
1276         m=leadmonom(f)/leadmonom(I[j]);
1277         if(m!=0)
1278         {
1279            n=leadcoef(f) mod leadcoef(I[j]);
1280            if(n==0)
1281            {
1282               f=f-leadcoef(f)/leadcoef(I[j])*m*I[j];
1283               if(f==0){setring R;return(0);}
1284               i=0;
1285               break;
1286            }
1287            if(n!=leadcoef(f))
1288            {
1289               f=f+(n-leadcoef(f))/leadcoef(I[j])*m*I[j];
1290               i=0;
1291               break;
1292            }
1293         }
1294      }
1295   }
1296   setring R;
1297   f=imap(Rhelp,f);
1298   return(lead(f)+reduceZ(f-lead(f),I));
1299}
1300
1301///////////////////////////////////////////////////////////////////////////////
1302
1303static proc stdZ(ideal I)
1304{
1305//=== this is needed because we want the leading coefficients to be positive
1306//=== otherwhise reduce gives wrong results! should be replaced later by std
1307   I=simplify(I,2);
1308   I=normalizeZ(I);
1309   ideal J=std(I);
1310   int i;
1311   for(i=1;i<=size(J);i++)
1312   {
1313      if(leadcoef(J[i])<0){J[i]=-J[i];}
1314   }
1315   J=normalizeZ(J);
1316   attrib(J,"isSB",1);
1317   return(J);
1318}
1319
1320///////////////////////////////////////////////////////////////////////////////
1321
1322static proc intersectZ(ideal I, ideal J)
1323{
1324//=== this is needed because intersect(I,J) does not work, should be replaced
1325//=== by intersect later
1326   def R = basering;
1327   execute("ring S=integer,(t,"+varstr(R)+"),(dp(1),dp(nvars(R)));");
1328   ideal I=imap(R,I);
1329   ideal J=imap(R,J);
1330   ideal K=addIdealZ(t*I,(1-t)*J);
1331   K=stdZ(K);
1332   int i;
1333   ideal L;
1334   for(i=1;i<=size(K);i++)
1335   {
1336      if(lead(K[i])/t==0){L[size(L)+1]=K[i];}
1337   }
1338   setring R;
1339   ideal L=imap(S,L);
1340   return(L);
1341}
1342
1343///////////////////////////////////////////////////////////////////////////////
1344
1345static proc addIdealZ(ideal I,ideal J)
1346{
1347//=== this is needed because I+J does not work, should be replaced by + later
1348   int i;
1349   for(i=1;i<=size(J);i++)
1350   {
1351      I[size(I)+1]=J[i];
1352   }
1353   return(I);
1354}
1355
1356///////////////////////////////////////////////////////////////////////////////
1357
1358static proc testPrimaryZ(ideal I, list L)
1359{
1360//=== test whether I is the intersection of the primary ideals in L
1361   int i;
1362   ideal K=L[1][1];
1363   for(i=2;i<=size(L);i++)
1364   {
1365      K=intersectZ(K,L[i][1]);
1366   }
1367   i=size(reduce(K,stdZ(I)))+size(reduce(I,stdZ(K)));
1368   if(!i){return(1);}
1369   return(0);
1370}
1371
1372///////////////////////////////////////////////////////////////////////////////
1373
1374/*
1375Examples:
1376
1377//=== IQ[a,b,c,d,e,f,g] intersect Z[a,b,c,d,e,f,g] = I  (takes some time)
1378ring R1=integer,(a,b,c,d,e,f,g),dp;
1379ideal I=a2+2de+2cf+2bg+a,
1380        2ab+e2+2df+2cg+b,
1381        b2+2ac+2ef+2dg+c,
1382        2bc+2ad+f2+2eg+d,
1383        c2+2bd+2ae+2fg+e,
1384        2cd+2be+2af+g2+f,
1385        d2+2ce+2bf+2ag+g;
1386
1387ring R2=integer,(a,b,c,d,e,f,g),dp;
1388ideal I=181*32003,
1389        a2+2de+2cf+2bg+a,
1390        2ab+e2+2df+2cg+b,
1391        b2+2ac+2ef+2dg+c,
1392        2bc+2ad+f2+2eg+d,
1393        c2+2bd+2ae+2fg+e,
1394        2cd+2be+2af+g2+f,
1395        d2+2ce+2bf+2ag+g;
1396 
1397ring R3=integer,(w,z,y,x),dp;
1398ideal I=xzw+(-y^2+y)*z^2,
1399         (-x^2+x)*w^2+yzw,
1400         ((y^4-2*y^3+y^2)*x-y^4+y^3)*z^3,
1401         y2z2w+(-y*4+2*y^3-y^2)*z3;
1402
1403ring R4=integer,(w,z,y,x),dp;
1404ideal I=-2*yxzw+(-yx-y^2+y)*z^2,
1405         xw^2-yz^2,
1406         (yx^2-(2*y^2+2*y)*x+y^3-2*y^2+y)*z^3,
1407         (-2*y^2+2*y)*z^2*w+(yx-3*y^2-y)*z^3;
1408
1409ring R5=integer,(x,y,z),dp;
1410ideal I=x2-y2-z2,
1411        xy-z2,
1412        y3+xz2-yz2+2z3+xy-z2,
1413        -y2z2+2z4+x2-y2+z2,
1414        y3z9+3y2z10+3yz11+z12-y2z2+2z4;
1415
1416ring R6=integer,(h, l, s, x, y, z),dp;  //takes some time
1417ideal I=hl-l2-4ls+hy,
1418        h2s-6ls3+h2z,
1419        xh2-l2s-h3;
1420
1421ring R7=integer,(x,y,z),dp;
1422ideal I=x2-y2-(z+2)^2,
1423        xy-(z+2)^2,
1424        y3+x*(z+2)^2-y*(z+2)^2+2*(z+2)^3+xy-(z+2)^2,
1425        -y^2*(z+2)^2+2*(z+2)^4+x2-y2+(z+2)^2,
1426        y3z9+3y2z10+3yz11+z12-y2z2+2z4;
1427
1428ring R8=integer,(x,y,z),dp;
1429ideal I=x2-y2-(z+2)^2,
1430        xy-(z+2)^2,
1431        y3+x*(z+2)^2-y*(z+2)^2+2*(z+2)^3+xy-(z+2)^2,
1432        -y^2*(z+2)^2+2*(z+2)^4+x2-y2+(z+2)^2,
1433        y3z9+3y2z10+3yz11+z12-y2z2+2z4;
1434
1435ring R9=integer,(w,z,y,x),dp;
1436ideal I=630,
1437        ((y^2-y)*x-y^3+y^2)*z^2,
1438        (x-y)*zw,
1439        (x-y^2)*zw+(-y^2+y)*z^2,
1440        (-x^2+x)*w^2+(-yx+y)*zw;
1441
1442ring R10=integer,(w,z,y,x),dp;
1443ideal I=1260,
1444        -yxzw+(-y^2+y)*z^2,
1445        (-x^2+x)*w^2-yxzw,
1446        ((-y^2+y)*x-y^3+2*y^2-y)*z^3,
1447        (y^2-y)*z^2*w+(-y^2+y)*z^2*w+(-y^2+y)*z^3;
1448
1449ring R11=integer,(w,z,y,x),dp;
1450ideal I=(4*y^2*x^2+(4*y^3+4*y^2-y)*x-y^2-y)*z^2,
1451         (x+y+1)*zw+(-4*y^2*x-4*y^3-4*y^2)*z^2,
1452         (-x-2*y^2 - 2*y - 1)*zw + (8*y^3*x + 8*y^4 + 8*y^3 + 2*y^2+y)*z^2,
1453         ((y^3 + y^2)*x - y^2 - y)*z^2,
1454         (y +1)*zw + (-y^3 -y^2)*z^2,
1455         (x + 1)*zw +(- y^2 -y)*z^2,
1456         (x^2 +x)*w^2 + (-yx - y)*zw;
1457
1458ring R12=integer,(w,z,y,x),dp;
1459ideal I=72,
1460        ((y^3 + y^2)*x - y^2 - y)*z^2,
1461        (y + 1)*zw + (-y^3 -y^2)*z^2,
1462        (x + 1)*zw + (-y^2 -y)*z^2, (x^2 + x)*w^2 + (-yx - y)*zw;
1463
1464ring R13=integer,(w,z,y,x),dp;
1465ideal I= (((12*y+8)*x^2 +(2*y+2)*x)*zw +((-15*y^2 -4*y)*x-4*y^2 -y)*z^2,
1466        -x*w^2 +((-12*y -8)*x+2*y)*zw +(15*y^2+4*y)*z^2,
1467        (81*y^4*x^2 +(-54*y^3 -12*y^2)*x-12*y^3 -3*y^2)*z^3, 
1468        (-24*yx+6*y^2-6*y)*z^2*w + (-81*y^4*x + 81*y^3 + 24*y^2)*z^3,
1469        (48*x^2 + (-30*y + 12)*x - 6*y)*z^2*w + ((81*y^3 -54*y^2 -24*y)*x-21*y^2 -6*y)*z^3,
1470        (-96*yx-18*y^3 +18*y^2-24*y)*z^2*w +(243*y^5*x-243*y^4 +72*y^3+48*y^2)*z^3,
1471         6*y*z^2*w^2 +((576*y+384)*x^2 + (-81*y^3 -306*y^2 -168*y+96)*x+81*y^2-18*y)*z^3*w +((-720*y^2 - 192*y)*x + 450*y^3 - 60*y^2 - 48*y)*z^4);
1472
1473ring R14=integer,(x(1),x(2),x(3),x(4)),dp;
1474ideal I= 181*49^2,
1475         x(4)^4,
1476         x(1)*x(4)^3,
1477         x(1)*x(2)*x(4)^2,
1478         x(2)^2*x(4)^2,
1479         x(2)^2*x(3)*x(4),
1480         x(1)*x(2)*x(3)*x(4),
1481         x(1)*x(3)^2*x(4),
1482         x(3)^3*x(4);
1483
1484
1485ring R15=integer,(x,y,z),dp;  
1486ideal I=32003*181*64,
1487        ((z^2-z)*y^2 + (z^2 -z)*y)*x; (z*y^3 + z*y^2)*x,
1488        (y^4 - y^2)*x, (z^2 - z)*y*x^2, (y^3 - y^2)*x^2,
1489        (z^3 - z^2)*x^4 + (2*z^3 -2*z^2)*x^3 + (z^3 -z^2)*x^2,
1490        z*y^2*x^2, z*y*x^4 +z*y*x^3,
1491        2*y^2*x^4 +6*y^2*x^3 +6*y^2*x^2 + (y^3 +y^2)*x, z*x^5 + (z^2 +z)*x^4 + (2*z^2 -z)*x^3 + (z^2 -z)*x^2,
1492        y*x^6 + 3*y*x^5 + 3*y*x^4 + y*x^3;
1493
1494
1495ring R16=integer,(x(1),x(2),x(3),x(4),x(5)),dp;
1496ideal I=x(5)^5,
1497        x(1)*x(5)^4,
1498        x(1)*x(2)*x(5)^3,
1499        x(2)^2*x(5)^3,
1500        x(2)^2*x(3)*x(5)^2,
1501        x(1)*x(2)*x(3)*x(5)^2,
1502        x(1)*x(3)^2*x(5)^2, 
1503        x(3)^3*x(5)^2,
1504        x(3)^3*x(4)*x(5),
1505        x(1)*x(3)^2*x(4)*x(5),
1506        x(1)*x(2)*x(3)*x(4)*x(5),
1507        x(2)^2*x(3)*x(4)*x(5),
1508        x(2)^2*x(4)^2*x(5), 
1509        x(1)*x(2)*x(4)^2*x(5),
1510        x(1)*x(4)^3*x(5),
1511        x(4)^4*x(5);
1512      I=intersectZ(I,ideal(64*181,x(1)^2));
1513
1514ring R17=integer,(x,y,z),dp;  
1515ideal I=374,
1516        (z+2)^8-140z6+2622*(z+2)^4-1820*(z+2)^2+169,
1517        17y*(z+2)^4-374*y*(z+2)^2+221y+2z7-281z5+5240z3-3081z,
1518      Â  204y2+136yz3-3128yz+z6-149z4+2739z2+117,
1519        17xz4-374xz2+221x+2z7-281z5+5240z3-3081z,
1520        136xy-136xz-136yz+2z6-281z4+5376z2-3081,
1521        204x2+136xz3-3128xz+z6-149z4+2739z2+117;
1522
1523ring R18=integer,(B,D,F,b,d,f),dp;
1524ideal I=6,
1525        (b-d)*(B-D)-2*F+2,
1526        (b-d)*(B+D-2*F)+2*(B-D),
1527        (b-d)^2-2*(b+d)+f+1,
1528        B^2*b^3-1,
1529        D^2*d^3-1,
1530        F^2*f^3-1;
1531
1532ring R19=integer,(a,b,c,d,e,f),dp;
1533ideal I=24,
1534        2*(f+2)*b+2ec+d2+a2+a,
1535        2*(f+2)*c+2ed+2ba+b,
1536        2*(f+2)*d+e2+2ca+c+b2,
1537        2*(f+2)*e+2da+d+2cb,
1538        (f+2)^2+2ea+e+2db+c2,
1539        2*(f+2)*a+f+2eb+2dc;
1540
1541ring R20=integer,(x,y,z,w,u),dp;
1542ideal I=24,
1543         2x2-2y2+2z2-2w2+2u2-1,
1544         2x3-2y3+2z3-2w3+2u3-1,
1545         2x4-2y4+2z4-2w4+2u4-1,
1546         2x5-2y5+2z5-2w5+2u5-1,
1547         2x6-2y6+2z6-2w6+2u6-1;
1548
1549ring R21=integer,(x,y,z,t,u,v,h),dp;
1550ideal I=66,
1551        2x2+2y2+2z2+2t2+2u2+v2-vh,
1552        xy+yz+2zt+2tu+2uv-uh,
1553        2xz+2yt+2zu+u2+2tv-th,
1554        2xt+2yu+2tu+2zv-zh,
1555        t2+2xv+2yv+2zv-yh,
1556        2x+2y+2z+2t+2u+v-h,
1557        x3+y3+z3+t3+u3+v3;
1558
1559ring R22=integer,(s,p,S,P,T,F,f),dp;  
1560ideal I=35,
1561        2*T-S*s-2*F+2,
1562        8*F*p-4*p*S-2*F*s^2+S*s^2+4*T-2*S*s,
1563        -2*s-4*p+s^2+f+1,
1564        s*T^2-p*s*P-p*S*T-2,
1565        p^3*P^2-1,
1566        F^2*f^3-1;
1567*/
Note: See TracBrowser for help on using the repository browser.