source: git/Singular/LIB/elim.lib @ 0ae4ce

spielwiese
Last change on this file since 0ae4ce was 0ae4ce, checked in by Anne Frühbis-Krüger <anne@…>, 23 years ago
*anne: added category to libraries for "Commutative Algebra" git-svn-id: file:///usr/local/Singular/svn/trunk@4941 2c84dea3-7e68-4137-9b89-c4e89433aadc
  • Property mode set to 100644
File size: 10.5 KB
RevLine 
[0ae4ce]1// $Id: elim.lib,v 1.10 2000-12-19 14:41:42 anne Exp $
[6f2edc]2// (GMG, last modified 22.06.96)
[3d124a7]3///////////////////////////////////////////////////////////////////////////////
4
[0ae4ce]5version="$Id: elim.lib,v 1.10 2000-12-19 14:41:42 anne Exp $";
6category="Commutative Algebra";
[5480da]7info="
[3d124a7]8LIBRARY:  elim.lib      PROCEDURES FOR ELIMINATIOM, SATURATION AND BLOWING UP
9
[f34c37c]10PROCEDURES:
[6f2edc]11 blowup0(j[,s1,s2]);    create presentation of blownup ring of ideal j
[3d124a7]12 elim(id,n,m);          variable n..m eliminated from id (ideal/module)
[6f2edc]13 elim1(id,p);           p=product of vars to be eliminated from id
[3d124a7]14 nselect(id,n[,m]);     select generators not containing nth [..mth] variable
[6f2edc]15 sat(id,j);             saturated quotient of ideal/module id by ideal j
[091424]16 select(id,n[,m]);      select generators containing all variables n...m
17 select1(id,n[,m]);     select generators containing one variable n...m
[3d124a7]18           (parameters in square brackets [] are optional)
[5480da]19";
[3d124a7]20
21LIB "inout.lib";
22LIB "general.lib";
23LIB "poly.lib";
24///////////////////////////////////////////////////////////////////////////////
25
26proc blowup0 (ideal j,list #)
[d2b2a7]27"USAGE:   blowup0(j[,s1,s2]); j ideal, s1,s2 nonempty strings
[6f2edc]28CREATE:  Create a presentation of the blowup ring of j
[3d124a7]29RETURN:  no return value
30NOTE:    s1 and s2 are used to give names to the blownup ring and the blownup
[d2b2a7]31         ideal (default: s1=\"j\", s2=\"A\")
32         Assume R = char,x(1..n),ord is the basering of j, and s1=\"j\", s2=\"A\"
[6f2edc]33         then the procedure creates a new ring with name Bl_jR
[3d124a7]34         (equal to R[A,B,...])
[6f2edc]35               Bl_jR = char,(A,B,...,x(1..n)),(dp(k),ord)
36         with k=ncols(j) new variables A,B,... and ordering wp(d1..dk) if j is
[3d124a7]37         homogeneous with deg(j[i])=di resp. dp otherwise for these vars.
[d2b2a7]38         If k>26 or size(s2)>1, say s2=\"A()\", the new vars are A(1),...,A(k).
[3d124a7]39         Let j_ be the kernel of the ring map Bl_jR -> R defined by A(i)->j[i],
40         x(i)->x(i), then the quotient ring Bl_jR/j_ is the blowup ring of j
41         in R (being isomorphic to R+j+j^2+...). Moreover the procedure creates
[6f2edc]42         a std basis of j_ with name j_ in Bl_jR.
43         This proc uses 'execute' or calls a procedure using 'execute'.
44DISPLAY: printlevel >=0: explain created objects (default)
45EXAMPLE: example blowup0; shows examples
[d2b2a7]46"{
[3d124a7]47   string bsr = nameof(basering);
48   def br = basering;
[6f2edc]49   string cr,vr,o = charstr(br),varstr(br),ordstr(br);
50   int n,k,i = nvars(br),ncols(j),0;
51   int p = printlevel-voice+3;  // p=printlevel+1 (default: p=1)
[3d124a7]52//---------------- create coordinate ring of blown up space -------------------
53   if( size(#)==0 ) { #[1] = "j"; #[2] = "A"; }
54   if( size(#)==1 ) { #[2] = "A"; }
55   if( k<=26 and size(#[2])==1 ) { string nv = A_Z(#[2],k)+","; }
56   else { string nv = (#[2])[1]+"(1.."+string(k)+"),"; }
[6f2edc]57   if( is_homog(j) )
58   {
[3d124a7]59      intvec v=1;
[6f2edc]60      for( i=1; i<=k; i=i+1) { v[i+1]=deg(j[i]); }
[3d124a7]61      string nor = "),(wp(v),";
62   }
63   else { string nor = "),(dp(1+k),";}
64   execute("ring Bl=("+cr+"),(t,"+nv+vr+nor+o+");");
65//---------- map to new ring, eliminate and create blown up ideal -------------
66   ideal j=imap(br,j);
[6f2edc]67   for( i=1; i<=k; i=i+1) { j[i]=var(1+i)-t*j[i]; }
[3d124a7]68   j=eliminate(j,t);
69   v=v[2..size(v)];
70   execute("ring Bl_"+#[1]+bsr+"=("+cr+"),("+nv+vr+nor+o+");");
71   ideal `#[1]+"_"`=imap(Bl,j);
72   export basering;
73   export `#[1]+"_"`;
[6f2edc]74   //keepring basering;
75   setring br;
[3d124a7]76//------------------- some comments about usage and names  --------------------
[6f2edc]77dbprint(p,"",
78"// The proc created the ring Bl_"+#[1]+bsr+" (equal to "+bsr+"["+nv[1,size(nv)-1]+"])",
79"// it contains the ideal "+#[1]+"_ , such that",
80"//             Bl_"+#[1]+bsr+"/"+#[1]+"_ is the blowup ring",
81"// show(Bl_"+#[1]+bsr+"); shows this ring.",
82"// Make Bl_"+#[1]+bsr+" the basering and see "+#[1]+"_ by typing:",
83"   setring Bl_"+#[1]+bsr+";","   "+#[1]+"_;");
[3d124a7]84   return();
85}
[6f2edc]86example
[3d124a7]87{ "EXAMPLE:"; echo = 2;
88   ring R=0,(x,y),dp;
[6f2edc]89   poly f=y2+x3; ideal j=jacob(f);
[3d124a7]90   blowup0(j);
[6f2edc]91   show(Bl_jR);
92   setring Bl_jR;
93   j_;"";
[3d124a7]94   ring r=32003,(x,y,z),ds;
95   blowup0(maxideal(1),"m","T()");
[6f2edc]96   show(Bl_mr);
97   setring Bl_mr;
[3d124a7]98   m_;
[6f2edc]99   kill Bl_jR, Bl_mr;
[3d124a7]100}
101///////////////////////////////////////////////////////////////////////////////
102
103proc elim (id, int n, int m)
[d2b2a7]104"USAGE:   elim(id,n,m);  id ideal/module, n,m integers
[6f2edc]105RETURNS: ideal/module obtained from id by eliminating variables n..m
106NOTE:    no special monomial ordering is required, result is a SB with
107         respect to ordering dp (resp. ls) if the first var not to be
108         eliminated belongs to a -p (resp. -s) blockordering
109         This proc uses 'execute' or calls a procedure using 'execute'.
110EXAMPLE: example elim; shows examples
[d2b2a7]111"
[3d124a7]112{
113//---- get variables to be eliminated and create string for new ordering ------
114   int ii; poly vars=1;
[6f2edc]115   for( ii=n; ii<=m; ii=ii+1 ) { vars=vars*var(ii); }
[3d124a7]116   if( n>1 ) { poly p = 1+var(1); }
117   else { poly p = 1+var(m+1); }
118   if( ord(p)==0 ) { string ordering = "),ls;"; }
119   if( ord(p)>0 ) { string ordering = "),dp;"; }
[a286e70]120   string mpoly=string(minpoly);
[3d124a7]121//-------------- create new ring and map objects to new ring ------------------
122   def br = basering;
[6f2edc]123   string str = "ring @newr = ("+charstr(br)+"),("+varstr(br)+ordering;
[3d124a7]124   execute(str);
[a286e70]125   if (mpoly!="0") { execute("minpoly="+mpoly+";"); }
[3d124a7]126   def i = imap(br,id);
127   poly vars = imap(br,vars);
128//---------- now eliminate in new ring and map back to old ring ---------------
129   i = eliminate(i,vars);
130   setring br;
[6f2edc]131   return(imap(@newr,i));
[3d124a7]132}
[6f2edc]133example
[3d124a7]134{ "EXAMPLE:"; echo = 2;
135   ring r=0,(x,y,u,v,w),dp;
136   ideal i=x-u,y-u2,w-u3,v-x+y3;
[6f2edc]137   elim(i,3,4);
[3d124a7]138   module m=i*gen(1)+i*gen(2);
[6f2edc]139   m=elim(m,3,4);show(m);
[3d124a7]140}
[6f2edc]141///////////////////////////////////////////////////////////////////////////////
[3d124a7]142
143proc elim1 (id, poly vars)
[d2b2a7]144"USAGE:   elim1(id,poly); id ideal/module, poly=product of vars to be eliminated
[3d124a7]145RETURN:  ideal/module obtained from id by eliminating vars occuring in poly
146NOTE:    no special monomial ordering is required, result is a SB with
147         respect to ordering dp (resp. ls) if the first var not to be
148         eliminated belongs to a -p (resp. -s) blockordering
[6f2edc]149         This proc uses 'execute' or calls a procedure using 'execute'.
150EXAMPLE: example elim1; shows examples
[d2b2a7]151"
[3d124a7]152{
153//---- get variables to be eliminated and create string for new ordering ------
[6f2edc]154   int ii;
155   for( ii=1; ii<=nvars(basering); ii=ii+1 )
156   {
157      if( vars/var(ii)==0 ) { poly p = 1+var(ii); break;}
[3d124a7]158   }
159   if( ord(p)==0 ) { string ordering = "),ls;"; }
160   if( ord(p)>0 ) { string ordering = "),dp;"; }
161//-------------- create new ring and map objects to new ring ------------------
162   def br = basering;
[6f2edc]163   string str = "ring @newr = ("+charstr(br)+"),("+varstr(br)+ordering;
[3d124a7]164   execute(str);
165   def id = fetch(br,id);
166   poly vars = fetch(br,vars);
167//---------- now eliminate in new ring and map back to old ring ---------------
168   id = eliminate(id,vars);
169   setring br;
[6f2edc]170   return(imap(@newr,id));
[3d124a7]171}
[6f2edc]172example
[3d124a7]173{ "EXAMPLE:"; echo = 2;
174   ring r=0,(x,y,t,s,z),dp;
175   ideal i=x-t,y-t2,z-t3,s-x+y3;
[6f2edc]176   elim1(i,ts);
[3d124a7]177   module m=i*gen(1)+i*gen(2);
[6f2edc]178   m=elim1(m,st); show(m);
[3d124a7]179}
[6f2edc]180///////////////////////////////////////////////////////////////////////////////
[3d124a7]181
182proc nselect (id, int n, list#)
[d2b2a7]183"USAGE:   nselect(id,n[,m]); id a module or ideal, n, m integers
[3d124a7]184RETURN:  generators of id not containing the variable n [up to m]
[6f2edc]185EXAMPLE: example nselect; shows examples
[d2b2a7]186"{
[3d124a7]187   int j,k;
[6f2edc]188   if( size(#)==0 ) { #[1]=n; }
189   for( k=1; k<=ncols(id); k=k+1 )
190   {  for( j=n; j<=#[1]; j=j+1 )
191      {  if( size(id[k]/var(j))!=0) { id[k]=0; break; }
[3d124a7]192      }
193   }
194   return(simplify(id,2));
195}
[6f2edc]196example
[3d124a7]197{ "EXAMPLE:"; echo = 2;
198   ring r=0,(x,y,t,s,z),(c,dp);
199   ideal i=x-y,y-z2,z-t3,s-x+y3;
200   nselect(i,3);
[6f2edc]201   module m=i*(gen(1)+gen(2));
[3d124a7]202   show(m);
203   show(nselect(m,3,4));
204}
205///////////////////////////////////////////////////////////////////////////////
206
207proc sat (id, ideal j)
[d2b2a7]208"USAGE:   sat(id,j);  id=ideal/module, j=ideal
[6f2edc]209RETURN:  list of an ideal/module [1] and an integer [2]:
210         [1] = saturation of id with respect to j (= union_(k=1...) of id:j^k)
211         [2] = saturation exponent (= min( k | id:j^k = id:j^(k+1) ))
212NOTE:    [1] is a standard basis in the basering
213DISPLAY: saturation exponent during computation if printlevel >=1
[3d124a7]214EXAMPLE: example sat; shows an example
[d2b2a7]215"{
[3d124a7]216   int ii,kk;
[6f2edc]217   def i=id;
218   id=std(id);
219   int p = printlevel-voice+3;  // p=printlevel+1 (default: p=1)
[3d124a7]220   while( ii<=size(i) )
[6f2edc]221   {
222      dbprint(p-1,"// compute quotient "+string(kk+1));
[3d124a7]223      i=quotient(id,j);
[6f2edc]224      for( ii=1; ii<=size(i); ii=ii+1 )
[3d124a7]225      {
[530a3c]226         if( reduce(i[ii],id,1)!=0 ) break;
[3d124a7]227      }
228      id=std(i); kk=kk+1;
229   }
[6f2edc]230   dbprint(p-1,"// saturation becomes stable after "+string(kk-1)+" iteration(s)","");
231   list L = id,kk-1;
232   return (L);
[3d124a7]233}
[6f2edc]234example
[3d124a7]235{ "EXAMPLE:"; echo = 2;
[6f2edc]236   int p      = printlevel;
237   ring r     = 2,(x,y,z),dp;
238   poly F     = x5+y5+(x-y)^2*xyz;
239   ideal j    = jacob(F);
240   sat(j,maxideal(1));
241   printlevel = 2;
242   sat(j,maxideal(2));
243   printlevel = p;
[3d124a7]244}
245///////////////////////////////////////////////////////////////////////////////
246
247proc select (id, int n, list#)
[d2b2a7]248"USAGE:   select(id,n[,m]); id ideal/module, n, m integers
[091424]249RETURN:  generators of id containing the variable n [all variables up to m]
250NOTE:    use 'select1' for selecting generators containing at least one of the
251         variables between n and m
[6f2edc]252EXAMPLE: example select; shows examples
[d2b2a7]253"{
[3d124a7]254   if( size(#)==0 ) { #[1]=n; }
255   int j,k;
[6f2edc]256   for( k=1; k<=ncols(id); k=k+1 )
257   {  for( j=n; j<=#[1]; j=j+1 )
258      {   if( size(id[k]/var(j))==0) { id[k]=0; break; }
[3d124a7]259      }
260   }
[6f2edc]261   return(simplify(id,2));
[3d124a7]262}
[6f2edc]263example
[3d124a7]264{ "EXAMPLE:"; echo = 2;
265   ring r=0,(x,y,t,s,z),(c,dp);
266   ideal i=x-y,y-z2,z-t3,s-x+y3;
267   ideal j=select(i,1);
[6f2edc]268   j;
269   module m=i*(gen(1)+gen(2));
270   m;
271   select(m,1,2);
[3d124a7]272}
273///////////////////////////////////////////////////////////////////////////////
[091424]274
275proc select1 (id, int n, list#)
276"USAGE:   select(id,n[,m]); id ideal/module, n, m integers
277RETURN:  generators of id containing the variable n
278         [at least one of the variables up to m]
279NOTE:    use 'select' for selecting generators containing all the
280         variables between n and m
281EXAMPLE: example select1; shows examples
282"{
283   if( size(#)==0 ) { #[1]=n; }
284   int j,k;
285   execute (typeof(id)+" I;");
286   for( k=1; k<=ncols(id); k=k+1 )
287   {  for( j=n; j<=#[1]; j=j+1 )
288      {   
289         if( size(subst(id[k],var(j),0)) != size(id[k]) )
290         { I=I,id[k]; break; }
291      }
292   }
293   return(simplify(I,2));
294}
295example
296{ "EXAMPLE:"; echo = 2;
297   ring r=0,(x,y,t,s,z),(c,dp);
298   ideal i=x-y,y-z2,z-t3,s-x+y3;
299   ideal j=select1(i,1);
300   j;
301   module m=i*(gen(1)+gen(2));
302   m;
303   select1(m,1,2);
304}
305///////////////////////////////////////////////////////////////////////////////
Note: See TracBrowser for help on using the repository browser.