source: git/Singular/LIB/sing.lib @ faed79

fieker-DuValspielwiese
Last change on this file since faed79 was 7d56875, checked in by Hans Schönemann <hannes@…>, 16 years ago
*hannes: typos reported by gorzelc git-svn-id: file:///usr/local/Singular/svn/trunk@11114 2c84dea3-7e68-4137-9b89-c4e89433aadc
  • Property mode set to 100644
File size: 32.3 KB
RevLine 
[7d56875]1// $Id: sing.lib,v 1.32 2008-10-09 09:31:58 Singular Exp $
[a2c96e]2//(GMG/BM, last modified 26.06.96,
3//GMG, 27.7.08: in milnor printlevel und Ausschrift geŠndert)
[3d124a7]4///////////////////////////////////////////////////////////////////////////////
[7d56875]5version="$Id: sing.lib,v 1.32 2008-10-09 09:31:58 Singular Exp $";
[fd3fb7]6category="Singularities";
[5480da]7info="
[8bb77b]8LIBRARY:  sing.lib      Invariants of Singularities
[80a0f0]9AUTHORS:  Gert-Martin Greuel, email: greuel@mathematik.uni-kl.de @*
[091424]10          Bernd Martin, email: martin@math.tu-cottbus.de
[3d124a7]11
[f34c37c]12PROCEDURES:
[7d56875]13 codim(id1, id2);       vector space dimension of id2/id1 if finite
[3d124a7]14 deform(i);             infinitesimal deformations of ideal i
15 dim_slocus(i);         dimension of singular locus of ideal i
16 is_active(f,id);       is poly f an active element mod id? (id ideal/module)
17 is_ci(i);              is ideal i a complete intersection?
18 is_is(i);              is ideal i an isolated singularity?
19 is_reg(f,id);          is poly f a regular element mod id? (id ideal/module)
20 is_regs(i[,id]);       are gen's of ideal i regular sequence modulo id?
[c69ea5]21 locstd(i);             SB for local degree ordering without cancelling units
[3d124a7]22 milnor(i);             milnor number of ideal i; (assume i is ICIS in nf)
23 nf_icis(i);            generic combinations of generators; get ICIS in nf
24 slocus(i);             ideal of singular locus of ideal i
[cd6dbb2]25 qhspectrum(f,w);       spectrum numbers of w-homogeneous polynomial f
[3d124a7]26 Tjurina(i);            SB of Tjurina module of ideal i (assume i is ICIS)
27 tjurina(i);            Tjurina number of ideal i (assume i is ICIS)
[0b59f5]28 T_1(i);                T^1-module of ideal i
29 T_2((i);               T^2-module of ideal i
30 T_12(i);               T^1- and T^2-module of ideal i
[c69ea5]31 tangentcone(id);       compute tangent cone of id
32
[5480da]33";
[3d124a7]34
[6f2edc]35LIB "inout.lib";
[3d124a7]36LIB "random.lib";
[c69ea5]37LIB "primdec.lib";
[3d124a7]38///////////////////////////////////////////////////////////////////////////////
39
40proc deform (ideal id)
[d2b2a7]41"USAGE:   deform(id); id=ideal or poly
[3d124a7]42RETURN:  matrix, columns are kbase of infinitesimal deformations
[6f2edc]43EXAMPLE: example deform; shows an example
[d2b2a7]44"
[6f2edc]45{
[0b59f5]46   list L=T_1(id,"");
[6f2edc]47   def K=L[1]; attrib(K,"isSB",1);
48   return(L[2]*kbase(K));
[3d124a7]49}
50example
51{ "EXAMPLE:"; echo = 2;
[6f2edc]52   ring r   = 32003,(x,y,z),ds;
53   ideal i  = xy,xz,yz;
54   matrix T = deform(i);
55   print(T);
56   print(deform(x3+y5+z2));
[3d124a7]57}
58///////////////////////////////////////////////////////////////////////////////
59
60proc dim_slocus (ideal i)
[d2b2a7]61"USAGE:   dim_slocus(i);  i ideal or poly
[3d124a7]62RETURN:  dimension of singular locus of i
63EXAMPLE: example dim_slocus; shows an example
[d2b2a7]64"
[3d124a7]65{
66   return(dim(std(slocus(i))));
67}
68example
69{ "EXAMPLE:"; echo = 2;
[6f2edc]70   ring r  = 32003,(x,y,z),ds;
71   ideal i = x5+y6+z6,x2+2y2+3z2;
[3d124a7]72   dim_slocus(i);
73}
74///////////////////////////////////////////////////////////////////////////////
75
76proc is_active (poly f, id)
[d2b2a7]77"USAGE:   is_active(f,id); f poly, id ideal or module
[3d124a7]78RETURN:  1 if f is an active element modulo id (i.e. dim(id)=dim(id+f*R^n)+1,
79         if id is a submodule of R^n) resp. 0 if f is not active.
[6f2edc]80         The basering may be a quotient ring
[3d124a7]81NOTE:    regular parameters are active but not vice versa (id may have embedded
82         components). proc is_reg tests whether f is a regular parameter
83EXAMPLE: example is_active; shows an example
[d2b2a7]84"
[3d124a7]85{
[6f2edc]86   if( size(id)==0 ) { return(1); }
[3d124a7]87   if( typeof(id)=="ideal" ) { ideal m=f; }
[6f2edc]88   if( typeof(id)=="module" ) { module m=f*freemodule(nrows(id)); }
[3d124a7]89   return(dim(std(id))-dim(std(id+m)));
90}
91example
92{ "EXAMPLE:"; echo = 2;
[6f2edc]93   ring r   =32003,(x,y,z),ds;
94   ideal i  = yx3+y,yz3+y3z;
95   poly f   = x;
[3d124a7]96   is_active(f,i);
[6f2edc]97   qring q  = std(x4y5);
98   poly f   = x;
99   module m = [yx3+x,yx3+y3x];
[3d124a7]100   is_active(f,m);
101}
102///////////////////////////////////////////////////////////////////////////////
103
104proc is_ci (ideal i)
[d2b2a7]105"USAGE:   is_ci(i); i ideal
[3d124a7]106RETURN:  intvec = sequence of dimensions of ideals (j[1],...,j[k]), for
[6f2edc]107         k=1,...,size(j), where j is minimal base of i. i is a complete
108         intersection if last number equals nvars-size(i)
109NOTE:    dim(0-ideal) = -1. You may first apply simplify(i,10); in order to
110         delete zeroes and multiples from set of generators
111         printlevel >=0: display comments (default)
[3d124a7]112EXAMPLE: example is_ci; shows an example
[d2b2a7]113"
[3d124a7]114{
115   int n; intvec dimvec; ideal id;
116   i=minbase(i);
117   int s = ncols(i);
[6f2edc]118   int p = printlevel-voice+3;  // p=printlevel+1 (default: p=1)
[3d124a7]119//--------------------------- compute dimensions ------------------------------
[6f2edc]120   for( n=1; n<=s; n=n+1 )
121   {
[3d124a7]122      id = i[1..n];
123      dimvec[n] = dim(std(id));
124   }
125   n = dimvec[s];
[6f2edc]126//--------------------------- output ------------------------------------------
127   if( n+s != nvars(basering) )
128   { dbprint(p,"// no complete intersection"); }
129   if( n+s == nvars(basering) )
130   { dbprint(p,"// complete intersection of dim "+string(n)); }
131   dbprint(p,"// dim-sequence:");
[3d124a7]132   return(dimvec);
133}
134example
[6f2edc]135{ "EXAMPLE:"; echo = 2;
136   int p      = printlevel;
137   printlevel = 1;                // display comments
138   ring r     = 32003,(x,y,z),ds;
139   ideal i    = x4+y5+z6,xyz,yx2+xz2+zy7;
140   is_ci(i);
141   i          = xy,yz;
[3d124a7]142   is_ci(i);
[6f2edc]143   printlevel = p;
[3d124a7]144}
145///////////////////////////////////////////////////////////////////////////////
146
147proc is_is (ideal i)
[d2b2a7]148"USAGE:   is_is(id);  id ideal or poly
[3d124a7]149RETURN:  intvec = sequence of dimensions of singular loci of ideals
[80a0f0]150         generated by id[1]..id[i], k = 1..size(id); @*
151         dim(0-ideal) = -1;
[3d124a7]152         id defines an isolated singularity if last number is 0
[6f2edc]153NOTE:    printlevel >=0: display comments (default)
[3d124a7]154EXAMPLE: example is_is; shows an example
[d2b2a7]155"
[3d124a7]156{
157  int l; intvec dims; ideal j;
[6f2edc]158  int p = printlevel-voice+3;  // p=printlevel+1 (default: p=1)
[3d124a7]159//--------------------------- compute dimensions ------------------------------
[6f2edc]160   for( l=1; l<=ncols(i); l=l+1 )
[3d124a7]161   {
[6f2edc]162     j = i[1..l];
[3d124a7]163     dims[l] = dim(std(slocus(j)));
164   }
[6f2edc]165   dbprint(p,"// dim of singular locus = "+string(dims[size(dims)]),
166             "// isolated singularity if last number is 0 in dim-sequence:");
[3d124a7]167   return(dims);
168}
169example
170{ "EXAMPLE:"; echo = 2;
[6f2edc]171   int p      = printlevel;
172   printlevel = 1;
173   ring r     = 32003,(x,y,z),ds;
174   ideal i    = x2y,x4+y5+z6,yx2+xz2+zy7;
[3d124a7]175   is_is(i);
[6f2edc]176   poly f     = xy+yz;
[3d124a7]177   is_is(f);
[6f2edc]178   printlevel = p;
[3d124a7]179}
180///////////////////////////////////////////////////////////////////////////////
181
182proc is_reg (poly f, id)
[d2b2a7]183"USAGE:   is_reg(f,id); f poly, id ideal or module
[3d124a7]184RETURN:  1 if multiplication with f is injective modulo id, 0 otherwise
[fd5013]185NOTE:    Let R be the basering and id a submodule of R^n. The procedure checks
[3d124a7]186         injectivity of multiplication with f on R^n/id. The basering may be a
[fd5013]187         quotient ring.
[3d124a7]188EXAMPLE: example is_reg; shows an example
[d2b2a7]189"
[3d124a7]190{
191   if( f==0 ) { return(0); }
192   int d,ii;
193   def q = quotient(id,ideal(f));
194   id=std(id);
195   d=size(q);
[6f2edc]196   for( ii=1; ii<=d; ii=ii+1 )
[3d124a7]197   {
198      if( reduce(q[ii],id)!=0 )
199      { return(0); }
200   }
201   return(1);
202}
[6f2edc]203example
[3d124a7]204{ "EXAMPLE:"; echo = 2;
[6f2edc]205   ring r  = 32003,(x,y),ds;
206   ideal i = x8,y8;
207   ideal j = (x+y)^4;
208   i       = intersect(i,j);
209   poly f  = xy;
[3d124a7]210   is_reg(f,i);
211}
212///////////////////////////////////////////////////////////////////////////////
213
214proc is_regs (ideal i, list #)
[d2b2a7]215"USAGE:   is_regs(i[,id]); i poly, id ideal or module (default: id=0)
[3d124a7]216RETURN:  1 if generators of i are a regular sequence modulo id, 0 otherwise
[fd5013]217NOTE:    Let R be the basering and id a submodule of R^n. The procedure checks
[3d124a7]218         injectivity of multiplication with i[k] on R^n/id+i[1..k-1].
[fd5013]219         The basering may be a quotient ring.
[6f2edc]220         printlevel >=0: display comments (default)
221         printlevel >=1: display comments during computation
[3d124a7]222EXAMPLE: example is_regs; shows an example
[d2b2a7]223"
[3d124a7]224{
[6f2edc]225   int d,ii,r;
226   int p = printlevel-voice+3;  // p=printlevel+1 (default: p=1)
[3d124a7]227   if( size(#)==0 ) { ideal id; }
228   else { def id=#[1]; }
229   if( size(i)==0 ) { return(0); }
[6f2edc]230   d=size(i);
[3d124a7]231   if( typeof(id)=="ideal" ) { ideal m=1; }
[6f2edc]232   if( typeof(id)=="module" ) { module m=freemodule(nrows(id)); }
233   for( ii=1; ii<=d; ii=ii+1 )
234   {
235      if( p>=2 )
[3d124a7]236      { "// checking whether element",ii,"is regular mod 1 ..",ii-1; }
[6f2edc]237      if( is_reg(i[ii],id)==0 )
238      {
239        dbprint(p,"// elements 1.."+string(ii-1)+" are regular, " +
240                string(ii)+" is not regular mod 1.."+string(ii-1));
241         return(0);
[3d124a7]242      }
[6f2edc]243      id=id+i[ii]*m;
[3d124a7]244   }
[6f2edc]245   if( p>=1 ) { "// elements are a regular sequence of length",d; }
[3d124a7]246   return(1);
247}
[6f2edc]248example
[3d124a7]249{ "EXAMPLE:"; echo = 2;
[6f2edc]250   int p      = printlevel;
251   printlevel = 1;
252   ring r1    = 32003,(x,y,z),ds;
253   ideal i    = x8,y8,(x+y)^4;
[3d124a7]254   is_regs(i);
[6f2edc]255   module m   = [x,0,y];
256   i          = x8,(x+z)^4;;
[3d124a7]257   is_regs(i,m);
[6f2edc]258   printlevel = p;
[3d124a7]259}
260///////////////////////////////////////////////////////////////////////////////
261
262proc milnor (ideal i)
[d2b2a7]263"USAGE:   milnor(i); i ideal or poly
[3d124a7]264RETURN:  Milnor number of i, if i is ICIS (isolated complete intersection
[6f2edc]265         singularity) in generic form, resp. -1 if not
[3d124a7]266NOTE:    use proc nf_icis to put generators in generic form
[a2c96e]267         printlevel >=1: display comments
[3d124a7]268EXAMPLE: example milnor; shows an example
[d2b2a7]269"
[6f2edc]270{
271  i = simplify(i,10);     //delete zeroes and multiples from set of generators
[3d124a7]272  int n = size(i);
273  int l,q,m_nr;  ideal t;  intvec disc;
[a2c96e]274  int p = printlevel-voice+2;             // p=printlevel+1 (default: p=0)
[6f2edc]275//---------------------------- hypersurface case ------------------------------
[457d505]276  if( n==1 or i==0 )
[3d124a7]277  {
278     i = std(jacob(i[1]));
[6f2edc]279     m_nr = vdim(i);
[a2c96e]280     if( m_nr<0 and p>=1 ) { "// Milnor number is infinite"; }
[6f2edc]281     return(m_nr);
[3d124a7]282  }
283//------------ isolated complete intersection singularity (ICIS) --------------
284  for( l=n; l>0; l=l-1)
[6f2edc]285  {   t      = minor(jacob(i),l);
286      i[l]   = 0;
[3d124a7]287      q      = vdim(std(i+t));
288      disc[l]= q;
289      if( q ==-1 )
[6f2edc]290      {  if( p>=1 )
[3d124a7]291            {  "// not in generic form or no ICIS; use proc nf_icis to put";
[6f2edc]292            "// generators in generic form and then try milnor again!";  }
[3d124a7]293         return(q);
294      }
[6f2edc]295      m_nr = q-m_nr;
[3d124a7]296  }
[6f2edc]297//---------------------------- change sign ------------------------------------
298  if (m_nr < 0) { m_nr=-m_nr; }
299  if( p>=1 ) { "//sequence of discriminant numbers:",disc; }
[3d124a7]300  return(m_nr);
301}
302example
303{ "EXAMPLE:"; echo = 2;
[6f2edc]304   int p      = printlevel;
[a2c96e]305   printlevel = 2;
[6f2edc]306   ring r     = 32003,(x,y,z),ds;
307   ideal j    = x5+y6+z6,x2+2y2+3z2,xyz+yx;
[3d124a7]308   milnor(j);
[6f2edc]309   poly f     = x7+y7+(x-y)^2*x2y2+z2;
310   milnor(f);
311   printlevel = p;
[3d124a7]312}
313///////////////////////////////////////////////////////////////////////////////
314
315proc nf_icis (ideal i)
[d2b2a7]316"USAGE:   nf_icis(i); i ideal
[3d124a7]317RETURN:  ideal = generic linear combination of generators of i if i is an ICIS
318         (isolated complete intersection singularity), return i if not
319NOTE:    this proc is useful in connection with proc milnor
[6f2edc]320         printlevel >=0: display comments (default)
[3d124a7]321EXAMPLE: example nf_icis; shows an example
[d2b2a7]322"
[3d124a7]323{
324   i = simplify(i,10);  //delete zeroes and multiples from set of generators
[6f2edc]325   int p,b = 100,0;
[3d124a7]326   int n = size(i);
327   matrix mat=freemodule(n);
[6f2edc]328   int P = printlevel-voice+3;  // P=printlevel+1 (default: P=1)
329//---------------------------- test: complete intersection? -------------------
[3d124a7]330   intvec sl = is_ci(i);
[6f2edc]331   if( n+sl[n] != nvars(basering) )
332   {
333      dbprint(P,"// no complete intersection");
334      return(i);
[3d124a7]335   }
[6f2edc]336//--------------- test: isolated singularity in generic form? -----------------
[3d124a7]337   sl = is_is(i);
338   if ( sl[n] != 0 )
339   {
[6f2edc]340      dbprint(P,"// no isolated singularity");
[3d124a7]341      return(i);
342   }
[6f2edc]343//------------ produce generic linear combinations of generators --------------
[3d124a7]344   int prob;
[6f2edc]345   while ( sum(sl) != 0 )
[3d124a7]346   {  prob=prob+1;
[6f2edc]347      p=p-25; b=b+10;
[3d124a7]348      i = genericid(i,p,b);          // proc genericid from random.lib
349      sl = is_is(i);
350   }
[6f2edc]351   dbprint(P,"// ICIS in generic form after "+string(prob)+" genericity loop(s)");
352   return(i);
[3d124a7]353}
354example
355{ "EXAMPLE:"; echo = 2;
[6f2edc]356   int p      = printlevel;
357   printlevel = 1;
358   ring r     = 32003,(x,y,z),ds;
359   ideal i    = x3+y4,z4+yx;
360   nf_icis(i);
361   ideal j    = x3+y4,xy,yz;
[3d124a7]362   nf_icis(j);
[6f2edc]363   printlevel = p;
[3d124a7]364}
365///////////////////////////////////////////////////////////////////////////////
366
367proc slocus (ideal i)
[9f9f2c]368"USAGE:   slocus(i);  i ideal
[3c4dcc]369RETURN:  ideal of singular locus of i
[c69ea5]370EXAMPLE: example slocus; shows an example
371"
372{
373  def R=basering;
374  int j,k;
375  ideal res;
376
377  if(ord_test(basering)!=1)
378  {
379     string va=varstr(basering);
380     if( size( parstr(basering))>0){va=va+","+parstr(basering);}
381     execute ("ring S = ("+charstr(basering)+"),("+va+"),dp;");
382     ideal i=imap(R,i);
383     list l=equidim(i);
384     setring R;
385     list l=imap(S,l);
386  }
387  else
388  {
389     list l=equidim(i);
390  }
391  int n=size(l);
392  if (n==1){return(slocusEqi(i));}
393  res=slocusEqi(l[1]);
394  for(j=2;j<=n;j++){res=intersect(res,slocusEqi(l[j]));}
395  for(j=1;j<n;j++)
396  {
397     for(k=j+1;k<=n;k++){res=intersect(res,l[j]+l[k]);}
398  }
399  return(res);
400}
401example
402{ "EXAMPLE:"; echo = 2;
403   ring r  = 0,(u,v,w,x,y,z),dp;
404   ideal i = wx,wy,wz,vx,vy,vz,ux,uy,uz,y3-x2;;
405   slocus(i);
406}
407///////////////////////////////////////////////////////////////////////////////
408
409static proc slocusEqi (ideal i)
410"USAGE:   slocus(i);  i ideal
[9f9f2c]411RETURN:  ideal of singular locus of i if i is pure dimensional
412NOTE:    this proc returns i and c-minors of jacobian ideal of i where c is the
[b9b906]413         codimension of i. Hence, if i is not pure dimensional, slocus may
414         return an ideal such that its 0-locus is strictly contained in the
[9f9f2c]415         singular locus of i
[3d124a7]416EXAMPLE: example slocus; shows an example
[d2b2a7]417"
[3d124a7]418{
[c69ea5]419  ideal ist=std(i);
420  if(deg(ist[1])==0){return(ist);}
421  int cod  = nvars(basering)-dim(ist);
[3d124a7]422  i        = i+minor(jacob(i),cod);
[6f2edc]423  return(i);
[3d124a7]424}
425example
426{ "EXAMPLE:"; echo = 2;
[9f9f2c]427   ring r  = 0,(x,y,z),ds;
[6f2edc]428   ideal i = x5+y6+z6,x2+2y2+3z2;
[9f9f2c]429   slocus(i);
[3d124a7]430}
431///////////////////////////////////////////////////////////////////////////////
432
[cd6dbb2]433proc qhspectrum (poly f, intvec w)
[fd5013]434"USAGE:   qhspectrum(f,w);  f=poly, w=intvec
[0fbdd1]435ASSUME:  f is a weighted homogeneous isolated singularity w.r.t. the weights
436         given by w; w must consist of as many positive integers as there
437         are variables of the basering
438COMPUTE: the spectral numbers of the w-homogeneous polynomial f, computed in a
[80a0f0]439         ring of characteristic 0
[82716e]440RETURN:  intvec  d,s1,...,su  where:
[c69ea5]441         d = w-degree(f)  and  si/d = i-th spectral-number(f)
[82716e]442         No return value if basering has parameters or if f is no isolated
[fd5013]443         singularity, displays a warning in this case.
[cd6dbb2]444EXAMPLE: example qhspectrum; shows an example
[d2b2a7]445"
[0fbdd1]446{
447   int i,d,W;
448   intvec sp;
449   def r   = basering;
450   if( find(charstr(r),",")!=0 )
451   {
452       "// coefficient field must not have parameters!";
453       return();
454    }
455   ring s  = 0,x(1..nvars(r)),ws(w);
456   map phi = r,maxideal(1);
457   poly f  = phi(f);
458   d       = ord(f);
459   W       = sum(w)-d;
460   ideal k = std(jacob(f));
461   if( vdim(k) == -1 )
462   {
463       "// f is no isolated singuarity!";
464       return();
465    }
466   k = kbase(k);
467   for (i=1; i<=size(k); i++)
[82716e]468   {
[0fbdd1]469      sp[i]=W+ord(k[i]);
470   }
471   list L  = sort(sp);
472   sp      = d,L[1];
473   return(sp);
474}
[82716e]475example
[0fbdd1]476{ "EXAMPLE:"; echo = 2;
477   ring r;
478   poly f=x3+y5+z2;
479   intvec w=10,6,15;
[cd6dbb2]480   qhspectrum(f,w);
[0fbdd1]481   // the spectrum numbers are:
482   // 1/30,7/30,11/30,13/30,17/30,19/30,23/30,29/30
483}
484///////////////////////////////////////////////////////////////////////////////
485
[3d124a7]486proc Tjurina (id, list #)
[d2b2a7]487"USAGE:   Tjurina(id[,<any>]);  id=ideal or poly
[6f2edc]488ASSUME:  id=ICIS (isolated complete intersection singularity)
489RETURN:  standard basis of Tjurina-module of id,
490         of type module if id=ideal, resp. of type ideal if id=poly.
[80a0f0]491         If a second argument is present (of any type) return a list: @*
[6f2edc]492           [1] = Tjurina number,
493           [2] = k-basis of miniversal deformation,
494           [3] = SB of Tjurina module,
495           [4] = Tjurina module
496DISPLAY: Tjurina number if printlevel >= 0 (default)
497NOTE:    Tjurina number = -1 implies that id is not an ICIS
498EXAMPLE: example Tjurina; shows examples
[d2b2a7]499"
[3d124a7]500{
501//---------------------------- initialisation ---------------------------------
[6f2edc]502  def i = simplify(id,10);
[3d124a7]503  int tau,n = 0,size(i);
504  if( size(ideal(i))==1 ) { def m=i; }  // hypersurface case
505  else { def m=i*freemodule(n); }       // complete intersection case
506//--------------- compute Tjurina module, Tjurina number etc ------------------
507  def t1 = jacob(i)+m;                  // Tjurina module/ideal
508  def st1 = std(t1);                    // SB of Tjurina module/ideal
509  tau = vdim(st1);                      // Tjurina number
[6f2edc]510  dbprint(printlevel-voice+3,"// Tjurina number = "+string(tau));
511  if( size(#)>0 )
512  {
513     def kB = kbase(st1);               // basis of miniversal deformation
514     return(tau,kB,st1,t1);
515  }
[3d124a7]516  return(st1);
517}
518example
519{ "EXAMPLE:"; echo = 2;
[6f2edc]520   int p      = printlevel;
521   printlevel = 1;
522   ring r     = 0,(x,y,z),ds;
523   poly f     = x5+y6+z7+xyz;        // singularity T[5,6,7]
524   list T     = Tjurina(f,"");
525   show(T[1]);                       // Tjurina number, should be 16
526   show(T[2]);                       // basis of miniversal deformation
527   show(T[3]);                       // SB of Tjurina ideal
528   show(T[4]); "";                   // Tjurina ideal
529   ideal j    = x2+y2+z2,x2+2y2+3z2;
530   show(kbase(Tjurina(j)));          // basis of miniversal deformation
531   hilb(Tjurina(j));                 // Hilbert series of Tjurina module
532   printlevel = p;
[3d124a7]533}
534///////////////////////////////////////////////////////////////////////////////
535
536proc tjurina (ideal i)
[d2b2a7]537"USAGE:   tjurina(id);  id=ideal or poly
[6f2edc]538ASSUME:  id=ICIS (isolated complete intersection singularity)
[3d124a7]539RETURN:  int = Tjurina number of id
[6f2edc]540NOTE:    Tjurina number = -1 implies that id is not an ICIS
[3d124a7]541EXAMPLE: example tjurina; shows an example
[d2b2a7]542"
[3d124a7]543{
[6f2edc]544   return(vdim(Tjurina(i)));
[3d124a7]545}
546example
547{ "EXAMPLE:"; echo = 2;
548   ring r=32003,(x,y,z),(c,ds);
549   ideal j=x2+y2+z2,x2+2y2+3z2;
[6f2edc]550   tjurina(j);
[3d124a7]551}
552///////////////////////////////////////////////////////////////////////////////
553
[0b59f5]554proc T_1 (ideal id, list #)
555"USAGE:   T_1(id[,<any>]);  id = ideal or poly
556RETURN:  T_1(id): of type module/ideal if id is of type ideal/poly.
557         We call T_1(id) the T_1-module of id. It is a std basis of the
[3d124a7]558         presentation of 1st order deformations of P/id, if P is the basering.
[6f2edc]559         If a second argument is present (of any type) return a list of
560         3 modules:
[0b59f5]561            [1]= T_1(id)
[3d124a7]562            [2]= generators of normal bundle of id, lifted to P
[6f2edc]563            [3]= module of relations of [2], lifted to P
564                 (note: transpose[3]*[2]=0 mod id)
565         The list contains all non-easy objects which must be computed
[0b59f5]566         to get T_1(id).
567DISPLAY: k-dimension of T_1(id) if printlevel >= 0 (default)
568NOTE:    T_1(id) itself is usually of minor importance. Nevertheless, from it
[6f2edc]569         all relevant information can be obtained. The most important are
[0b59f5]570         probably vdim(T_1(id)); (which computes the Tjurina number),
[fd5013]571         hilb(T_1(id)); and kbase(T_1(id)).
572         If T_1 is called with two arguments, then matrix([2])*(kbase([1]))
[6f2edc]573         represents a basis of 1st order semiuniversal deformation of id
574         (use proc 'deform', to get this in a direct way).
[fd5013]575         For a complete intersection the proc Tjurina is faster.
[0b59f5]576EXAMPLE: example T_1; shows an example
[d2b2a7]577"
[3d124a7]578{
579   ideal J=simplify(id,10);
580//--------------------------- hypersurface case -------------------------------
[6f2edc]581  if( size(J)<2 )
582  {
583     ideal t1  = std(J+jacob(J[1]));
584     module nb = [1]; module pnb;
[0b59f5]585     dbprint(printlevel-voice+3,"// dim T_1 = "+string(vdim(t1)));
[82716e]586     if( size(#)>0 )
587     {
588        module st1 = t1*gen(1);
[0fbdd1]589        attrib(st1,"isSB",1);
[82716e]590        return(st1,nb,pnb);
[0fbdd1]591     }
[3d124a7]592     return(t1);
593  }
594//--------------------------- presentation of J -------------------------------
595   int rk;
[3939bc]596   def P = basering;
[3d124a7]597   module jac, t1;
[6f2edc]598   jac  = jacob(J);                 // jacobian matrix of J converted to module
[3939bc]599   list A=nres(J,2);                // compute presentation of J
600   def A(1..2)=A[1..2]; kill A;     // A(2) = 1st syzygy module of J
[3d124a7]601//---------- go to quotient ring mod J and compute normal bundle --------------
[3939bc]602   qring  R    = std(J);
[6f2edc]603   module jac = fetch(P,jac);
604   module t1  = transpose(fetch(P,A(2)));
[fb9532f]605   list B=nres(t1,2);               // resolve t1, B(2)=(J/J^2)*=normal_bdl
[3939bc]606   def B(1..2)=B[1..2]; kill B;
[6f2edc]607   t1         = modulo(B(2),jac);   // pres. of normal_bdl/trivial_deformations
608   rk=nrows(t1);
[3d124a7]609//-------------------------- pull back to basering ----------------------------
[3939bc]610   setring P;
[0b59f5]611   t1 = fetch(R,t1)+J*freemodule(rk);  // T_1-module, presentation of T_1
[6f2edc]612   t1 = std(t1);
[0b59f5]613   dbprint(printlevel-voice+3,"// dim T_1 = "+string(vdim(t1)));
[6f2edc]614   if( size(#)>0 )
615   {
616      module B2 = fetch(R,B(2));        // presentation of normal bundle
617      list L = t1,B2,A(2);
618      attrib(L[1],"isSB",1);
619      return(L);
[3d124a7]620   }
[6f2edc]621   return(t1);
[3d124a7]622}
[6f2edc]623example
[3d124a7]624{ "EXAMPLE:"; echo = 2;
[6f2edc]625   int p      = printlevel;
626   printlevel = 1;
627   ring r     = 32003,(x,y,z),(c,ds);
628   ideal i    = xy,xz,yz;
[0b59f5]629   module T   = T_1(i);
630   vdim(T);                      // Tjurina number = dim_K(T_1), should be 3
631   list L=T_1(i,"");
[6f2edc]632   module kB  = kbase(L[1]);
[3d124a7]633   print(L[2]*kB);               // basis of 1st order miniversal deformation
[6f2edc]634   show(L[2]);                   // presentation of normal bundle
635   print(L[3]);                  // relations of i
636   print(transpose(L[3])*L[2]);  // should be 0 (mod i)
637   printlevel = p;
[3d124a7]638}
639///////////////////////////////////////////////////////////////////////////////
640
[0b59f5]641proc T_2 (ideal id, list #)
642"USAGE:   T_2(id[,<any>]);  id = ideal
643RETURN:  T_2(id): T_2-module of id . This is a std basis of a presentation of
[6f2edc]644         the module of obstructions of R=P/id, if P is the basering.
645         If a second argument is present (of any type) return a list of
646         4 modules and 1 ideal:
[0b59f5]647            [1]= T_2(id)
[3d124a7]648            [2]= standard basis of id (ideal)
[80a0f0]649            [3]= module of relations of id (=1st syzygy module of id) @*
[6f2edc]650            [4]= presentation of syz/kos
651            [5]= relations of Hom_P([3]/kos,R), lifted to P
652         The list contains all non-easy objects which must be computed
[0b59f5]653         to get T_2(id).
654DISPLAY: k-dimension of T_2(id) if printlevel >= 0 (default)
655NOTE:    The most important information is probably vdim(T_2(id)).
[fd5013]656         Use proc miniversal to get equations of the miniversal deformation.
[0b59f5]657EXAMPLE: example T_2; shows an example
[d2b2a7]658"
[3d124a7]659{
660//--------------------------- initialisation ----------------------------------
661  def P = basering;
[6f2edc]662   ideal J = id;
663   module kos,SK,B2,t2;
664   list L;
[3d124a7]665   int n,rk;
[6f2edc]666//------------------- presentation of non-trivial syzygies --------------------
[3939bc]667   list A=nres(J,2);                      // resolve J, A(2)=syz
668   def A(1..2)=A[1..2]; kill A;
[3d124a7]669   kos  = koszul(2,J);                    // module of Koszul relations
[6f2edc]670   SK   = modulo(A(2),kos);               // presentation of syz/kos
[3d124a7]671   ideal J0 = std(J);                     // standard basis of J
[6f2edc]672//?*** sollte bei der Berechnung von res mit anfallen, zu aendern!!
[3d124a7]673//---------------------- fetch to quotient ring mod J -------------------------
[3939bc]674   qring R = J0;                          // make P/J the basering
[6f2edc]675   module A2' = transpose(fetch(P,A(2))); // dual of syz
676   module t2  = transpose(fetch(P,SK));   // dual of syz/kos
[3939bc]677   list B=nres(t2,2);                     // resolve (syz/kos)*
678   def B(1..2)=B[1..2]; kill B;
[0b59f5]679   t2 = modulo(B(2),A2');                 // presentation of T_2
[6f2edc]680   rk = nrows(t2);
[3d124a7]681//---------------------  fetch back to basering -------------------------------
[3939bc]682   setring P;
[3d124a7]683   t2 = fetch(R,t2)+J*freemodule(rk);
[6f2edc]684   t2 = std(t2);
[0b59f5]685   dbprint(printlevel-voice+3,"// dim T_2 = "+string(vdim(t2)));
[6f2edc]686   if( size(#)>0 )
687   {
688      B2 = fetch(R,B(2));        // generators of Hom_P(syz/kos,R)
689      L  = t2,J0,A(2),SK,B2;
690      return(L);
[3d124a7]691   }
[6f2edc]692   return(t2);
[3d124a7]693}
694example
695{ "EXAMPLE:"; echo = 2;
[6f2edc]696   int p      = printlevel;
697   printlevel = 1;
698   ring  r    = 32003,(x,y),(c,dp);
699   ideal j    = x6-y4,x6y6,x2y4-x5y2;
[0b59f5]700   module T   = T_2(j);
[6f2edc]701   vdim(T);
702   hilb(T);"";
703   ring r1    = 0,(x,y,z),dp;
704   ideal id   = xy,xz,yz;
[0b59f5]705   list L     = T_2(id,"");
706   vdim(L[1]);                           // vdim of T_2
[6f2edc]707   print(L[3]);                          // syzygy module of id
708   printlevel = p;
[3d124a7]709}
710///////////////////////////////////////////////////////////////////////////////
711
[0b59f5]712proc T_12 (ideal i, list #)
713"USAGE:   T_12(i[,any]);  i = ideal
[80a0f0]714RETURN:  T_12(i): list of 2 modules: @*
715           *  standard basis of T_1-module =T_1(i), 1st order deformations @*
716           *  standard basis of T_2-module =T_2(i), obstructions of R=P/i @*
[6f2edc]717         If a second argument is present (of any type) return a list of
[80a0f0]718         9 modules, matrices, integers: @*
[0b59f5]719             [1]= standard basis of T_1-module
720             [2]= standard basis of T_2-module
721             [3]= vdim of T_1
722             [4]= vdim of T_2
[80a0f0]723             [5]= matrix, whose cols present infinitesimal deformations @*
724             [6]= matrix, whose cols are generators of relations of i(=syz(i)) @*
725             [7]= matrix, presenting Hom_P(syz/kos,R), lifted to P @*
[0b59f5]726             [8]= presentation of T_1-module, no std basis
727             [9]= presentation of T_2-module, no std basis
728DISPLAY: k-dimension of T_1 and T_2 if printlevel >= 0 (default)
[3d124a7]729NOTE:    Use proc miniversal from deform.lib to get miniversal deformation of i,
[fd5013]730         the list contains all objects used by proc miniversal.
[0b59f5]731EXAMPLE: example T_12; shows an example
[d2b2a7]732"
[3d124a7]733{
734//--------------------------- initialisation ----------------------------------
735   int  n,r1,r2,d1,d2;
[3bc8cd]736   def P = basering;
[3d124a7]737   i = simplify(i,10);
[6f2edc]738   module jac,t1,t2,sbt1,sbt2;
[0b59f5]739   matrix Kos,Syz,SK,kbT_1,Sx;
[6f2edc]740   list L;
[3d124a7]741   ideal  i0 = std(i);
742//-------------------- presentation of non-trivial syzygies -------------------
[3939bc]743   list I= nres(i,2);                           // resolve i
[6f2edc]744   Syz  = matrix(I[2]);                         // syz(i)
[3d124a7]745   jac = jacob(i);                              // jacobi ideal
[6f2edc]746   Kos = koszul(2,i);                           // koszul-relations
747   SK  = modulo(Syz,Kos);                       // presentation of syz/kos
[3d124a7]748//--------------------- fetch to quotient ring  mod i -------------------------
[3bc8cd]749   qring   Ox  = i0;                             // make P/i the basering
[6f2edc]750   module Jac = fetch(P,jac);
751   matrix No  = transpose(fetch(P,Syz));        // ker(No) = Hom(syz,Ox)
752   module So  = transpose(fetch(P,SK));         // Hom(syz/kos,R)
[3939bc]753   list resS  = nres(So,2);
[6f2edc]754   matrix Sx  = resS[2];
[3939bc]755   list resN  = nres(No,2);
[6f2edc]756   matrix Nx  = resN[2];
[0b59f5]757   module T_2  = modulo(Sx,No);                  // presentation of T_2
758   r2         = nrows(T_2);
759   module T_1  = modulo(Nx,Jac);                 // presentation of T_1
760   r1         = nrows(T_1);
[3d124a7]761//------------------------ pull back to basering ------------------------------
[3bc8cd]762   setring P;
[0b59f5]763   t1   = fetch(Ox,T_1)+i*freemodule(r1);
764   t2   = fetch(Ox,T_2)+i*freemodule(r2);
[3d124a7]765   sbt1 = std(t1);
766   d1   = vdim(sbt1);
[6f2edc]767   sbt2 = std(t2);
[3d124a7]768   d2   = vdim(sbt2);
[0b59f5]769   dbprint(printlevel-voice+3,"// dim T_1 = "+string(d1),"// dim T_2 = "+string(d2));
[3d124a7]770   if  ( size(#)>0)
771   {
[3bc8cd]772     if (d1>0)
773     {
[0b59f5]774       kbT_1 = fetch(Ox,Nx)*kbase(sbt1);
[3bc8cd]775     }
776     else
777     {
[0b59f5]778       kbT_1 = 0;
[82716e]779     }
[3bc8cd]780     Sx   = fetch(Ox,Sx);
[0b59f5]781     L = sbt1,sbt2,d1,d2,kbT_1,Syz,Sx,t1,t2;
[3bc8cd]782     return(L);
[3d124a7]783   }
[6f2edc]784   L = sbt1,sbt2;
785   return(L);
[3d124a7]786}
787example
788{ "EXAMPLE:"; echo = 2;
[6f2edc]789   int p      = printlevel;
790   printlevel = 1;
[720ff4]791   ring r     = 199,(x,y,z,u,v),(c,ws(4,3,2,3,4));
[6f2edc]792   ideal i    = xz-y2,yz2-xu,xv-yzu,yu-z3,z2u-yv,zv-u2;
793                            //a cyclic quotient singularity
[0b59f5]794   list L     = T_12(i,1);
[6f2edc]795   print(L[5]);             //matrix of infin. deformations
796   printlevel = p;
[3d124a7]797}
798///////////////////////////////////////////////////////////////////////////////
[1e745b]799proc codim (id1, id2)
[d2b2a7]800"USAGE:   codim(id1,id2); id1,id2 ideal or module, both must be standard bases
[0fbdd1]801RETURN:  int, which is:
[a2c96e]802         1. the vectorspace dimension of id1/id2 if id2 is contained in id1
803            and if this number is finite@*
[fd5013]804         2. -1 if the dimension of id1/id2 is infinite@*
[a2c96e]805         3. -2 if id2 is not contained in id1
806COMPUTE: consider the Hilbert series iv1(t) of id1 and iv2(t) of id2.
807         If codim(id1,id2) is finite,  q(t)=(iv2(t)-iv1(t))/(1-t)^n is
808         rational, and the codimension is the sum of the coefficients of q(t)
809         (n = dimension of basering).
[0fbdd1]810EXAMPLE: example codim; shows an example
[d2b2a7]811"
[1e745b]812{
813   intvec iv1, iv2, iv;
814   int i, d1, d2, dd, i1, i2, ia, ie;
[0fbdd1]815  //--------------------------- check id2 < id1 -------------------------------
816   ideal led = lead(id1);
817   attrib(led, "isSB",1);
818   i = size(NF(lead(id2),led));
[1e745b]819   if ( i > 0 )
820   {
821     return(-2);
822   }
823  //--------------------------- 1. check finiteness ---------------------------
824   i1 = dim(id1);
825   i2 = dim(id2);
826   if (i1 < 0)
827   {
[a2c96e]828     if ( i2 < 0 )
829     {
830        return(0);
831     }
[1e745b]832     if (i2 == 0)
833     {
[a2c96e]834       return (vdim(id2));
[1e745b]835     }
836     else
837     {
838       return(-1);
839     }
840   }
841   if (i2 != i1)
842   {
843     return(-1);
844   }
845   if (i2 <= 0)
846   {
847     return(vdim(id2)-vdim(id1));
848   }
[0fbdd1]849 // if (mult(id2) != mult(id1))
850 //{
851 //  return(-1);
852 // }
[1e745b]853  //--------------------------- module ---------------------------------------
854   d1 = nrows(id1);
855   d2 = nrows(id2);
856   dd = 0;
857   if (d1 > d2)
858   {
859     id2=id2,maxideal(1)*gen(d1);
860     dd = -1;
861   }
862   if (d2 > d1)
863   {
864     id1=id1,maxideal(1)*gen(d2);
865     dd = 1;
866   }
867  //--------------------------- compute first hilbertseries ------------------
868   iv1 = hilb(id1,1);
869   i1 = size(iv1);
870   iv2 = hilb(id2,1);
871   i2 = size(iv2);
872  //--------------------------- difference of hilbertseries ------------------
873   if (i2 > i1)
874   {
875     for ( i=1; i<=i1; i=i+1)
876     {
877       iv2[i] = iv2[i]-iv1[i];
878     }
879     ie = i2;
880     iv = iv2;
881   }
882   else
883   {
884     for ( i=1; i<=i2; i=i+1)
885     {
886       iv1[i] = iv2[i]-iv1[i];
887     }
888     iv = iv1;
889     for (ie=i1;ie>=0;ie=ie-1)
890     {
891       if (ie == 0)
892       {
[82716e]893         return(0);
[1e745b]894       }
895       if (iv[ie] != 0)
896       {
897         break;
898       }
899     }
900   }
901   ia = 1;
902   while (iv[ia] == 0) { ia=ia+1; }
903  //--------------------------- ia <= nonzeros <= ie -------------------------
904   iv1 = iv[ia];
905   for(i=ia+1;i<=ie;i=i+1)
906   {
907     iv1=iv1,iv[i];
908   }
909  //--------------------------- compute second hilbertseries -----------------
910   iv2 = hilb(iv1);
911  //--------------------------- check finitenes ------------------------------
912   i2 = size(iv2);
913   i1 = ie - ia + 1 - i2;
914   if (i1 != nvars(basering))
915   {
916     return(-1);
917   }
918  //--------------------------- compute result -------------------------------
919   i1 = 0;
920   for ( i=1; i<=i2; i=i+1)
921   {
922     i1 = i1 + iv2[i];
923   }
924   return(i1+dd);
925}
[0fbdd1]926example
927{ "EXAMPLE:"; echo = 2;
928   ring r  = 0,(x,y,z),dp;
929   ideal j = y6,x4;
930   ideal m = x,y;
931   attrib(m,"isSB",1);  //let Singular know that ideals are a standard basis
[82716e]932   attrib(j,"isSB",1);
[0fbdd1]933   codim(m,j);          // should be 23 (Milnor number -1 of y7-x5)
934}
[c69ea5]935
936///////////////////////////////////////////////////////////////////////////////
937
938proc tangentcone (id,list #)
939"USAGE:   tangentcone(id [,n]); id = ideal, n = int
940RETURN:  the tangent cone of id
[fd5013]941NOTE:    The procedure works for any monomial ordering.
942         If n=0 use std w.r.t. local ordering ds, if n=1 use locstd.
[c69ea5]943EXAMPLE: example tangentcone; shows an example
944"
945{
946  int ii,n;
947  def bas = basering;
948  ideal tang;
949  if (size(#) !=0) { n= #[1]; }
950  if( n==0 )
951  {
[334528]952     def @newr@=changeord("ds"); setring @newr@;
[c69ea5]953     ideal @id = imap(bas,id);
954     @id = std(@id);
955     setring bas;
956     id = imap(@newr@,@id);
957     kill @newr@;
958  }
959  else
960  {
961    id = locstd(id);
962  }
[3c4dcc]963
[c69ea5]964  for(ii=1; ii<=size(id); ii++)
965  {
[3c4dcc]966    tang[ii]=jet(id[ii],mindeg(id[ii]));
[c69ea5]967  }
[3c4dcc]968  return(tang);
[c69ea5]969}
970example
971{ "EXAMPLE:"; echo = 2;
972   ring R = 0,(x,y,z),ds;
973   ideal i  = 7xyz+z5,x2+y3+z7,5z5+y5;
974   tangentcone(i);
[3c4dcc]975}
[c69ea5]976///////////////////////////////////////////////////////////////////////////////
977
978proc locstd (id)
979"USAGE:   locstd (id); id = ideal
980RETURN:  a standard basis for a local degree ordering
981NOTE:    the procedure homogenizes id w.r.t. a new 1st variable @t@, computes
982         a SB wrt (dp(1),dp) and substitutes @t@ by 1.
983         Hence the result is a SB with respect to an ordering which sorts
984         first w.r.t. the order and then refines it with dp. This is a
985         local degree ordering.
986         This is done in order to avoid cancellation of units and thus
987         be able to use option(contentSB);
988EXAMPLE: example locstd; shows an example
989"
990{
991  int ii;
992  def bas = basering;
[3c4dcc]993  execute("ring  @r_locstd
[c69ea5]994     =("+charstr(bas)+"),(@t@,"+varstr(bas)+"),(dp(1),dp);");
995  ideal @id = imap(bas,id);
996  ideal @hid = homog(@id,@t@);
997  @hid = std(@hid);
998  @hid = subst(@hid,@t@,1);
999  setring bas;
1000  def @hid = imap(@r_locstd,@hid);
1001  attrib(@hid,"isSB",1);
1002  kill @r_locstd;
[3c4dcc]1003  return(@hid);
[c69ea5]1004}
1005example
1006{ "EXAMPLE:"; echo = 2;
1007   ring R = 0,(x,y,z),ds;
1008   ideal i  = xyz+z5,2x2+y3+z7,3z5+y5;
1009   locstd(i);
[3c4dcc]1010}
Note: See TracBrowser for help on using the repository browser.