Changeset 0fbdd1 in git
- Timestamp:
- Sep 12, 1997, 9:40:37 AM (27 years ago)
- Branches:
- (u'spielwiese', '17f1d200f27c5bd38f5dfc6e8a0879242279d1d8')
- Children:
- 3ca4229c4e4d8d84ca999ef93aec635eb84259c6
- Parents:
- 4a81eccd72975057d29a44244958cdc9a450eb71
- Location:
- Singular/LIB
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
Singular/LIB/all.lib
r4a81ec r0fbdd1 1 // $Id: all.lib,v 1. 3 1997-08-14 13:10:47Singular Exp $1 // $Id: all.lib,v 1.4 1997-09-12 07:40:33 Singular Exp $ 2 2 /////////////////////////////////////////////////////////////////////////////// 3 3 4 4 LIBRARY: all.lib Load all libraries 5 6 classify.lib PROCEDURES FOR THE ARNOLD-CLASSIFIER OF SINGULARITIES 7 deform.lib PROCEDURES FOR COMPUTING MINIVERSAL DEFORMATION 8 elim.lib PROCEDURES FOR ELIMINATION, SATURATION AND BLOWING UP 9 factor.lib PROCEDURES FOR CALLING EXTERNAL FACTORIZER 10 finvar.lib PROCEDURES TO CALCULATE INVARIANT RINGS & MORE 11 general.lib PROCEDURES OF GENERAL TYPE 12 hnoether.lib PROCEDURES FOR THE HAMBURGER-NOETHER-DEVELOPMENT 13 homolog.lib PROCEDURES FOR HOMOLOGICAL ALGEBRA 14 inout.lib PROCEDURES FOR MANIPULATING IN- AND OUTPUT 15 invar.lib PROCEDURES FOR COMPUTING INVARIANTS OF (C,+)-ACTIONS 16 matrix.lib PROCEDURES FOR MATRIX OPERATIONS 17 poly.lib PROCEDURES FOR MANIPULATING POLYS, IDEALS, MODULES 18 presolve.lib PROCEDURES FOR PRE-SOLVING POLYNOMIAL EQUATIONS 19 primdec.lib PROCEDURES FOR PRIMARY DECOMPOSITION (G/T/Z) 20 primitiv.lib PROCEDURES FOR FINDING A PRIMITIVE ELEMENT 21 prim_dec.lib PROCEDURES FOR PRIMARY DECOMPOSITION (S/Y) 22 random.lib PROCEDURES OF RANDOM MATRIX AND POLY OPERATIONS 23 ring.lib PROCEDURES FOR MANIPULATING RINGS AND MAPS 24 sing.lib PROCEDURES FOR SINGULARITIES 25 standard.lib PROCEDURES WHICH ARE ALWAYS LOADED AT START-UP 26 tex.lib PROCEDURES FOR TYPESET OF SINGULAROBJECTS IN TEX 5 27 6 28 /////////////////////////////////////////////////////////////////////////////// 7 29 30 LIB "classify.lib"; 8 31 LIB "deform.lib"; 9 32 LIB "elim.lib"; … … 11 34 LIB "finvar.lib"; 12 35 LIB "general.lib"; 36 LIB "hnoether.lib"; 13 37 LIB "homolog.lib"; 14 38 LIB "inout.lib"; 39 LIB "invar.lib"; 15 40 LIB "matrix.lib"; 16 41 LIB "poly.lib"; 42 LIB "presolve.lib"; 17 43 LIB "primdec.lib"; 44 LIB "primitiv.lib"; 18 45 LIB "prim_dec.lib"; 19 46 LIB "random.lib"; 20 47 LIB "ring.lib"; 21 48 LIB "sing.lib"; 22 LIB "hnoether.lib"; 49 LIB "tex.lib"; 50 LIB "tools.lib"; -
Singular/LIB/homolog.lib
r4a81ec r0fbdd1 1 // $Id: homolog.lib,v 1. 3 1997-05-06 13:08:33Singular Exp $1 // $Id: homolog.lib,v 1.4 1997-09-12 07:40:34 Singular Exp $ 2 2 //(BM/GMG, last modified 22.06.96) 3 3 /////////////////////////////////////////////////////////////////////////////// … … 566 566 (if finite dimensional) 567 567 DISPLAY: printlevel >=0: degree of Ext^k for each k (default) 568 printlevel >=1: Ak, Ak+1 and kbase of Ext^k in Hom(Fk,G0)568 printlevel >=1: matrices Ak, Ak+1 and kbase of Ext^k in Hom(Fk,G0) 569 569 (if finite dimensional) 570 570 NOTE: In order to compute Ext^k(M,N) use the command Ext(k,syz(M),syz(N)); … … 641 641 imag = imag,D; 642 642 extMN = modulo(ker,imag); 643 dbprint(p-1,"// Computing Ext^"+string(k)+" :",643 dbprint(p-1,"// Computing Ext^"+string(k)+" (help Ext; gives an explanation):", 644 644 "// Let 0<--coker(M)<--F0<--F1<--F2<--... be a resolution of coker(M),", 645 645 "// and 0<--coker(N)<--G0<--G1 a presentation of coker(N),", -
Singular/LIB/inout.lib
r4a81ec r0fbdd1 1 // $Id: inout.lib,v 1. 2 1997-04-28 19:27:20 obachmanExp $1 // $Id: inout.lib,v 1.3 1997-09-12 07:40:35 Singular Exp $ 2 2 // system("random",787422842); 3 3 // (GMG/BM, last modified 22.06.96) … … 12 12 rMacaulay(string); read Macaulay_1 output and return its Singular format 13 13 show(any); display any object in a compact format 14 showrecursive(id,p); display id recursively with respect to variables in p 14 15 split(string,n); split given string into lines of length n 15 16 tab(n); string of n space tabs … … 333 334 USAGE: show(id); id any object of basering or of type ring/qring 334 335 show(R,s); R=ring, s=string (s = name of an object belonging to R) 335 CREATE:display id/s in a compact format together with some information336 DISPLAY: display id/s in a compact format together with some information 336 337 RETURN: no return value 337 338 NOTE: objects of type string, int, intvec, intmat belong to any ring. … … 378 379 { 379 380 @@s = tab(@li@)+"// list, "+string(size(id))+" element(s):"; 380 @@s; 381 @@s;""; 381 382 for ( @ii=1; @ii<=size(id); @ii++ ) 382 383 { … … 412 413 if( typeof(@id@)=="poly" or typeof(@id@)=="ideal" or typeof(@id@)=="matrix" ) 413 414 { 415 @@s = tab(@li@)+"// "+ typeof(@id@); 414 416 if( typeof(@id@)=="ideal" ) 415 417 { 416 @s@=", "+string(ncols(@id@))+" generator(s)"; 418 @@s=@@s + ", "+string(ncols(@id@))+" generator(s)"; 419 @@s; 420 print(ideal(@id@)); 421 } 422 if( typeof(@id@)=="poly" ) 423 { 424 @@s=@@s + ", "+string(size(@id@))+" monomial(s)"; 425 @@s; 426 print(poly(@id@)); 417 427 } 418 428 if( typeof(@id@)=="matrix") 419 429 { 420 @s@=", "+string(nrows(@id@))+"x"+string(ncols(@id@)); 421 } 422 @@s = tab(@li@)+"// "+ typeof(@id@)+ @s@; 423 @@s; 424 print(matrix(@id@)); 430 @@s=@@s + ", "+string(nrows(@id@))+"x"+string(ncols(@id@)); 431 @@s; 432 print(matrix(@id@)); 433 } 425 434 short=@short@; return(); 426 435 } … … 502 511 /////////////////////////////////////////////////////////////////////////////// 503 512 513 proc showrecursive (id,poly p,list #) 514 USAGE: showrecursive(id,p[ord]); id=any object of basering, p=product of 515 variables and ord=string (any allowed ordstr) 516 DISPLAY: display 'id' in a recursive format as a polynomial in the variables 517 occuring in p with coefficients in the remaining variables. Do this 518 by mapping in a ring with parameters [and ordering 'ord', if a 3rd 519 argument is present (default: ord="dp")] and applying procedure 'show' 520 RETURN: no return value 521 EXAMPLE: example showrecursive; shows an example 522 { 523 def P = basering; 524 int ii; 525 string newchar = charstr(P); 526 string neword = "dp"; 527 if( size(#) == 1 ) { neword = #[1]; } 528 string newvar; 529 for( ii=1; ii <= nvars(P); ii++ ) 530 { 531 if( p/var(ii) == 0 ) 532 { 533 newchar = newchar + ","+varstr(ii); 534 } 535 else 536 { 537 newvar = newvar + ","+varstr(ii); 538 } 539 } 540 newvar = newvar[2,size(newvar)-1]; 541 542 execute "ring newP=("+newchar+"),("+newvar+"),("+neword+");"; 543 def id = imap(P,id); 544 show(id); 545 return(); 546 } 547 example 548 { "EXAMPLE:"; echo=2; 549 ring r=2,(t(1..15),x,y),ds; 550 poly f=y+t(15)*x^2+t(14)*x^3+t(13)*x^2*y^2+t(12)*x*y^3; 551 showrecursive(f,xy); 552 showrecursive(f,xy,"ds"); 553 } 554 /////////////////////////////////////////////////////////////////////////////// 555 504 556 proc split (string s, list #) 505 557 USAGE: split(s[,n]); s string, n integer -
Singular/LIB/ring.lib
r4a81ec r0fbdd1 1 // $Id: ring.lib,v 1. 2 1997-04-28 19:27:25 obachmanExp $1 // $Id: ring.lib,v 1.3 1997-09-12 07:40:36 Singular Exp $ 2 2 //(GMG, last modified 03.11.95) 3 3 /////////////////////////////////////////////////////////////////////////////// … … 8 8 changeord("R",o[,r]); make a copy R of basering [ring r] with new ord o 9 9 changevar("R",v[,r]); make a copy R of basering [ring r] with new vars v 10 copyring("R"[,r]); make an exact copy R of basering [ring r] 10 11 defring("R",c,n,v,o); define a ring R in specified char c, n vars v, ord o 11 12 defrings(n[,p]); define ring Sn in n vars, char 32003 [p], ord ds 12 13 defringp(n[,p]); define ring Pn in n vars, char 32003 [p], ord dp 13 14 extendring("R",n,v,o); extend given ring by n vars v, ord o and name it R 15 extendring1("R",n,v,o); similair to extendring but different ordering 14 16 fetchall(R[,str]); fetch all objects of ring R to basering 15 17 imapall(R[,str]); imap all objects of ring R to basering 16 18 mapall(R,i[,str]); map all objects of ring R via ideal i to basering 17 19 ringtensor("R",s,t,..);create ring R, tensor product of rings s,t,... 18 (parameters in square brackets [] are optional) 20 substitute(id,p,list); substitute in id i-th factor of p by i-th poly of list 21 swapvars(id,p1,p2); return id with variables p1 and p2 interchanged 22 (parameters in square brackets [] are optional) 19 23 20 24 LIB "inout.lib"; … … 170 174 /////////////////////////////////////////////////////////////////////////////// 171 175 176 proc copyring (string newr,list #) 177 USAGE: copyring(newr[,r]); newr=string, r=ring/qring 178 CREATE: create a new ring with name `newr` and make it the basering if r is 179 an existing ring [default: r=basering]. 180 The new ring is a copy of r but with a new name R1 if, say, newr="R1" 181 RETURN: No return value 182 NOTE: This proc uses 'execute' or calls a procedure using 'execute'. 183 If you use it in your own proc, let the local names of your proc 184 start with @ (see the file HelpForProc) 185 EXAMPLE: example copyring; shows an example 186 { 187 if( size(#)==0 ) { def @r=basering; } 188 if( size(#)==1 ) { def @r=#[1]; } 189 string @o=ordstr(@r); 190 changeord(newr,@o,@r); 191 keepring(basering); 192 if (voice==2) { "// basering is now",newr; } 193 return(); 194 } 195 example 196 { "EXAMPLE:"; echo = 2; 197 ring r=0,(x,y,u,v),(dp(2),ds); 198 copyring("R"); R;""; 199 copyring("R1",r); R1; 200 kill R,R1; 201 } 202 /////////////////////////////////////////////////////////////////////////////// 203 172 204 proc defring (string s1, string s2, int n, string s3, string s4) 173 205 USAGE: defring(s1,s2,n,s3,s4); s1..s4=strings, n=integer … … 269 301 270 302 proc extendring (string na, int n, string va, string o, list #) 271 USAGE: extendring(na,n,va,o[iv,i,r]); na,va,o=strings, 303 USAGE: extendring(na,n,va,o[,i,r]); na,va,o=strings (name, new vars, 304 ordering of the new ring), n,i=integers, r=ring 305 CREATE: Define a ring with name `na` which extends the ring r by adding n new 306 variables in front of [after, if i!=0] the old variables and make it 307 the basering [default: (i,r)=(0,basering)] 308 -- The characteristic is the characteristic of r 309 -- The new vars are derived from va. If va is a single letter, say 310 va="T", and if n<=26 then T and the following n-1 letters from 311 T..Z..T (resp. T(1..n) if n>26) are taken as additional variables. 312 If va is a single letter followed by (, say va="x(", the new 313 variables are x(1),...,x(n). 314 If va is a string that contains a comma (e.g. "x,z,u,w"), the 315 comma-separated symbols are taken as new variables 316 -- The ordering is the ordering given by `o` [any allowed ordstr] 317 RETURN: No return value 318 NOTE: This proc is useful for adding deformation parameters. 319 This proc uses 'execute' or calls a procedure using 'execute'. 320 If you use it in your own proc, let the local names of your proc 321 start with @ (see the file HelpForProc) 322 EXAMPLE: example extendring; shows an example 323 { 324 //--------------- initialization and place c/C of ordering properly ----------- 325 string @v,@newring; 326 int @i; 327 if( size(#)==0 ) { #[1]=0; def @r=basering; } 328 else 329 { 330 if( size(#)==1 ) { @i=#[1]; def @r=basering; } 331 if( size(#)==2 ) { @i=#[1]; def @r=#[2]; } 332 } 333 //------------------------ prepare string of new ring ------------------------- 334 @newring = "ring "+na+"=("+charstr(@r)+"),("; 335 if( find(va,",") != 0 ) 336 { @v = va; } 337 else 338 { 339 if( n>26 or va[2]=="(" ) 340 { @v = va[1]+"(1.."+string(n)+")"; } 341 else 342 { @v = A_Z(va,n); } 343 } 344 345 if( @i==0 ) 346 { 347 @v=@v+","+varstr(@r); 348 } 349 else 350 { 351 @v=varstr(@r)+","+@v; 352 } 353 @newring=@newring+@v+"),("+o+");"; 354 //---------------------------- execute and export ----------------------------- 355 execute(@newring); 356 export(basering); 357 keepring(basering); 358 if (voice==2) { "// basering is now",basering; } 359 return(); 360 } 361 example 362 { "EXAMPLE:"; echo = 2; 363 ring r=0,(x,y,z),ds; 364 show(r);""; 365 extendring("R0",2,"u","ds"); 366 show(R0); ""; 367 extendring("R1",2,"a,w","ds(2),dp"); 368 show(R1); ""; 369 extendring("R2",5,"b","dp"); 370 show(R2); ""; 371 extendring("R3",4,"T()","c,dp",1,r); 372 show(R3);""; 373 kill R0,R1,R2,R3; 374 } 375 /////////////////////////////////////////////////////////////////////////////// 376 377 proc extendring1 (string na, int n, string va, string o, list #) 378 USAGE: extendring1(na,n,va,o[iv,i,r]); na,va,o=strings, 272 379 n,i=integers, r=ring, iv=intvec of positive integers or iv=0 273 380 CREATE: Define a ring with name `na` which extends the ring r by adding n new … … 279 386 T..Z..T (resp. T(1..n) if n>26) are taken as additional variables. 280 387 If va is a single letter followed by (, say va="x(", the new 281 variables are x(1),...,x(n) 388 variables are x(1),...,x(n). 389 If va is a string that contains a comma (e.g. "x,z,u,w"), the 390 comma-separated symbols are taken as new variables 282 391 -- The ordering is the product ordering between the ordering of r and 283 392 an ordering derived from `o` [and iv] … … 288 397 like "ds" or "dp(2),wp(1,2,3),Ds(2)" or "ds(a),dp(b),ls" if a and b 289 398 are globally (!) defined integers and if a+b+1<=n 290 If, however, a and b are local to a proc calling extendring , the291 intvec iv must be used to let extendring know the values of a andb399 If, however, a and b are local to a proc calling extendring1, the 400 intvec iv must be used to let extendring1 know the values of a, b 292 401 - If an intvec iv !=0 is given, iv[1],iv[2],... is taken for the 1st, 293 402 2nd,... block of o, if o contains no substring "w" or "W" i.e. no … … 304 413 If you use it in your own proc, let the local names of your proc 305 414 start with @ (see the file HelpForProc) 306 EXAMPLE: example extendring ; shows an example415 EXAMPLE: example extendring1; shows an example 307 416 { 308 417 //--------------- initialization and place c/C of ordering properly ----------- … … 371 480 //------------------------ prepare string of new ring ------------------------- 372 481 @newring = "ring "+na+"=("+charstr(@r)+"),("; 373 if( n>26 or va[2]=="(" ) { @v = va[1]+"(1.."+string(n)+")"; } 374 else { @v = A_Z(va,n); } 482 if( find(va,",") != 0 ) 483 { @v = va; } 484 else 485 { 486 if( n>26 or va[2]=="(" ) 487 { @v = va[1]+"(1.."+string(n)+")"; } 488 else 489 { @v = A_Z(va,n); } 490 } 491 375 492 if( @i==0 ) 376 493 { … … 395 512 ring r=0,(x,y,z),ds; 396 513 show(r);""; 514 extendring1("S",2,"u","ds"); 515 setring r; 516 show(S); ""; 517 extendring1("R0",2,"a,w","ds"); 518 show(R0); ""; 397 519 //no intvec given, no blocksize given: blocksize is derived from no of vars 398 520 int t=5; 399 extendring ("R1",t,"a","dp"); //t global: "dp" -> "dp(5)"521 extendring1("R1",t,"a","dp"); //t global: "dp" -> "dp(5)" 400 522 show(R1); ""; 401 extendring ("R2",4,"T(","c,dp",1,r); //"dp" -> "c,..,dp(4)"523 extendring1("R2",4,"T(","c,dp",1,r); //"dp" -> "c,..,dp(4)" 402 524 show(R2);""; 403 525 404 526 //no intvec given, blocksize given: given blocksize is used 405 extendring ("R3",4,"T(","dp(2)",0,r); // "dp(2)" -> "dp(2)"527 extendring1("R3",4,"T(","dp(2)",0,r); // "dp(2)" -> "dp(2)" 406 528 show(R3);""; 407 529 … … 412 534 //ones are ignored 413 535 intvec v=3,2,3,4,1,3; 414 extendring ("R4",10,"A","ds,ws,Dp,dp",v,0,r);536 extendring1("R4",10,"A","ds,ws,Dp,dp",v,0,r); 415 537 //v covers 3 blocks: v[1] (=3) : no of components of ws 416 538 //next v[1] values (=v[2..4]) give weights 417 539 //remaining components of v are used for the remaining blocks 418 540 show(R4); 419 kill r,R1,R2,R3,R4;541 kill S,R0,R1,R2,R3,R4; 420 542 } 421 543 /////////////////////////////////////////////////////////////////////////////// … … 644 766 } 645 767 /////////////////////////////////////////////////////////////////////////////// 768 769 proc substitute (id, vars, list #) 770 USAGE: substitute(id,vars,li); id = object in basering which can be mapped, 771 vars = ideal expression which must be a list of variables 772 (not counting zeroes and costant factors), 773 li = list of ideal expressions 774 RETURN: id, with i-th entry of vars substituted by i-th polynomial of the 775 ideal (say, conli) obtained by concatenatin of the lists in li; 776 if conli has less polys than size(vars), the last element of conli 777 substitutes the remaining variables in vars 778 EXAMPLE: example substitute; shows an example 779 { 780 int ii,jj,k; 781 def P = basering; 782 int n = nvars(P); 783 ideal va = simplify(vars,3); 784 int sa = size(va); 785 ideal all = #[1..size(#)]; 786 int na = ncols(all); 787 ideal m = maxideal(1); 788 for( jj=1; jj<=sa; jj++) 789 { 790 if( size(va[jj]) > 1) 791 { 792 "// object to be substituted must be a variable"; 793 return(); 794 } 795 for( ii=1; ii<=n; ii++ ) 796 { 797 if( va[jj]/var(ii) != 0 ) 798 { 799 if( jj <= na ) { m[ii] = all[jj]; } 800 else { m[ii] = all[na]; } 801 } 802 } 803 } 804 map phi = P,m; 805 return(phi(id)); 806 } 807 example 808 { "EXAMPLE:"; echo=2; 809 ring r=0,(a,b,t,s,u,v,x,y),ds; 810 poly f=b+y+ax+sx+vy2+ux; 811 ideal vars = a,y,b; 812 ideal subs = t4,1,y+t; 813 // the following commands all define the substitution: 814 // a -> t4, y -> 1, b -> y+t 815 substitute(f,vars,subs); 816 substitute(f,vars,t4,1,y+t); 817 substitute(f,ideal(a)+y+b,t4,1,y+t); 818 // substitute all variables in vars by 1: 819 substitute(f,vars,1); 820 // substitute all variables by 1, except those in vars: 821 substitute(f,substitute(maxideal(1),vars,0),1); 822 } 823 /////////////////////////////////////////////////////////////////////////////// 824 825 proc swapvars (id,poly p1,poly p2) 826 USAGE: swapvars(id,p1,p2); id = object in basering which can be mapped 827 p1, p2 = variables which shall be interchanged 828 RETURN: id, with p1 and p2 interchanged 829 EXAMPLE: example swapvars; shows an example 830 { 831 def bR = basering; 832 execute " ring @newR = ("+charstr(bR)+"),("+varstr(bR)+",@t),dp;"; 833 def id = imap(bR,id); 834 poly p1 = imap(bR,p1); 835 poly p2 = imap(bR,p2); 836 id = substitute(id,p2,@t); 837 id = substitute(id,p1,p2); 838 id = substitute(id,@t,p1); 839 setring bR; 840 id = imap(@newR,id); 841 return(id); 842 } 843 } 844 example 845 { "EXAMPLE:"; echo=2; 846 ring r; 847 poly f = x5+y3+z2; 848 swapvars(f,x,y); 849 } 850 /////////////////////////////////////////////////////////////////////////////// -
Singular/LIB/sing.lib
r4a81ec r0fbdd1 1 // $Id: sing.lib,v 1. 3 1997-05-01 17:49:56Singular Exp $1 // $Id: sing.lib,v 1.4 1997-09-12 07:40:37 Singular Exp $ 2 2 //system("random",787422842); 3 3 //(GMG/BM, last modified 26.06.96) … … 6 6 LIBRARY: sing.lib PROCEDURES FOR SINGULARITIES 7 7 8 codim (id1, id2); vector space dimension of of id2/id1 if finite 8 9 deform(i); infinitesimal deformations of ideal i 9 10 dim_slocus(i); dimension of singular locus of ideal i … … 16 17 nf_icis(i); generic combinations of generators; get ICIS in nf 17 18 slocus(i); ideal of singular locus of ideal i 19 spectrum(f,w); spectrum numbers of w-homogeneous polynomial f 18 20 Tjurina(i); SB of Tjurina module of ideal i (assume i is ICIS) 19 21 tjurina(i); Tjurina number of ideal i (assume i is ICIS) … … 21 23 T2((i); T2-module of ideal i 22 24 T12(i); T1- and T2-module of ideal i 23 codim (id1, id2); codimension of of id2 in id124 25 25 26 LIB "inout.lib"; 26 27 LIB "random.lib"; 28 /////////////////////////////////////////////////////////////////////////////// 29 30 proc codim (id1, id2) 31 USAGE: codim(id1,id2); id1,id2 ideal or module 32 ASSUME: both must be standard bases w.r.t. ordering ds or Ds or homogeneous 33 and standardbases w.r.t. ordering dp or Dp 34 RETURN: int, which is: 35 1. the codimension of id2 in id1, i.e. the vectorspace dimension of 36 id1/id2 if id2 is contained in id1 and if this number is finite 37 2. -1 if the dimension of id1/id2 is infinite 38 3. -2 if id2 is not contained in id1, 39 COMPUTE: consider the two hilberseries iv1(t) and iv2(t), then, in case 1., 40 q(t)=(iv2(t)-iv1(t))/(1-t)^n must be rational, and the result is the 41 sum of the coefficients of q(t) (n number of variables) 42 NOTE: As always, id1 and id2 must be consider as ideals in the localization 43 of the polynomial ring w.r.t. the monomial ordering 44 EXAMPLE: example codim; shows an example 45 { 46 intvec iv1, iv2, iv; 47 int i, d1, d2, dd, i1, i2, ia, ie; 48 //--------------------------- check id2 < id1 ------------------------------- 49 ideal led = lead(id1); 50 attrib(led, "isSB",1); 51 i = size(NF(lead(id2),led)); 52 if ( i > 0 ) 53 { 54 return(-2); 55 } 56 //--------------------------- 1. check finiteness --------------------------- 57 i1 = dim(id1); 58 i2 = dim(id2); 59 if (i1 < 0) 60 { 61 if (i2 == 0) 62 { 63 return vdim(id2); 64 } 65 else 66 { 67 return(-1); 68 } 69 } 70 if (i2 != i1) 71 { 72 return(-1); 73 } 74 if (i2 <= 0) 75 { 76 return(vdim(id2)-vdim(id1)); 77 } 78 //--------------------------- module --------------------------------------- 79 d1 = nrows(id1); 80 d2 = nrows(id2); 81 dd = 0; 82 if (d1 > d2) 83 { 84 id2=id2,maxideal(1)*gen(d1); 85 dd = -1; 86 } 87 if (d2 > d1) 88 { 89 id1=id1,maxideal(1)*gen(d2); 90 dd = 1; 91 } 92 //--------------------------- compute first hilbertseries ------------------ 93 iv1 = hilb(id1,1); 94 i1 = size(iv1); 95 iv2 = hilb(id2,1); 96 i2 = size(iv2); 97 //--------------------------- difference of hilbertseries ------------------ 98 if (i2 > i1) 99 { 100 for ( i=1; i<=i1; i=i+1) 101 { 102 iv2[i] = iv2[i]-iv1[i]; 103 } 104 ie = i2; 105 iv = iv2; 106 } 107 else 108 { 109 for ( i=1; i<=i2; i=i+1) 110 { 111 iv1[i] = iv2[i]-iv1[i]; 112 } 113 iv = iv1; 114 for (ie=i1;ie>=0;ie=ie-1) 115 { 116 if (ie == 0) 117 { 118 return(0); 119 } 120 if (iv[ie] != 0) 121 { 122 break; 123 } 124 } 125 } 126 ia = 1; 127 while (iv[ia] == 0) { ia=ia+1; } 128 //--------------------------- ia <= nonzeros <= ie ------------------------- 129 iv1 = iv[ia]; 130 for(i=ia+1;i<=ie;i=i+1) 131 { 132 iv1=iv1,iv[i]; 133 } 134 //--------------------------- compute second hilbertseries ----------------- 135 iv2 = hilb(iv1); 136 //--------------------------- check finitenes ------------------------------ 137 i2 = size(iv2); 138 i1 = ie - ia + 1 - i2; 139 if (i1 != nvars(basering)) 140 { 141 return(-1); 142 } 143 //--------------------------- compute result ------------------------------- 144 i1 = 0; 145 for ( i=1; i<=i2; i=i+1) 146 { 147 i1 = i1 + iv2[i]; 148 } 149 return(i1+dd); 150 } 151 example 152 { "EXAMPLE:"; echo = 2; 153 ring r = 0,(x,y,z),dp; 154 ideal j = y6,x4; 155 ideal m = x,y; 156 attrib(m,"isSB",1); //let Singular know that ideals are a standard basis 157 attrib(j,"isSB",1); 158 codim(m,j); // should be 23 (Milnor number -1 of y7-x5) 159 } 27 160 /////////////////////////////////////////////////////////////////////////////// 28 161 … … 362 495 /////////////////////////////////////////////////////////////////////////////// 363 496 497 proc spectrum (poly f, intvec w) 498 USAGE: spectrum(f,w); f=poly, w=intvec; 499 ASSUME: f is a weighted homogeneous isolated singularity w.r.t. the weights 500 given by w; w must consist of as many positive integers as there 501 are variables of the basering 502 COMPUTE: the spectral numbers of the w-homogeneous polynomial f, computed in a 503 ring of charcteristik 0 504 RETURN: intvec d,s1,...,su where: 505 d = w-degree(f) and si/d = ith spectral-number(f) 506 No return value if basering has parameters or if f is no isolated 507 singularity, displays a warning in this case 508 EXAMPLE: example spectrum; shows an example 509 { 510 int i,d,W; 511 intvec sp; 512 def r = basering; 513 if( find(charstr(r),",")!=0 ) 514 { 515 "// coefficient field must not have parameters!"; 516 return(); 517 } 518 ring s = 0,x(1..nvars(r)),ws(w); 519 map phi = r,maxideal(1); 520 poly f = phi(f); 521 d = ord(f); 522 W = sum(w)-d; 523 ideal k = std(jacob(f)); 524 if( vdim(k) == -1 ) 525 { 526 "// f is no isolated singuarity!"; 527 return(); 528 } 529 k = kbase(k); 530 for (i=1; i<=size(k); i++) 531 { 532 sp[i]=W+ord(k[i]); 533 } 534 list L = sort(sp); 535 sp = d,L[1]; 536 return(sp); 537 } 538 example 539 { "EXAMPLE:"; echo = 2; 540 ring r; 541 poly f=x3+y5+z2; 542 intvec w=10,6,15; 543 spectrum(f,w); 544 // the spectrum numbers are: 545 // 1/30,7/30,11/30,13/30,17/30,19/30,23/30,29/30 546 } 547 /////////////////////////////////////////////////////////////////////////////// 548 364 549 proc Tjurina (id, list #) 365 550 USAGE: Tjurina(id[,<any>]); id=ideal or poly … … 459 644 module nb = [1]; module pnb; 460 645 dbprint(printlevel-voice+3,"// dim T1 = "+string(vdim(t1))); 461 if( size(#)>0 ) { return(t1*gen(1),nb,pnb); } 646 if( size(#)>0 ) 647 { 648 module st1 = t1*gen(1); 649 attrib(st1,"isSB",1); 650 return(st1,nb,pnb); 651 } 462 652 return(t1); 463 653 } … … 656 846 /////////////////////////////////////////////////////////////////////////////// 657 847 proc codim (id1, id2) 658 USAGE: codim(id1,id2); id1,id2 ideal or module, both result of std 659 RETURN: result is the number of elements in id1 but not in id2 if finite, 660 conditions: 661 1. id2 is contained in id1, if not return -2 662 2. finiteness 663 consider the two hilberseries iv1(t) and iv2(t) 664 q(t)=(iv2(t)-iv1(t))/(1-t)^n must be rational, if not return -1 665 (n dimension of basering) 666 then the result is the sum of the coeff. of q(t) 848 USAGE: codim(id1,id2); id1,id2 ideal or module, both must be standard bases 849 RETURN: int, which is: 850 1. the codimension of id2 in id1, i.e. the vectorspace dimension of 851 id1/id2 if id2 is contained in id1 and if this number is finite 852 2. -1 if the dimension of id1/id2 is infinite 853 3. -2 if id2 is not contained in id1, 854 COMPUTE: consider the two hilberseries iv1(t) and iv2(t), then, in case 1., 855 q(t)=(iv2(t)-iv1(t))/(1-t)^n must be rational, and the result is the 856 sum of the coefficients of q(t) (n dimension of basering) 857 EXAMPLE: example codim; shows an example 667 858 { 668 859 intvec iv1, iv2, iv; 669 860 int i, d1, d2, dd, i1, i2, ia, ie; 670 //--------------------------- check id2 < id1 ------------------------------ 671 i = size(NF(lead(id2),lead(id1))); 861 //--------------------------- check id2 < id1 ------------------------------- 862 ideal led = lead(id1); 863 attrib(led, "isSB",1); 864 i = size(NF(lead(id2),led)); 672 865 if ( i > 0 ) 673 866 { … … 696 889 return(vdim(id2)-vdim(id1)); 697 890 } 698 699 700 701 891 // if (mult(id2) != mult(id1)) 892 //{ 893 // return(-1); 894 // } 702 895 //--------------------------- module --------------------------------------- 703 896 d1 = nrows(id1); … … 773 966 return(i1+dd); 774 967 } 775 968 example 969 { "EXAMPLE:"; echo = 2; 970 ring r = 0,(x,y,z),dp; 971 ideal j = y6,x4; 972 ideal m = x,y; 973 attrib(m,"isSB",1); //let Singular know that ideals are a standard basis 974 attrib(j,"isSB",1); 975 codim(m,j); // should be 23 (Milnor number -1 of y7-x5) 976 } -
Singular/LIB/standard.lib
r4a81ec r0fbdd1 1 // $Id: standard.lib,v 1. 3 1997-08-01 13:42:14 obachmanExp $1 // $Id: standard.lib,v 1.4 1997-09-12 07:40:37 Singular Exp $ 2 2 /////////////////////////////////////////////////////////////////////////////// 3 3 … … 10 10 proc stdfglm (ideal i, list #) 11 11 USAGE: stdfglm(i[,s]); i ideal, s string (any allowed ordstr of a ring) 12 RETURN: stdfglm(i); standard basis of i in the given ring, calculated via 13 fglm from ordering "dp" to the current ordering. 14 stdfglm(i,s); standard basis of i in the given ring, calculated via 15 fglm from ordering s (as a string) to the given 16 ordering. 12 RETURN: stdfglm(i): standard basis of i in the basering, calculated via fglm 13 from ordering "dp" to the ordering of the basering. 14 stdfglm(i,s): standard basis of i in the basering, calculated via 15 fglm from ordering s to the ordering of the basering. 17 16 EXAMPLE: example stdfglm; shows an example 18 17 { … … 43 42 example 44 43 { "EXAMPLE:"; echo = 2; 45 ring r=0,(x,y,z), lp; ideal i=y3+x2, x2y+x2, x3-x2, z4-x2-y; 46 ideal is=stdfglm(i,"Dp"); is; 44 ring r = 0,(x,y,z),lp; 45 ideal i = y3+x2, x2y+x2, x3-x2, z4-x2-y; 46 ideal i1= stdfglm(i); //uses fglm from "dp" to "lp" 47 i1; 48 ideal i2= stdfglm(i,"Dp"); //uses fglm from "Dp" to "lp" 49 i2; 47 50 } 48 51 /////////////////////////////////////////////////////////////////////////////// 49 52 50 53 proc stdhilbert(ideal i,list #) 51 USAGE: stdhilbert(i); i ideal 52 stdhilbert(i,v); i homogeneous ideal, v intvec (the Hilbert function) 53 RETURN: stdhilbert(i); standard basis of i computed using the Hilbert function 54 USAGE: stdhilbert(i); i ideal 55 stdhilbert(i,v); i homogeneous ideal, v intvec (the Hilbert function) 56 RETURN: stdhilbert(i): a standard basis of i (computing v internally) 57 stdhilbert(i,v): standard basis of i, using the given Hilbert function 54 58 EXAMPLE: example stdhilbert; shows an example 55 59 { … … 103 107 example 104 108 { "EXAMPLE:"; echo = 2; 105 ring r=0,(x,y,z), lp; ideal i=y3+x2, x2y+x2, x3-x2, z4-x2-y; 106 ideal is=stdhilbert(i); is; 109 ring r = 0,(x,y,z),lp; 110 ideal i = y3+x2, x2y+x2, x3-x2, z4-x2-y; 111 ideal i1= stdhilbert(i); i1; 112 // is in this case equivalent to: 113 intvec v=1,0,0,-3,0,1,0,3,-1,-1; 114 ideal i2=stdhilbert(i,v); 107 115 } 108 116 ///////////////////////////////////////////////////////////////////////////////
Note: See TracChangeset
for help on using the changeset viewer.