Changeset 6f2edc in git for Singular/LIB/elim.lib
- Timestamp:
- Apr 28, 1997, 9:27:25 PM (27 years ago)
- Branches:
- (u'spielwiese', 'e7cc1ebecb61be8b9ca6c18016352af89940b21a')
- Children:
- 8c5a578cc8481c8a133a58030c4c4c8227d82bb1
- Parents:
- 6d09c564c80f079b501f7187cf6984d040603849
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
Singular/LIB/elim.lib
r6d09c56 r6f2edc 1 // $Id: elim.lib,v 1. 1.1.1 1997-04-25 15:13:25obachman Exp $2 // system("random",787422842);3 // (GMG)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 4 /////////////////////////////////////////////////////////////////////////////// 5 5 6 6 LIBRARY: elim.lib PROCEDURES FOR ELIMINATIOM, SATURATION AND BLOWING UP 7 7 8 blowup0(j[,s1,s2]); create presentation of blownup ring of ideal j 8 blowup0(j[,s1,s2]); create presentation of blownup ring of ideal j 9 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 10 elim1(id,p); p=product of vars to be eliminated from id 11 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 12 sat(id,j); saturated quotient of ideal/module id by ideal j 13 13 select(id,n[,m]); select generators containing nth [..mth] variable 14 14 (parameters in square brackets [] are optional) … … 20 20 21 21 proc blowup0 (ideal j,list #) 22 USAGE: blowup0(j[,s1,s2]); j ideal, s1,s2 nonempty strings 23 CREATE: Create a presentation of the blowup ring of j 22 USAGE: blowup0(j[,s1,s2]); j ideal, s1,s2 nonempty strings 23 CREATE: Create a presentation of the blowup ring of j 24 24 RETURN: no return value 25 25 NOTE: s1 and s2 are used to give names to the blownup ring and the blownup 26 26 ideal (default: s1="j", s2="A") 27 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_jR28 then the procedure creates a new ring with name Bl_jR 29 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 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 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). 33 If k>26 or size(s2)>1, say s2="A()", the new vars are A(1),...,A(k). 34 34 Let j_ be the kernel of the ring map Bl_jR -> R defined by A(i)->j[i], 35 35 x(i)->x(i), then the quotient ring Bl_jR/j_ is the blowup ring of j 36 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. 38 EXAMPLE: example blowup0; shows an example 37 a std basis of j_ with name j_ in Bl_jR. 38 This proc uses 'execute' or calls a procedure using 'execute'. 39 DISPLAY: printlevel >=0: explain created objects (default) 40 EXAMPLE: example blowup0; shows examples 39 41 { 40 42 string bsr = nameof(basering); 41 43 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;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) 45 47 //---------------- create coordinate ring of blown up space ------------------- 46 48 if( size(#)==0 ) { #[1] = "j"; #[2] = "A"; } … … 48 50 if( k<=26 and size(#[2])==1 ) { string nv = A_Z(#[2],k)+","; } 49 51 else { string nv = (#[2])[1]+"(1.."+string(k)+"),"; } 50 if( is homog(j) )51 { 52 if( is_homog(j) ) 53 { 52 54 intvec v=1; 53 for( i=1; i<=k; i ++) { v[i+1]=deg(j[i]); }55 for( i=1; i<=k; i=i+1) { v[i+1]=deg(j[i]); } 54 56 string nor = "),(wp(v),"; 55 57 } … … 58 60 //---------- map to new ring, eliminate and create blown up ideal ------------- 59 61 ideal j=imap(br,j); 60 for( i=1; i<=k; i ++) { j[i]=var(1+i)-t*j[i]; }62 for( i=1; i<=k; i=i+1) { j[i]=var(1+i)-t*j[i]; } 61 63 j=eliminate(j,t); 62 64 v=v[2..size(v)]; … … 65 67 export basering; 66 68 export `#[1]+"_"`; 67 keepring basering; 69 //keepring basering; 70 setring br; 68 71 //------------------- 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 } 72 dbprint(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]+"_;"); 78 79 return(); 79 80 } 80 example 81 example 81 82 { "EXAMPLE:"; echo = 2; 82 83 ring R=0,(x,y),dp; 83 poly f=y2+x3; ideal j=jacob(f); 84 poly f=y2+x3; ideal j=jacob(f); 84 85 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_; ""; 86 show(Bl_jR); 87 setring Bl_jR; 88 j_;""; 93 89 ring r=32003,(x,y,z),ds; 94 90 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; 91 show(Bl_mr); 92 setring Bl_mr; 102 93 m_; 103 kill Bl_jR, Bl_mr; 94 kill Bl_jR, Bl_mr; 104 95 } 105 96 /////////////////////////////////////////////////////////////////////////////// 106 97 107 98 proc elim (id, int n, int m) 108 USAGE: elim(id,n,m); id ideal/module, n,m integers 109 RETURNS: ideal/module obtained from id by eliminating variables n..m 110 NOTE: 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 113 EXAMPLE: example elim; shows an example 99 USAGE: elim(id,n,m); id ideal/module, n,m integers 100 RETURNS: ideal/module obtained from id by eliminating variables n..m 101 NOTE: 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'. 105 EXAMPLE: example elim; shows examples 114 106 { 115 107 //---- get variables to be eliminated and create string for new ordering ------ 116 108 int ii; poly vars=1; 117 for( ii=n; ii<=m; ii=ii+1 ) { vars=vars*var(ii); } 109 for( ii=n; ii<=m; ii=ii+1 ) { vars=vars*var(ii); } 118 110 if( n>1 ) { poly p = 1+var(1); } 119 111 else { poly p = 1+var(m+1); } … … 122 114 //-------------- create new ring and map objects to new ring ------------------ 123 115 def br = basering; 124 string str = "ring newr = ("+charstr(br)+"),("+varstr(br)+ordering;116 string str = "ring @newr = ("+charstr(br)+"),("+varstr(br)+ordering; 125 117 execute(str); 126 118 def i = imap(br,id); … … 129 121 i = eliminate(i,vars); 130 122 setring br; 131 return(imap( newr,i));132 } 133 example 123 return(imap(@newr,i)); 124 } 125 example 134 126 { "EXAMPLE:"; echo = 2; 135 127 ring r=0,(x,y,u,v,w),dp; 136 128 ideal i=x-u,y-u2,w-u3,v-x+y3; 137 elim(i,3,4); 129 elim(i,3,4); 138 130 module m=i*gen(1)+i*gen(2); 139 m=elim(m,3,4);show(m); 140 } 141 /////////////////////////////////////////////////////////////////////////////// 131 m=elim(m,3,4);show(m); 132 } 133 /////////////////////////////////////////////////////////////////////////////// 142 134 143 135 proc elim1 (id, poly vars) … … 147 139 respect to ordering dp (resp. ls) if the first var not to be 148 140 eliminated belongs to a -p (resp. -s) blockordering 149 EXAMPLE: example elim1; shows an example 141 This proc uses 'execute' or calls a procedure using 'execute'. 142 EXAMPLE: example elim1; shows examples 150 143 { 151 144 //---- 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; 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;} 157 149 } 158 150 if( ord(p)==0 ) { string ordering = "),ls;"; } … … 160 152 //-------------- create new ring and map objects to new ring ------------------ 161 153 def br = basering; 162 string str = "ring newr = "+charstr(br)+",("+varstr(br)+ordering;154 string str = "ring @newr = ("+charstr(br)+"),("+varstr(br)+ordering; 163 155 execute(str); 164 156 def id = fetch(br,id); … … 167 159 id = eliminate(id,vars); 168 160 setring br; 169 return(imap( newr,id));170 } 171 example 161 return(imap(@newr,id)); 162 } 163 example 172 164 { "EXAMPLE:"; echo = 2; 173 165 ring r=0,(x,y,t,s,z),dp; 174 166 ideal i=x-t,y-t2,z-t3,s-x+y3; 175 elim1(i,ts); 167 elim1(i,ts); 176 168 module m=i*gen(1)+i*gen(2); 177 m=elim1(m,st); show(m); 178 } 179 /////////////////////////////////////////////////////////////////////////////// 169 m=elim1(m,st); show(m); 170 } 171 /////////////////////////////////////////////////////////////////////////////// 180 172 181 173 proc nselect (id, int n, list#) 182 174 USAGE: nselect(id,n[,m]); id a module or ideal, n, m integers 183 175 RETURN: generators of id not containing the variable n [up to m] 184 EXAMPLE: example nselect; shows an example 185 { 176 EXAMPLE: example nselect; shows examples 177 { 178 int j,k; 186 179 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; } 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; } 193 183 } 194 184 } 195 185 return(simplify(id,2)); 196 186 } 197 example 187 example 198 188 { "EXAMPLE:"; echo = 2; 199 189 ring r=0,(x,y,t,s,z),(c,dp); 200 190 ideal i=x-y,y-z2,z-t3,s-x+y3; 201 191 nselect(i,3); 202 module m=i*(gen(1)+gen(2)); 192 module m=i*(gen(1)+gen(2)); 203 193 show(m); 204 194 show(nselect(m,3,4)); … … 207 197 208 198 proc sat (id, ideal j) 209 USAGE: sat(id,j); id ideal or module, j ideal 210 RETURN: saturation of id with respect to j (= union_(k=1...) of id:j^k) 211 NOTE: result is a std basis in the basering 199 USAGE: sat(id,j); id=ideal/module, j=ideal 200 RETURN: 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) )) 203 NOTE: [1] is a standard basis in the basering 204 DISPLAY: saturation exponent during computation if printlevel >=1 212 205 EXAMPLE: example sat; shows an example 213 206 { 214 207 int ii,kk; 215 def i=id; id=std(id); 208 def i=id; 209 id=std(id); 210 int p = printlevel-voice+3; // p=printlevel+1 (default: p=1) 216 211 while( ii<=size(i) ) 217 { 218 if( voice==2 ) 219 {"// start quotient:",kk+1;} 212 { 213 dbprint(p-1,"// compute quotient "+string(kk+1)); 220 214 i=quotient(id,j); 221 for( ii=1; ii<=size(i); ii ++)215 for( ii=1; ii<=size(i); ii=ii+1 ) 222 216 { 223 217 if( reduce(i[ii],id)!=0 ) break; … … 225 219 id=std(i); kk=kk+1; 226 220 } 227 if( voice==2 ) 228 {"// saturation becomes stable after",kk-1,"iteration(s)";"";} 229 return (id); 230 } 231 example 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)); 221 dbprint(p-1,"// saturation becomes stable after "+string(kk-1)+" iteration(s)",""); 222 list L = id,kk-1; 223 return (L); 224 } 225 example 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; 237 235 } 238 236 /////////////////////////////////////////////////////////////////////////////// … … 241 239 USAGE: select(id,n[,m]); id ideal/module, n, m integers 242 240 RETURN: generators of id containing the variable n [up to m] 243 EXAMPLE: example select; shows an example241 EXAMPLE: example select; shows examples 244 242 { 245 243 if( size(#)==0 ) { #[1]=n; } 246 244 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; } 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; } 252 248 } 253 249 } 254 return( id+id);255 } 256 example 250 return(simplify(id,2)); 251 } 252 example 257 253 { "EXAMPLE:"; echo = 2; 258 254 ring r=0,(x,y,t,s,z),(c,dp); 259 255 ideal i=x-y,y-z2,z-t3,s-x+y3; 260 256 ideal j=select(i,1); 261 module m=i*(gen(1)+gen(2)); show(m); 262 show(select(m,1,2)); 263 } 264 /////////////////////////////////////////////////////////////////////////////// 265 257 j; 258 module m=i*(gen(1)+gen(2)); 259 m; 260 select(m,1,2); 261 } 262 ///////////////////////////////////////////////////////////////////////////////
Note: See TracChangeset
for help on using the changeset viewer.