source: git/Singular/LIB/elim.lib @ 3d124a7

spielwiese
Last change on this file since 3d124a7 was 3d124a7, checked in by Olaf Bachmann <obachman@…>, 27 years ago
This commit was generated by cvs2svn to compensate for changes in r191, which included commits to RCS files with non-trunk default branches. git-svn-id: file:///usr/local/Singular/svn/trunk@192 2c84dea3-7e68-4137-9b89-c4e89433aadc
  • Property mode set to 100644
File size: 9.0 KB
Line 
1// $Id: elim.lib,v 1.1.1.1 1997-04-25 15:13:25 obachman Exp $
2//system("random",787422842);
3//(GMG)
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 basering 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_ and Bl_jR as basering.
38EXAMPLE: example blowup0; shows an example
39{
40   string bsr = nameof(basering);
41   def br = basering;
42   string cr, vr, o = charstr(br), varstr(br), ordstr(br);
43   int n, k = nvars(br), ncols(j);
44   int i;
45//---------------- create coordinate ring of blown up space -------------------
46   if( size(#)==0 ) { #[1] = "j"; #[2] = "A"; }
47   if( size(#)==1 ) { #[2] = "A"; }
48   if( k<=26 and size(#[2])==1 ) { string nv = A_Z(#[2],k)+","; }
49   else { string nv = (#[2])[1]+"(1.."+string(k)+"),"; }
50   if( ishomog(j) )
51   {
52      intvec v=1;
53      for( i=1; i<=k; i++) { v[i+1]=deg(j[i]); }
54      string nor = "),(wp(v),";
55   }
56   else { string nor = "),(dp(1+k),";}
57   execute("ring Bl=("+cr+"),(t,"+nv+vr+nor+o+");");
58//---------- map to new ring, eliminate and create blown up ideal -------------
59   ideal j=imap(br,j);
60   for( i=1; i<=k; i++) { j[i]=var(1+i)-t*j[i]; }
61   j=eliminate(j,t);
62   v=v[2..size(v)];
63   execute("ring Bl_"+#[1]+bsr+"=("+cr+"),("+nv+vr+nor+o+");");
64   ideal `#[1]+"_"`=imap(Bl,j);
65   export basering;
66   export `#[1]+"_"`;
67   keepring basering;
68//------------------- some comments about usage and names  --------------------
69   if( voice ==2 )
70   {
71"// NOTE:";
72"// basering is now Bl_"+#[1]+bsr+" (equal to "+bsr+"["+nv[1,size(nv)-1]+"])";
73"// it contains the ideal "+#[1]+"_ , such that";
74"//             Bl_"+#[1]+bsr+"/"+#[1]+"_ is the blowup ring";
75"// For blowing-up another ideal in "+bsr+" type first:";
76"//             setring "+bsr+";";
77   }
78   return();
79}
80example
81{ "EXAMPLE:"; echo = 2;
82   ring R=0,(x,y),dp;
83   poly f=y2+x3; ideal j=jacob(f);
84   blowup0(j);
85   type basering; "";
86// NOTE:
87// basering is now Bl_jR (equal to R[A,B])
88// it contains the ideal j_ , such that
89//             Bl_jR/j_ is the blowup ring
90// For blowing-up another ideal in R type first:
91//             setring R;
92   type j_; "";
93   ring r=32003,(x,y,z),ds;
94   blowup0(maxideal(1),"m","T()");
95   type basering; "";
96// NOTE:
97// basering is now Bl_mr (equal to r[T(1..3)])
98// it contains the ideal m_ , such that
99//             Bl_mr/m_ is the blowup ring
100// For blowing-up another ideal in r type first:
101//             setring r;
102   m_;
103   kill Bl_jR, Bl_mr;
104}
105///////////////////////////////////////////////////////////////////////////////
106
107proc elim (id, int n, int m)
108USAGE:   elim(id,n,m);  id ideal/module, n,m integers
109RETURNS: ideal/module obtained from id by eliminating variables n..m
110NOTE:    no special monomial ordering is required, result is a SB with
111         respect to ordering dp (resp. ls) if the first var not to be
112         eliminated belongs to a -p (resp. -s) blockordering
113EXAMPLE: example elim; shows an example
114{
115//---- get variables to be eliminated and create string for new ordering ------
116   int ii; poly vars=1;
117   for( ii=n; ii<=m; ii=ii+1 ) { vars=vars*var(ii); }   
118   if( n>1 ) { poly p = 1+var(1); }
119   else { poly p = 1+var(m+1); }
120   if( ord(p)==0 ) { string ordering = "),ls;"; }
121   if( ord(p)>0 ) { string ordering = "),dp;"; }
122//-------------- create new ring and map objects to new ring ------------------
123   def br = basering;
124   string str = "ring newr = ("+charstr(br)+"),("+varstr(br)+ordering;
125   execute(str);
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;
131   return(imap(newr,i));
132}
133example
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;
137   elim(i,3,4);
138   module m=i*gen(1)+i*gen(2);
139   m=elim(m,3,4);show(m);
140}
141///////////////////////////////////////////////////////////////////////////////
142
143proc elim1 (id, poly vars)
144USAGE:   elim1(id,poly); id ideal/module, poly=product of vars to be eliminated
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
149EXAMPLE: example elim1; shows an example
150{
151//---- get variables to be eliminated and create string for new ordering ------
152   int ii;                       
153   for( ii=1; ii<=nvars(basering); ii++ )
154   {   
155      if( vars/var(ii)==0 ) { poly p = 1+var(ii); }
156      break;
157   }
158   if( ord(p)==0 ) { string ordering = "),ls;"; }
159   if( ord(p)>0 ) { string ordering = "),dp;"; }
160//-------------- create new ring and map objects to new ring ------------------
161   def br = basering;
162   string str = "ring newr = "+charstr(br)+",("+varstr(br)+ordering;
163   execute(str);
164   def id = fetch(br,id);
165   poly vars = fetch(br,vars);
166//---------- now eliminate in new ring and map back to old ring ---------------
167   id = eliminate(id,vars);
168   setring br;
169   return(imap(newr,id));
170}
171example
172{ "EXAMPLE:"; echo = 2;
173   ring r=0,(x,y,t,s,z),dp;
174   ideal i=x-t,y-t2,z-t3,s-x+y3;
175   elim1(i,ts);
176   module m=i*gen(1)+i*gen(2);
177   m=elim1(m,st); show(m);
178}
179///////////////////////////////////////////////////////////////////////////////
180
181proc nselect (id, int n, list#)
182USAGE:   nselect(id,n[,m]); id a module or ideal, n, m integers
183RETURN:  generators of id not containing the variable n [up to m]
184EXAMPLE: example nselect; shows an example
185{
186   if( size(#)==0 ) { #[1]=n; }
187   int j,k;
188   for( k=1; k<=ncols(id); k++ )
189   { 
190      for( j=n; j<=#[1]; j++ )
191      {
192         if( size(id[k]/var(j))!=0) { id[k]=0; break; }
193      }
194   }
195   return(simplify(id,2));
196}
197example
198{ "EXAMPLE:"; echo = 2;
199   ring r=0,(x,y,t,s,z),(c,dp);
200   ideal i=x-y,y-z2,z-t3,s-x+y3;
201   nselect(i,3);
202   module m=i*(gen(1)+gen(2));
203   show(m);
204   show(nselect(m,3,4));
205}
206///////////////////////////////////////////////////////////////////////////////
207
208proc sat (id, ideal j)
209USAGE:   sat(id,j);  id ideal or module, j ideal
210RETURN:  saturation of id with respect to j (= union_(k=1...) of id:j^k)
211NOTE:    result is a std basis in the basering
212EXAMPLE: example sat; shows an example
213{
214   int ii,kk;
215   def i=id; id=std(id);
216   while( ii<=size(i) )
217   {   
218      if( voice==2 )
219      {"// start quotient:",kk+1;}
220      i=quotient(id,j);
221      for( ii=1; ii<=size(i); ii++ )
222      {
223         if( reduce(i[ii],id)!=0 ) break;
224      }
225      id=std(i); kk=kk+1;
226   }
227   if( voice==2 )
228   {"//  saturation becomes stable after",kk-1,"iteration(s)";"";}
229   return (id);
230}
231example
232{ "EXAMPLE:"; echo = 2;
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}
238///////////////////////////////////////////////////////////////////////////////
239
240proc select (id, int n, list#)
241USAGE:   select(id,n[,m]); id ideal/module, n, m integers
242RETURN:  generators of id containing the variable n [up to m]
243EXAMPLE: example select; shows an example
244{
245   if( size(#)==0 ) { #[1]=n; }
246   int j,k;
247   for( k=1; k<=ncols(id); k++ )
248   { 
249      for( j=n; j<=#[1]; j++ )
250      {
251         if( size(id[k]/var(j))==0) { id[k]=0; break; }
252      }
253   }
254   return(id+id);
255}
256example
257{ "EXAMPLE:"; echo = 2;
258   ring r=0,(x,y,t,s,z),(c,dp);
259   ideal i=x-y,y-z2,z-t3,s-x+y3;
260   ideal j=select(i,1);
261   module m=i*(gen(1)+gen(2)); show(m);
262   show(select(m,1,2));
263}
264///////////////////////////////////////////////////////////////////////////////
265
Note: See TracBrowser for help on using the repository browser.