source: git/Singular/LIB/sing.lib @ 0fbdd1

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