source: git/Singular/LIB/elim.lib @ 5480da

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