source: git/Singular/LIB/elim.lib @ d2b2a7

spielwiese
Last change on this file since d2b2a7 was d2b2a7, checked in by Kai Krüger <krueger@…>, 26 years ago
Modified Files: libparse.l utils.cc LIB/classify.lib LIB/deform.lib LIB/elim.lib LIB/factor.lib LIB/fastsolv.lib LIB/finvar.lib LIB/general.lib LIB/hnoether.lib LIB/homolog.lib LIB/inout.lib LIB/invar.lib LIB/makedbm.lib LIB/matrix.lib LIB/normal.lib LIB/poly.lib LIB/presolve.lib LIB/primdec.lib LIB/primitiv.lib LIB/random.lib LIB/ring.lib LIB/sing.lib LIB/standard.lib LIB/tex.lib LIB/tst.lib Changed help section o procedures to have an quoted help-string between proc-definition and proc-body. git-svn-id: file:///usr/local/Singular/svn/trunk@1601 2c84dea3-7e68-4137-9b89-c4e89433aadc
  • Property mode set to 100644
File size: 9.4 KB
Line 
1// $Id: elim.lib,v 1.4 1998-05-05 11:55:22 krueger Exp $
2// system("random",787422842);
3// (GMG, last modified 22.06.96)
4///////////////////////////////////////////////////////////////////////////////
5
6version="$Id: elim.lib,v 1.4 1998-05-05 11:55:22 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 #)
25"USAGE:   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)
102"USAGE:   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{
111//---- get variables to be eliminated and create string for new ordering ------
112   int ii; poly vars=1;
113   for( ii=n; ii<=m; ii=ii+1 ) { vars=vars*var(ii); }
114   if( n>1 ) { poly p = 1+var(1); }
115   else { poly p = 1+var(m+1); }
116   if( ord(p)==0 ) { string ordering = "),ls;"; }
117   if( ord(p)>0 ) { string ordering = "),dp;"; }
118//-------------- create new ring and map objects to new ring ------------------
119   def br = basering;
120   string str = "ring @newr = ("+charstr(br)+"),("+varstr(br)+ordering;
121   execute(str);
122   def i = imap(br,id);
123   poly vars = imap(br,vars);
124//---------- now eliminate in new ring and map back to old ring ---------------
125   i = eliminate(i,vars);
126   setring br;
127   return(imap(@newr,i));
128}
129example
130{ "EXAMPLE:"; echo = 2;
131   ring r=0,(x,y,u,v,w),dp;
132   ideal i=x-u,y-u2,w-u3,v-x+y3;
133   elim(i,3,4);
134   module m=i*gen(1)+i*gen(2);
135   m=elim(m,3,4);show(m);
136}
137///////////////////////////////////////////////////////////////////////////////
138
139proc elim1 (id, poly vars)
140"USAGE:   elim1(id,poly); id ideal/module, poly=product of vars to be eliminated
141RETURN:  ideal/module obtained from id by eliminating vars occuring in poly
142NOTE:    no special monomial ordering is required, result is a SB with
143         respect to ordering dp (resp. ls) if the first var not to be
144         eliminated belongs to a -p (resp. -s) blockordering
145         This proc uses 'execute' or calls a procedure using 'execute'.
146EXAMPLE: example elim1; shows examples
147"
148{
149//---- get variables to be eliminated and create string for new ordering ------
150   int ii;
151   for( ii=1; ii<=nvars(basering); ii=ii+1 )
152   {
153      if( vars/var(ii)==0 ) { poly p = 1+var(ii); break;}
154   }
155   if( ord(p)==0 ) { string ordering = "),ls;"; }
156   if( ord(p)>0 ) { string ordering = "),dp;"; }
157//-------------- create new ring and map objects to new ring ------------------
158   def br = basering;
159   string str = "ring @newr = ("+charstr(br)+"),("+varstr(br)+ordering;
160   execute(str);
161   def id = fetch(br,id);
162   poly vars = fetch(br,vars);
163//---------- now eliminate in new ring and map back to old ring ---------------
164   id = eliminate(id,vars);
165   setring br;
166   return(imap(@newr,id));
167}
168example
169{ "EXAMPLE:"; echo = 2;
170   ring r=0,(x,y,t,s,z),dp;
171   ideal i=x-t,y-t2,z-t3,s-x+y3;
172   elim1(i,ts);
173   module m=i*gen(1)+i*gen(2);
174   m=elim1(m,st); show(m);
175}
176///////////////////////////////////////////////////////////////////////////////
177
178proc nselect (id, int n, list#)
179"USAGE:   nselect(id,n[,m]); id a module or ideal, n, m integers
180RETURN:  generators of id not containing the variable n [up to m]
181EXAMPLE: example nselect; shows examples
182"{
183   int j,k;
184   if( size(#)==0 ) { #[1]=n; }
185   for( k=1; k<=ncols(id); k=k+1 )
186   {  for( j=n; j<=#[1]; j=j+1 )
187      {  if( size(id[k]/var(j))!=0) { id[k]=0; break; }
188      }
189   }
190   return(simplify(id,2));
191}
192example
193{ "EXAMPLE:"; echo = 2;
194   ring r=0,(x,y,t,s,z),(c,dp);
195   ideal i=x-y,y-z2,z-t3,s-x+y3;
196   nselect(i,3);
197   module m=i*(gen(1)+gen(2));
198   show(m);
199   show(nselect(m,3,4));
200}
201///////////////////////////////////////////////////////////////////////////////
202
203proc sat (id, ideal j)
204"USAGE:   sat(id,j);  id=ideal/module, j=ideal
205RETURN:  list of an ideal/module [1] and an integer [2]:
206         [1] = saturation of id with respect to j (= union_(k=1...) of id:j^k)
207         [2] = saturation exponent (= min( k | id:j^k = id:j^(k+1) ))
208NOTE:    [1] is a standard basis in the basering
209DISPLAY: saturation exponent during computation if printlevel >=1
210EXAMPLE: example sat; shows an example
211"{
212   int ii,kk;
213   def i=id;
214   id=std(id);
215   int p = printlevel-voice+3;  // p=printlevel+1 (default: p=1)
216   while( ii<=size(i) )
217   {
218      dbprint(p-1,"// compute quotient "+string(kk+1));
219      i=quotient(id,j);
220      for( ii=1; ii<=size(i); ii=ii+1 )
221      {
222         if( reduce(i[ii],id)!=0 ) break;
223      }
224      id=std(i); kk=kk+1;
225   }
226   dbprint(p-1,"// saturation becomes stable after "+string(kk-1)+" iteration(s)","");
227   list L = id,kk-1;
228   return (L);
229}
230example
231{ "EXAMPLE:"; echo = 2;
232   int p      = printlevel;
233   ring r     = 2,(x,y,z),dp;
234   poly F     = x5+y5+(x-y)^2*xyz;
235   ideal j    = jacob(F);
236   sat(j,maxideal(1));
237   printlevel = 2;
238   sat(j,maxideal(2));
239   printlevel = p;
240}
241///////////////////////////////////////////////////////////////////////////////
242
243proc select (id, int n, list#)
244"USAGE:   select(id,n[,m]); id ideal/module, n, m integers
245RETURN:  generators of id containing the variable n [up to m]
246EXAMPLE: example select; shows examples
247"{
248   if( size(#)==0 ) { #[1]=n; }
249   int j,k;
250   for( k=1; k<=ncols(id); k=k+1 )
251   {  for( j=n; j<=#[1]; j=j+1 )
252      {   if( size(id[k]/var(j))==0) { id[k]=0; break; }
253      }
254   }
255   return(simplify(id,2));
256}
257example
258{ "EXAMPLE:"; echo = 2;
259   ring r=0,(x,y,t,s,z),(c,dp);
260   ideal i=x-y,y-z2,z-t3,s-x+y3;
261   ideal j=select(i,1);
262   j;
263   module m=i*(gen(1)+gen(2));
264   m;
265   select(m,1,2);
266}
267///////////////////////////////////////////////////////////////////////////////
Note: See TracBrowser for help on using the repository browser.