Changeset facd12 in git
- Timestamp:
- Jun 19, 2007, 5:44:44 PM (17 years ago)
- Branches:
- (u'spielwiese', '17f1d200f27c5bd38f5dfc6e8a0879242279d1d8')
- Children:
- f7aaec31bd73e9e5b3b2bd84ee5ff4fab2de4691
- Parents:
- 6bdcaf53c26a95f7c01a3b87d3aa5dc9ac9640fa
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
Singular/LIB/kskernel.lib
r6bdcaf rfacd12 1 2 1 //////////////////////////////////////////////////////////////// 3 2 info=" … … 8 7 9 8 PROCEDURES: 10 KSker(p,q); kernel of the Kodaira-Spencer map of 9 KSker(p,q); kernel of the Kodaira-Spencer map of 11 10 a versal deformation of an irreducible 12 plane curve singularity 11 plane curve singularity 13 12 KSconvert(M); kernel of the Kodaira-Spencer map in 14 quasihomogeneous variables T with 13 quasihomogeneous variables T with 15 14 corresponding negative degrees 16 KSlinear(M); matrix of linear terms of the kernel of 15 KSlinear(M); matrix of linear terms of the kernel of 17 16 the Kodaira-Spencer map 18 KScoef(i,j,P,Q,qq); coefficient of the given term in the matrix 17 KScoef(i,j,P,Q,qq); coefficient of the given term in the matrix 19 18 of kernel of the Kodaira-Spencer map 20 StringF(i,j,p,q); expression in variables T(i) with non-resolved 21 brackets for the further computation of 22 coefficient in the matrix of kernel of the 19 StringF(i,j,p,q); expression in variables T(i) with non-resolved 20 brackets for the further computation of 21 coefficient in the matrix of kernel of the 23 22 Kodaira-Spencer map 24 23 "; 24 LIB "general.lib"; 25 25 //////////////////////////////////////////////////////////////// 26 26 … … 35 35 k=0;done=0; 36 36 for (i=t+1;i<nrows(M);i++) 37 { 38 if (m>v[i]) { m=v[i];k=i;done=1; } 39 } 40 if (done==1) 41 { 42 for (i=1;i<=3;i++) 37 { 38 if (m>v[i]) { m=v[i];k=i;done=1; } 39 } 40 if (done==1) 41 { 42 for (i=1;i<=3;i++) 43 43 { 44 44 done=M[k,i];M[k,i]=M[t,i];M[t,i]=done; … … 46 46 i=v[k];v[k]=v[t];v[t]=i; 47 47 } 48 return(M);48 return(M); 49 49 } 50 50 51 51 //---------------------------- sub procedure -------------------- 52 52 // sorts M by the third row, ascending 53 proc sorter(intmat M) 53 proc sorter(intmat M) 54 54 { 55 55 intvec v; … … 57 57 for (i=1;i<=nrows(M);i++) 58 58 { v[i]=M[i,3]; } 59 export (v); 59 export (v); 60 60 int n=1; 61 61 while (n<=nrows(M)) 62 { 62 { 63 63 M=minim(M,n); 64 n++; 64 n++; 65 65 } 66 66 kill v; … … 70 70 //---------------------------- sub procedure -------------------- 71 71 // M is a sorted matrix of triples {i,j,k(i,j)} 72 // returns a list of coefficients of p 72 // returns a list of coefficients of p 73 73 // wrt. the base {x^i y^j,(i,j) in (M[i,j,k])}=B_u 74 74 proc MonoDec(poly p, matrix M) … … 83 83 { 84 84 V=leadexp(q); 85 while ( !((V[1]==M[k,1]) && (V[2]==M[k,2])) ) 86 { 87 if (k>=nM) 88 { 89 print("error in monomial base");90 85 while ( !((V[1]==M[k,1]) && (V[2]==M[k,2])) ) 86 { 87 if (k>=nM) 88 { 89 ERROR("error in monomial base"); 90 return(0); 91 91 } 92 92 k++; 93 93 } 94 94 VC=VC+leadcoef(q)*gen(k); 95 q=q-lead(q); 95 q=q-lead(q); 96 96 k=1; 97 97 } … … 101 101 102 102 //----------------------------- main program -------------------- 103 proc KSker (int p,q) 103 proc KSker (int p,q) 104 104 "USAGE: KSker(int p,q); p,q relatively prime integers 105 105 RETURN: nothing; exports ring KSring, matrix KSkernel and list 'weights'; 106 KSkernel is a matrix of coefficients of the 106 KSkernel is a matrix of coefficients of the 107 107 generators of the kernel of Kodaira-Spencer map, 108 108 'weights' is a list of degrees for variables T … … 110 110 " 111 111 { 112 option(redSB); 113 option(redTail); 114 int c; 115 int i,j; 116 int k=0; 117 list LM; 118 list tmp; 119 for (i=0;i<=p-2;i++) 120 { 121 for (j=0;j<=q-2;j++) 122 { 123 c=(i*q)+(j*p)-(p*q); 124 if (c>0) 125 { 126 k++; 127 tmp[1]=i; 128 tmp[2]=j; 129 tmp[3]=c; // index of T 130 LM[k]=tmp; 131 tmp=0; 132 } 133 } 134 } 135 if (k==0) 136 { 137 print("The kernel of the Kodaira-Spencer map equals zero"); 138 return(); 139 } 140 if (k==1) 141 { 142 ring KSring=0,(T(1)),ws(c); 143 matrix KSkernel[1][1]=c*T(1); 112 option(redSB); 113 option(redTail); 114 int c; 115 int i,j; 116 int k=0; 117 list LM; 118 list tmp; 119 for (i=0;i<=p-2;i++) 120 { 121 for (j=0;j<=q-2;j++) 122 { 123 c=(i*q)+(j*p)-(p*q); 124 if (c>0) 125 { 126 k++; 127 tmp[1]=i; 128 tmp[2]=j; 129 tmp[3]=c; // index of T 130 LM[k]=tmp; 131 tmp=0; 132 } 133 } 134 } 135 if (k==0) 136 { 137 "The kernel of the Kodaira-Spencer map equals zero"; 138 return(); 139 } 140 if (k==1) 141 { 142 ring KSring=0,(T(1)),ws(c); 143 matrix KSkernel[1][1]=c*T(1); 144 export KSring; 145 export KSkernel; 146 return(); 147 } 148 int cnt=k; // the total number of T's, now k>1 149 intmat M[k][3]; // matrix with triples (i,j,k) 150 for (i=1; i<=k; i++) 151 { 152 M[i,1] = LM[i][1]; 153 M[i,2] = LM[i][2]; 154 M[i,3] = LM[i][3]; 155 } 156 kill LM; 157 M = sorter(M); // now the third column of M contains ordered ascending values 158 list weights; 159 for (i=1; i<=k; i++) 160 { 161 weights[i] = M[i,3]; // positive weights for Ws ordering 162 M[i,3] = i; 163 } 164 export weights; 165 ring RT=0,(x,y,T(1..k)),(Ws(q,p),dp); 166 poly F=x^p+y^q; 167 i=0;j=0; 168 for (k=1;k<=cnt;k++) 169 { 170 i = M[k,1]; 171 j = M[k,2]; 172 F = F + T(k)*x^i*y^j; 173 } 174 ideal I = diff(F,x),diff(F,y); 175 I = std(I); 176 k=0; 177 list normal; 178 poly mul; 179 for (i=0;i<=p-2;i++) 180 { 181 for (j=0;j<=q-2;j++) 182 { 183 c = p*q - ((i+2)*q+(j+2)*p); 184 if ( c > 0 ) 185 { 186 mul = x^i*y^j*p*q*F; 187 k++; 188 normal[k] = NF(mul,I); 189 } 190 } 191 } 192 // now we separate T's from (x,y) by treating T's as parameters 193 ring ST=(0,T(1..k)),(x,y),Ws(q,p); 194 setring ST; 195 list Snormal = imap(RT,normal); 196 ideal SI = imap(RT,I); 197 kill RT; 198 SI = std(SI); 199 module L; 200 for (i=1; i<=size(Snormal); i++) 201 { 202 Snormal[i] = NF(Snormal[i],SI); 203 L[i] = MonoDec(Snormal[i],M); 204 if (L[i]==0) // MonoDec has detected non-basis element 205 { 206 "Try reducing the input"; 207 return(0); 208 } 209 } 210 // now L is a module in T's 211 ring KSring=0,(T(1..k)),(C,ws(-weights[1..k])); 212 module TL=imap(ST,L); 213 kill ST; 214 // sort it descendently 215 TL = sort(TL)[1]; 216 // make the coefficients positive 217 if ((leadcoef(TL[1,1])<0) || (leadcoef(TL[k,k])<0)) { TL = -TL;} 218 matrix KSkernel=matrix(TL); 144 219 export KSring; 145 220 export KSkernel; 221 kill M; 146 222 return(); 147 }148 LIB "general.lib";149 int cnt=k; // the total number of T's, now k>1150 intmat M[k][3]; // matrix with triples (i,j,k)151 for (i=1; i<=k; i++)152 {153 M[i,1] = LM[i][1];154 M[i,2] = LM[i][2];155 M[i,3] = LM[i][3];156 }157 kill LM;158 M = sorter(M); // now the third column of M contains ordered ascending values159 list weights;160 for (i=1; i<=k; i++)161 {162 weights[i] = M[i,3]; // positive weights for Ws ordering163 M[i,3] = i;164 }165 export weights;166 ring RT=0,(x,y,T(1..k)),(Ws(q,p),dp);167 poly F=x^p+y^q;168 i=0;j=0;169 for (k=1;k<=cnt;k++)170 {171 i = M[k,1];172 j = M[k,2];173 F = F + T(k)*x^i*y^j;174 }175 ideal I = diff(F,x),diff(F,y);176 I = std(I);177 k=0;178 list normal;179 poly mul;180 for (i=0;i<=p-2;i++)181 {182 for (j=0;j<=q-2;j++)183 {184 c = p*q - ((i+2)*q+(j+2)*p);185 if ( c > 0 )186 {187 mul = x^i*y^j*p*q*F;188 k++;189 normal[k] = NF(mul,I);190 }191 }192 }193 // now we separate T's from (x,y) by treating T's as parameters194 ring ST=(0,T(1..k)),(x,y),Ws(q,p);195 setring ST;196 list Snormal = imap(RT,normal);197 ideal SI = imap(RT,I);198 kill RT;199 SI = std(SI);200 module L;201 for (i=1; i<=size(Snormal); i++)202 {203 Snormal[i] = NF(Snormal[i],SI);204 L[i] = MonoDec(Snormal[i],M);205 if (L[i]==0) // MonoDec has detected non-basis element206 {207 print("Try reducing the input");208 return(0);209 }210 }211 // now L is a module in T's212 ring KSring=0,(T(1..k)),(C,ws(-weights[1..k]));213 module TL=imap(ST,L);214 kill ST;215 // sort it descendently216 TL = sort(TL)[1];217 // make the coefficients positive218 if ((leadcoef(TL[1,1])<0) || (leadcoef(TL[k,k])<0)) { TL = -TL;}219 matrix KSkernel=matrix(TL);220 export KSring;221 export KSkernel;222 kill M;223 return();224 223 } 225 224 example 226 225 { "EXAMPLE:"; echo=2; 227 226 int p=6; 228 int q=7; 227 int q=7; 229 228 KSker(p,q); 230 229 setring KSring; … … 236 235 // need global variable "weights" 237 236 proc KSconvert(matrix M) 238 "USAGE: KSconvert(matrix M); 239 M is a matrix of coefficients of the generators of 240 the kernel of Kodaira-Spencer map in variables T(i) 241 from the basering. To be called after the procedure 237 "USAGE: KSconvert(matrix M); 238 M is a matrix of coefficients of the generators of 239 the kernel of Kodaira-Spencer map in variables T(i) 240 from the basering. To be called after the procedure 242 241 KSker(p,q) 243 RETURN: nothing; exports ring KSring2 and matrix KSkernel2 within it, 242 RETURN: nothing; exports ring KSring2 and matrix KSkernel2 within it, 244 243 such that KSring2 resp. KSkernel2 are in variables 245 244 T(w) with weights -w. These weights are computed … … 278 277 { "EXAMPLE:"; echo=2; 279 278 int p=6; 280 int q=7; 279 int q=7; 281 280 KSker(p,q); 282 281 setring KSring; 283 282 KSconvert(KSkernel); 284 283 setring KSring2; 285 print(KSkernel2); 284 print(KSkernel2); 286 285 } 287 286 288 287 proc KSlinear(matrix M) 289 "USAGE: KSlinear(matrix M); 290 computes matrix of linear terms of the kernel of the 291 Kodaira-Spencer map. To be called after the procedure 288 "USAGE: KSlinear(matrix M); 289 computes matrix of linear terms of the kernel of the 290 Kodaira-Spencer map. To be called after the procedure 292 291 KSker(p,q) 293 RETURN: nothing; but replaces elements of the matrix KSkernel 292 RETURN: nothing; but replaces elements of the matrix KSkernel 294 293 in the ring Ksring with their leading monomials 295 294 wrt. the local ordering (ls) … … 315 314 { "EXAMPLE:"; echo=2; 316 315 int p=6; 317 int q=7; 316 int q=7; 318 317 KSker(p,q); 319 318 setring KSring; 320 319 KSlinear(KSkernel); 321 print(KSkernel); 320 print(KSkernel); 322 321 } 323 322 … … 327 326 proc seq(int p,q) 328 327 // computes u,v such that 1<=u<=p-1, qu=1(mod p) 329 // 1<=v<=q-1, pv=1(mod q) 328 // 1<=v<=q-1, pv=1(mod q) 330 329 { 331 330 int u=1; int v=1; … … 333 332 { 334 333 if (((q*u)%p)==1) {break;} 335 } 334 } 336 335 for(v=1; v<=q-1; v++) 337 336 { … … 347 346 int result=0; 348 347 int s=size(u); 349 int w=s; 350 if (s==0) { "size of list is 0"; return(result); } 348 int w=s; 349 if (s==0) { "size of list is 0"; return(result); } 351 350 if (b<0 ) { "negative b in MIX"; return(result); } 352 351 while ((w>1) && (u[w]>b)) { w--;} // min w=1 353 if (w>1) 354 { 355 return(w); 352 if (w>1) 353 { 354 return(w); 356 355 } 357 356 else // w<=1 358 357 { 359 if ( (w==1) && (u[w]> b) ) 360 { 361 w=0; 358 if ( (w==1) && (u[w]> b) ) 359 { 360 w=0; 362 361 return(w); 363 } 362 } 364 363 } 365 364 return(w); … … 369 368 proc bracket(int r, int s) 370 369 { 371 int b=s-r; 370 int b=s-r; 372 371 int q; 373 372 int k=1; … … 375 374 F=F+"*("; 376 375 while (b>0) // simulate repeat ... until b==0 377 { 376 { 378 377 q=mix(b,u); 379 378 while (q>0) … … 382 381 if (u[q]==(s-r)) // adding T's of max degree 383 382 { 384 F=F+"T("+ string(q) +")"+ "+"; 385 } 386 else 387 { 388 383 F=F+"T("+ string(q) +")"+ "+"; 384 } 385 else 386 { 387 if (S[(1+r+u[q])]!="u") 389 388 { 390 391 389 F=F+"T("+ string(q) +")"; 390 bracket(r+u[q],s); 392 391 } 393 392 } … … 395 394 if (q==0) {b=0;} 396 395 } // end while q>0 397 SF=size(F); 398 if (F[SF]!="+") 399 { 396 SF=size(F); 397 if (F[SF]!="+") 398 { 400 399 if (SF<=2) { F="";} 401 400 else { F=F[1..SF-2];} … … 422 421 { 423 422 e=(e+a)%p; e1=(e1+b)%q; 424 if ( (e==(p-1)) || (e1==(q-1)) ) { S=S+" "; } 423 if ( (e==(p-1)) || (e1==(q-1)) ) { S=S+" "; } 425 424 else 426 425 { … … 434 433 } 435 434 } 436 } 435 } 437 436 export S; 438 437 export u; … … 443 442 proc StringF(int i, int j,int p, int q) 444 443 "USAGE: StringF(int i,j,p,q); 445 RETURN: nothing; exports string F which contains an expression 446 in variables T(i) with non-resolved brackets 444 RETURN: nothing; exports string F which contains an expression 445 in variables T(i) with non-resolved brackets 447 446 EXAMPLE: example StringF; shows an example 448 447 " … … 497 496 t = u[(qq[k])]; 498 497 if (e>=(P-1)) 499 { 498 { 500 499 aux = (U*t)%P; 501 500 aux = aux/P; … … 506 505 if (e1>=(Q-1)) 507 506 { 508 509 510 507 aux = (V*t)%Q; 508 aux = aux/Q; 509 C = C*aux; 511 510 } 512 511 } … … 531 530 c; // it is a coefficient of T1*T2*T3^2 in C[2,9] for x^5+y^14 532 531 } 533 534 535
Note: See TracChangeset
for help on using the changeset viewer.