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

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