source: git/Singular/LIB/elim.lib @ 6f2edc

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