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