source: git/Singular/LIB/primdecint.lib @ 2ab830

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