source: git/Singular/LIB/spcurve.lib @ a99a04

fieker-DuValspielwiese
Last change on this file since a99a04 was 9528ea, checked in by Anne Frühbis-Krüger <anne@…>, 23 years ago
*qnne: corrected some typing errors and line breaks git-svn-id: file:///usr/local/Singular/svn/trunk@5193 2c84dea3-7e68-4137-9b89-c4e89433aadc
  • Property mode set to 100644
File size: 31.3 KB
Line 
1// (anne, last modified 31.5.99)
2/////////////////////////////////////////////////////////////////////////////
3version="$Id: spcurve.lib,v 1.15 2001-02-06 11:38:07 anne Exp $";
4category="Singularities";
5info="
6LIBRARY: spcurve.lib    Deformations and Invariants of CM-codim 2 Singularities
7AUTHOR:  Anne Fruehbis-Krueger, anne@mathematik.uni-kl.de
8
9PROCEDURES:
10 isCMcod2(i);            presentation matrix of the ideal i, if i is CM
11 CMtype(i);              Cohen-Macaulay type of the ideal i
12 matrixT1(M,n);          1st order deformation T1 in matrix description
13 semiCMcod2(M,T1);       semiuniversal deformation of maximal minors of M
14 discr(sem,n);           discriminant of semiuniversal deformation
15 qhmatrix(M);            weights if M is quasihomogeneous
16 relweight(N,W,a);       relative matrix weight of N w.r.t. weights (W,a)
17 posweight(M,T1,i);      deformation of coker(M) of non-negative weight
18 KSpencerKernel(M);      kernel of the Kodaira-Spencer map
19";
20
21LIB "elim.lib";
22LIB "homolog.lib";
23LIB "inout.lib";
24LIB "poly.lib";
25/////////////////////////////////////////////////////////////////////////////
26
27proc isCMcod2(ideal kurve)
28"USAGE:   isCMcod2(i);   i an ideal
29RETURN:  presentation matrix of i, if i is Cohen-Macaulay of codimension 2 @*
30         a zero matrix otherwise
31EXAMPLE: example isCMcod2; shows an example"
32{
33  int p = printlevel-voice+3;  // p=printlevel+1 (default: p=1)
34//---------------------------------------------------------------------------
35// Compute a minimal free resolution of the ideal and check if the
36// resolution has the expected structure
37//---------------------------------------------------------------------------
38  list kurveres=mres(kurve,0);
39  matrix M=kurveres[2];
40  if ((size(kurveres)>3) &&
41         ((size(kurveres[3])>1) ||
42          ((size(kurveres[3])<=1) && (kurveres[3][1,1]!=0))))
43  {
44    dbprint(p,"//not Cohen-Macaulay, codim 2");
45    matrix ret=0;
46    return(ret);
47  }
48  return(M);
49}
50example
51{ "EXAMPLE:"; echo=2;
52  ring r=32003,(x,y,z),ds;
53  ideal i=xz,yz,x^3-y^4;
54  print(isCMcod2(i));
55}
56/////////////////////////////////////////////////////////////////////////////
57
58proc CMtype(ideal kurve)
59"USAGE:   CMtype(i);  i an ideal, CM of codimension 2
60RETURN:  Cohen-Macaulay type of i (integer)
61         (-1, if i is not Cohen-Macaulay of codimension 2)
62EXAMPLE: example CMtype; shows an example"
63{
64  int p = printlevel-voice+3;  // p=printlevel+1 (default: p=1)
65  int gt = -1;
66//---------------------------------------------------------------------------
67// Compute a minimal free resolution of the ideal and check if the
68// resolution has the expected structure
69//---------------------------------------------------------------------------
70  list kurveres;
71  kurveres=mres(kurve,0);
72  if ((size(kurveres)>3) &&
73         ((size(kurveres[3])>1) ||
74          ((size(kurveres[3])<=1) && (kurveres[3][1,1]!=0))))
75  {
76    dbprint(p,"//not Cohen-Macaulay, codim 2");
77    return(gt);
78  }
79//---------------------------------------------------------------------------
80// Return the Cohen-Macaulay type of i
81//---------------------------------------------------------------------------
82  matrix M = matrix(kurveres[2]);
83  gt = ncols(M);
84  return(gt);
85}
86example
87{ "EXAMPLE:"; echo=2;
88  ring r=32003,(x,y,z),ds;
89  ideal i=xy,xz,yz;
90  CMtype(i);
91}
92/////////////////////////////////////////////////////////////////////////////
93
94proc matrixT1(matrix M ,int n)
95"USAGE:   matrixT1(M,n);  M matrix, n integer
96ASSUME:  M is a presentation matrix of an ideal i, CM of codimension 2;
97         consider i as a family of ideals in a ring in the first n
98         variables where the remaining variables are considered as
99         parameters
100RETURN:  list consisting of the k x (k+1) matrix M and a module K_M such that
101         T1=Mat(k,k+1;R)/K_M is the space of first order deformations of i
102EXAMPLE: example matrixT1; shows an example"
103{
104  int p = printlevel-voice+3;  // p=printlevel+1 (default: p=1)
105//--------------------------------------------------------------------------
106// Initialization and sanity checks
107//--------------------------------------------------------------------------
108  int nr=nrows(M);
109  int nc=ncols(M);
110  if ( nr < nc )
111  {
112    M=transpose(M);
113    int temp=nc;
114    nc=nr;
115    nr=temp;
116    int tra=1;
117  }
118  if ( nr != (nc+1) )
119  {
120    ERROR("not a k x (k+1) matrix");
121  }
122//---------------------------------------------------------------------------
123// Construct the denominator - step by step
124// step 1: initialization
125//---------------------------------------------------------------------------
126  int gt=nc;
127  int i,j;
128  ideal m = M;
129  ideal dx;
130  ideal rv;
131  ideal lv;
132  matrix R[gt][gt]=0;
133  matrix L[gt+1][gt+1]=0;
134  matrix T1[n+gt*gt+(gt+1)*(gt+1)][gt*(gt+1)] = 0;
135//---------------------------------------------------------------------------
136// step 2: the derivatives of the matrix are generators of the denominator
137//---------------------------------------------------------------------------
138  for( i=1; i<= n; i++ )
139  {
140    dx=diff(m,var(i));
141    T1[i,1..gt*(gt+1)] = dx;
142  }
143//---------------------------------------------------------------------------
144// step 3: M*R is a generator as well
145//---------------------------------------------------------------------------
146  for( i=1; i <= gt; i++ )
147  {
148    for ( j=1 ; j <= gt ; j++ )
149    {
150      R[i,j]=1;
151      rv = M * R;
152      T1[n+(i-1)*gt+j,1..gt*(gt+1)] = rv;
153      R[i,j]=0;
154    }
155  }
156//---------------------------------------------------------------------------
157// step 4: so is L*M
158//---------------------------------------------------------------------------
159  for( i=1; i <= (gt+1); i++)
160  {
161    for( j=1 ; j <= (gt+1);j++ )
162    {
163      L[i,j]=1;
164      lv = L * M;
165      T1[n+gt*gt+(i-1)*(gt+1)+j,1..gt*(gt+1)] = lv;
166      L[i,j]=0;
167    }
168  }
169//---------------------------------------------------------------------------
170// Compute the vectorspace basis of T1
171//---------------------------------------------------------------------------
172  module t1 = module(transpose(T1));
173  list result=M,t1;
174  return(result);
175}
176example
177{ "EXAMPLE:"; echo = 2;
178  ring r=32003,(x(1),x(2),x(3)),ds;
179  ideal curve=x(1)*x(2),x(1)*x(3),x(2)*x(3);
180  matrix M=isCMcod2(curve);
181  matrixT1(M,3);
182}
183/////////////////////////////////////////////////////////////////////////////
184
185proc semiCMcod2(matrix M, module t1)
186"USAGE:   semiCMcod2(M,t1); M matrix, t1 module
187ASSUME:  M is a presentation matrix of an ideal i, CM of codimension 2,
188         and t1 is a presentation of the space of first order deformations
189         of i ((M,t1) as returned by the procedure matrixT1)
190CREATE:  new basering with name rneu
191RETURN:  ideal in rneu describing the semiuniversal deformation of i
192NOTE:    The current basering should not contain any variables named
193         A(j) where j is some integer!
194EXAMPLE: example semiCMcod2; shows an example"
195{
196  int p = printlevel-voice+3;  // p=printlevel+1 (default: p=1)
197//---------------------------------------------------------------------------
198// Initialization
199//---------------------------------------------------------------------------
200  module t1erz=kbase(std(t1));
201  int tau=vdim(t1);
202  int gt=ncols(M);
203  int i;
204  def r=basering;
205  if(size(M)!=gt*(gt+1))
206  {
207    gt=gt-1;
208  }
209  for(i=1; i<=size(t1erz); i++)
210  {
211    if(rvar(A(i)))
212    {
213      int jj=-1;
214      break;
215    }
216  }
217  if (defined(jj)>1)
218  {
219    if (jj==-1)
220    {
221      ERROR("Your ring contains a variable T(i)!");
222    }
223  }
224//---------------------------------------------------------------------------
225// Definition of the new ring and the image of M and t1 in the new ring
226//---------------------------------------------------------------------------
227  ring rtemp=0,(A(1..tau)),dp;
228  def rneu=r+rtemp;
229  setring rneu;
230  matrix M=imap(r,M);
231  ideal m=M;
232  module t1erz=imap(r,t1erz);
233//---------------------------------------------------------------------------
234// Construction of the presentation matrix of the versal deformation
235//---------------------------------------------------------------------------
236  matrix N=matrix(m);
237  matrix Mtemp[gt*(gt+1)][1];
238  for( i=1; i<=tau; i++)
239  {
240    Mtemp=t1erz[i];
241    N=N+A(i)*transpose(Mtemp);
242  }
243  ideal n=N;
244  matrix O[gt+1][gt]=n;
245//---------------------------------------------------------------------------
246// Construction of the return value
247//---------------------------------------------------------------------------
248  ideal result=minor(O,gt);
249  export rneu;
250  keepring rneu;
251  return(result);
252}
253example
254{ "EXAMPLE:"; echo=2;
255  ring r=32003,(x(1),x(2),x(3)),ds;
256  ideal curve=x(1)*x(2),x(1)*x(3),x(2)*x(3);
257  matrix M=isCMcod2(curve);
258  list l=matrixT1(M,3);
259  semiCMcod2(l[1],std(l[2]));
260}
261/////////////////////////////////////////////////////////////////////////////
262
263proc discr(ideal kurve, int n)
264"USAGE:   discr(sem,n);  sem ideal, n integer
265ASSUME:  sem is the versal deformation of an ideal of codimension 2. @*
266         the first n variables of the ring are treated as variables
267         all the others as parameters
268RETURN:  ideal describing the discriminant
269NOTE:    This is not a powerful algorithm!
270EXAMPLE: example discr; shows an example"
271{
272  int p = printlevel-voice+3;  // p=printlevel+1 (default: p=1)
273//---------------------------------------------------------------------------
274// some sanity checks and initialization
275//---------------------------------------------------------------------------
276  int i;
277  ideal sem=std(kurve);
278  ideal semdiff;
279  ideal J2;
280  int ncol=ncols(matrix(sem));
281  matrix Jacob[n][ncol];
282//---------------------------------------------------------------------------
283// compute the Jacobian matrix
284//---------------------------------------------------------------------------
285  for (i=1; i<=n; i++)
286  {
287    semdiff=diff(sem,var(i));
288    Jacob[i,1..ncol]=semdiff;
289  }
290//---------------------------------------------------------------------------
291// eliminate the first n variables in the ideal generated by
292// the versal deformation and the 2x2 minors of the Jacobian
293//---------------------------------------------------------------------------
294  semdiff=minor(Jacob,2);
295  J2=sem,semdiff;
296  J2=std(J2);
297  poly eli=1;
298  for(i=1; i<=n; i++)
299  {
300    eli=eli*var(i);
301  }
302  ideal dis=eliminate(J2,eli);
303  return(dis);
304}
305example
306{ "EXAMPLE:"; echo=2;
307  ring r=32003,(x(1),x(2),x(3)),ds;
308  ideal curve=x(1)*x(2),x(1)*x(3),x(2)*x(3);
309  matrix M=isCMcod2(curve);
310  list l=matrixT1(M,3);
311  def sem=semiCMcod2(l[1],std(l[2]));
312  basering;
313  discr(sem,3);
314}
315/////////////////////////////////////////////////////////////////////////////
316
317proc qhmatrix(matrix M)
318"USAGE:   qhmatrix(M);   M a k x (k+1) matrix
319RETURN:  list, consisting of an integer vector containing the weights of
320         the variables of the basering and an integer matrix giving the
321         weights of the entries of M, if M is quasihomogeneous;
322         zero integer vector and zero integer matrix, if M is not
323         quasihomogeneous, i.e. does not allow row and column weights
324EXAMPLE: example qhmatrix; shows an example"
325{
326  int p = printlevel-voice+3;  // p=printlevel+1 (default: p=1)
327//---------------------------------------------------------------------------
328// Initialization and sanity checks
329//---------------------------------------------------------------------------
330  def r=basering;
331  int i,j,temp;
332  int tra=0;
333  int nr=nrows(M);
334  int nc=ncols(M);
335  if ( nr > nc )
336  {
337    M=transpose(M);
338    temp=nc;
339    nc=nr;
340    nr=temp;
341    tra=1;
342  }
343  if ( nc != (nr+1) )
344  {
345    ERROR("not a k x (k+1) matrix");
346  }
347  ideal m=minor(M,nr);
348//---------------------------------------------------------------------------
349// get the weight using the fact that the matrix is quasihomogeneous, if
350// its maximal minors are, and check, whether M is really quasihomogeneous
351//---------------------------------------------------------------------------
352  intvec a=weight(m);
353  string tempstr="ring rneu=" + charstr(r) + ",(" + varstr(r) + "),Ws(" + string(a) + ");";
354  execute(tempstr);
355  def M=imap(r,M);
356  int difset=0;
357  list l;
358  int dif;
359  int donttest=0;
360  int comprow=0;
361  intmat W[nr][nc];
362//---------------------------------------------------------------------------
363// find a row not containing a 0
364//---------------------------------------------------------------------------
365  for(i=1; i<=nr; i++)
366  {
367    if(comprow==0)
368    {
369      comprow=i;
370      for(j=1; j<=nc; j++)
371      {
372        if(M[i,j]==0)
373        {
374          comprow=0;
375          break;
376        }
377      }
378    }
379  }
380//---------------------------------------------------------------------------
381// get the weights of the comprow'th row or use emergency exit
382//---------------------------------------------------------------------------
383  if(comprow==0)
384  {
385    intvec v=0;
386    intmat V=0
387    list ret=v,V;
388    return(ret);
389  }
390  else
391  {
392    for(j=1; j<=nc; j++)
393    {
394      l[j]=deg(lead(M[comprow,j]));
395    }
396  }
397//---------------------------------------------------------------------------
398// do the checks
399//---------------------------------------------------------------------------
400  for(i=1; i<=nr; i++)
401  {
402    if ( i==comprow )
403    {
404// this row should not be tested against itself
405      donttest=1;
406    }
407    else
408    {
409// initialize the difference of the rows, but ignore 0-entries
410      if (M[i,1]!=0)
411      {
412        dif=deg(lead(M[i,1]))-l[1];
413        difset=1;
414      }
415      else
416      {
417        list memo;
418        memo[1]=1;
419      }
420    }
421// check column by column
422    for(j=1; j<=nc; j++)
423    {
424      if(M[i,j]==0)
425      {
426        if(defined(memo)!=0)
427        {
428          memo[size(memo)+1]=j;
429        }
430        else
431        {
432          list memo;
433          memo[1]=j;
434        }
435      }
436      temp=deg(lead(M[i,j]));
437      if((difset!=1) && (donttest!=1) && (M[i,j]!=0))
438      {
439// initialize the difference of the rows, if necessary - still ignore 0s
440        dif=deg(lead(M[i,j]))-l[j];
441        difset=1;
442      }
443// is M[i,j] quasihomogeneous - else emergency exit
444      if(M[i,j]!=jet(M[i,j],temp,a)-jet(M[i,j],temp-1,a))
445      {
446        intvec v=0;
447        intmat V=0;
448        list ret=v,V;
449        return(ret);
450      }
451      if(donttest!=1)
452      {
453// check row and column weights - else emergency exit
454        if(((temp-l[j])!=dif) && (M[i,j]!=0) && (difset==1))
455        {
456          intvec v=0;
457          intmat V=0;
458          list ret=v,V;
459          return(ret);
460        }
461      }
462// set the weight matrix entry
463      W[i,j]=temp;
464    }
465// clean up the 0's we left out
466    if((difset==1) && (defined(memo)!=0))
467    {
468      for(j=1; j<=size(memo); j++)
469      {
470        W[i,memo[j]]=dif+l[memo[j]];
471      }
472      kill memo;
473    }
474    donttest=0;
475  }
476//---------------------------------------------------------------------------
477// transpose, if M was transposed during initialization, and return the list
478//---------------------------------------------------------------------------
479  if ( tra==1 )
480  {
481    W=transpose(W);
482  }
483  setring r;
484  list ret=a,W;
485  return(ret);
486}
487example
488{ "EXAMPLE:"; echo=2;
489  ring r=0,(x,y,z),ds;
490  matrix M[3][2]=z,0,y,x,x^3,y;
491  qhmatrix(M);
492  pmat(M);
493}
494/////////////////////////////////////////////////////////////////////////////
495
496proc relweight(matrix N, intmat W, intvec a)
497"USAGE:   relweight(N,W,a); N matrix, W intmat, a intvec
498ASSUME:  N is a non-zero matrix
499         W is an integer matrix of the same size as N
500         a is an integer vector giving the weights of the variables
501RETURN:  integer, max(a-weighted order(N_ij) - W_ij | all entries ij) @*
502         string "ERROR" if sizes do not match
503EXAMPLE: example relweight; shows an example"
504{
505  int p = printlevel-voice+3;  // p=printlevel+1 (default: p=1)
506//---------------------------------------------------------------------------
507// Initialization and sanity checks
508//---------------------------------------------------------------------------
509  if ((size(N)!=size(W)) || (ncols(N)!=ncols(W)))
510  {
511    ERROR("matrix size does not match");
512  }
513  if (size(a)!=nvars(basering))
514  {
515    ERROR("length of weight vector != number of variables");
516  }
517  int i,j,temp;
518  def r=basering;
519//---------------------------------------------------------------------------
520// Comparision entry by entry
521//---------------------------------------------------------------------------
522  for(i=1; i<=nrows(N); i++)
523  {
524    for(j=1; j<=ncols(N); j++)
525    {
526      if (N[i,j]!=0)
527      {
528        temp=mindeg1(N[i,j],a)-W[i,j];
529        if (defined(ret))
530        {
531          if(temp > ret)
532          {
533            ret=temp;
534          }
535        }
536        else
537        {
538          int ret=temp;
539        }
540      }
541    }
542  }
543  return(ret);
544}
545example
546{ "EXAMPLE:"; echo=2;
547  ring r=32003,(x,y,z),ds;
548  matrix N[2][3]=z,0,y,x,x^3,y;
549  intmat W[2][3]=1,1,1,1,1,1;
550  intvec a=1,1,1;
551  relweight(N,W,a);
552}
553/////////////////////////////////////////////////////////////////////////////
554
555proc posweight(matrix M, module t1, int choose, list #)
556"USAGE:   posweight(M,t1,n[,s]); M matrix, t1 module, n int, s string @*
557         n=0 : all deformations of non-negative weight @*
558         n=1 : only non-constant deformations of non-negative weight @*
559         n=2 : all deformations of positive weight @*
560         As an optional parameter the name of a new ring may be
561         specified.
562ASSUME:  M is a presentation matrix of a Cohen-Macaulay codimension 2
563         ideal and t1 is its T1 space in matrix notation
564CREATE:  new basering (default name: rneu); a different name for this ring
565         may be given as a 4th parameter
566RETURN:  list, consisting of a presentation matrix describing the deformation
567         given by the generators of T1 of non-negative/positive weight
568         and the weight vector for the new variables
569NOTE:   The current basering should not contain any variables named
570         T(i) where i is some integer!
571EXAMPLE: example posweight; shows an example"
572{
573//---------------------------------------------------------------------------
574// Initialization and sanity checks
575//---------------------------------------------------------------------------
576  if (size(#)>0)
577  {
578    if (typeof(#[1])=="string")
579    {
580      string newname=#[1];
581    }
582  }
583  if (attrib(t1,"isSB"))
584  {
585    module t1erz=kbase(t1);
586    int tau=vdim(t1);
587  }
588  else
589  { module t1erz=kbase(std(t1));
590    int tau=vdim(std(t1));
591  }
592  for(int i=1; i<=size(t1erz); i++)
593  {
594    if(rvar(T(i)))
595    {
596      int jj=-1;
597      break;
598    }
599  }
600  kill i;
601  if (defined(jj))
602  {
603    if (jj==-1)
604    {
605      ERROR("Your ring contains a variable T(i)!");
606    }
607  }
608  int pw=0;
609  int i;
610  def r=basering;
611  list l=qhmatrix(M);
612  int gt=ncols(M);
613  if(size(M)!=gt*(gt+1))
614  {
615    gt=gt-1;
616  }
617  matrix erzmat[gt+1][gt];
618  list erz;
619  if ((size(l[1])==1) && (l[1][1]==0) && (size(l[2])==1) && (l[2][1,1]==0))
620  {
621    ERROR("Internal Error: Problem determining the weights.");
622  }
623//---------------------------------------------------------------------------
624// Find the generators of T1 of non-negative weight
625//---------------------------------------------------------------------------
626  int relw;
627  list rlw;
628  for(i=1; i<=tau; i++)
629  {
630    erzmat=t1erz[i];
631    kill relw;
632    def relw=relweight(erzmat,l[2],l[1]);
633    if(typeof(relw)=="int")
634    {
635      if (((choose==0) && (relw>=0))
636           || ((choose==1) && (relw>=0) && (CMtype(minor(M+erzmat,gt))==gt))
637           || ((choose==2) && (relw > 0)))
638      {
639        pw++;
640        rlw[pw]=relw;
641        erz[pw]=erzmat;
642      }
643    }
644    else
645    {
646      ERROR("Internal Error: Problem determining relative weight.");
647    }
648  }
649//---------------------------------------------------------------------------
650// Definition of the new ring and the image of M and erz in the new ring
651//---------------------------------------------------------------------------
652  if(size(rlw)==0)
653  {
654    ERROR("Internal Error: Problem determining relative weight.");
655  }
656  intvec iv=rlw[1..size(rlw)];
657  ring rtemp=0,(T(1..pw)),dp;
658  def rneu=r+rtemp;
659  setring rneu;
660  matrix M=imap(r,M);
661  ideal m=M;
662// we cannot imap erz, if its size=0
663  if(pw==0)
664  {
665    list erz1;
666  }
667  else
668  {
669    list erz1=imap(r,erz);
670  }
671//---------------------------------------------------------------------------
672// Construction of the presentation matrix of the deformation
673//---------------------------------------------------------------------------
674  matrix N=matrix(m);
675  ideal mtemp;
676  matrix Mtemp[gt*(gt+1)][1];
677  for( i=1; i<=pw; i++)
678  {
679    mtemp=erz1[i];
680    Mtemp=mtemp;
681    N=N+T(i)*transpose(Mtemp);
682  }
683  ideal n=N;
684  matrix O[gt+1][gt]=n;
685//---------------------------------------------------------------------------
686// Keep the ring and return the matrix
687//---------------------------------------------------------------------------
688  if (defined(newname)>1)
689  {
690    def `newname`=rneu;
691    setring `newname`;
692    export `newname`;
693    keepring `newname`;
694  }
695  else
696  {
697    export rneu;
698    keepring rneu;
699  }
700  list ret=O,iv;
701  return(ret);
702}
703example
704{ "EXAMPLE:"; echo=2;
705  ring r=32003,(x(1),x(2),x(3)),ds;
706  ideal curve=(x(3)-x(1)^2)*x(3),(x(3)-x(1)^2)*x(2),x(2)^2-x(1)^7*x(3);
707  matrix M=isCMcod2(curve);
708  list l=matrixT1(M,3);
709  list li=posweight(l[1],std(l[2]),0);
710  pmat(li[1]);
711  li[2];
712}
713/////////////////////////////////////////////////////////////////////////////
714
715proc KSpencerKernel(matrix M,list #)
716"USAGE:     KSpencerKernel(M[,s][,v]);  M matrix, s string, v intvec @*
717           optional parameters (please specify in this order, if both are
718           present):
719           *  s = first of the names of the new rings
720              e.g. \"R\" leads to ring names R and R1
721           *  v of size n(n+1) leads to the following module ordering @*
722              gen(v[1]) > gen(v[2]) > ... > gen(v[n(n+1)]) where the matrix
723              entry ij corresponds to gen((i-1)*n+j)
724ASSUME:    M is a quasihomogeneous n x (n+1) matrix where the n minors define
725           an isolated space curve singularity
726CREATE:    2 new rings (default names: rneu and reneu)
727           different ring names may be specified as a 2nd parameter
728RETURN:    coefficient matrix representing the kernel of the Kodaira-
729           Spencer map of the family of non-negative deformations
730           having the given singularity as special fibre
731NOTE:      * the initial basering should not contain variables with name
732             e(i) or T(i), since those variable names will internally be
733             used by the script
734           * setting an intvec with 5 entries and name watchProgress
735             shows the progress of the computations: @*
736             watchProgress[1]>0  => option(prot) in groebner commands @*
737             watchProgress[2]>0  => trace output for highcorner @*
738             watchProgress[3]>0  => output of deformed matrix @*
739             watchProgress[4]>0  => result of elimination step @*
740             watchProgress[4]>1  => trace output of multiplications with xyz
741                                    and subsequent reductions @*
742             watchProgress[5]>0  => matrix representing the kernel using print
743EXAMPLE:   example KSpencerKernel; shows an example"
744{
745  int p = printlevel-voice+3;  // p=printlevel+1 (default: p=1)
746//---------------------------------------------------------------------------
747// Initialization and sanity checks
748//---------------------------------------------------------------------------
749  intvec optvec=option(get);
750  if (size(#)>0)
751  {
752    if (typeof(#[1])=="string")
753    {
754      string newname=#[1];
755    }
756    if (typeof(#[1])=="intvec")
757    {
758      intvec desiredorder=#[1];
759    }
760    if (size(#)>1)
761    {
762      if (typeof(#[2])=="intvec")
763      {
764        intvec desiredorder=#[2];
765      }
766    }
767  }
768  if (defined(watchProgress))
769  {
770    if ((typeof(watchProgress)!="intvec") || (size(watchProgress)<5))
771    {
772      "watchProgress should be an intvec with at least 5 entries";
773      "ignoring watchProgress";
774      def kksave=watchProgress;
775      kill watchProgress;
776    }
777  }
778  option(redTail);
779  if (nvars(basering) != 3 )
780  {
781    ERROR("It should be a curve in 3 space");
782  }
783//---------------------------------------------------------------------------
784// change to a basering with the correct weihted order
785//---------------------------------------------------------------------------
786  def rt=basering;
787  list wl=qhmatrix(M);
788  if ((size(wl)!=2) || ((wl[1]==0) && (wl[2]==0)))
789  {
790    ERROR("The matrix was not n x (n+1) or not quasihomogenous");
791  }
792  string ringre=" ring r=" + charstr(rt) + ",(x,y,z), Ws(" + string(wl[1]) + ");";
793  execute(ringre);
794  matrix M=imap(rt,M);
795  int ne=size(M);
796  if (defined(desiredorder)>1)
797  {
798    intvec iv;
799    for(int i=1;i<=size(desiredorder);i++)
800    {
801      iv[desiredorder[i]]=i;
802    }
803  }
804  else
805  {
806    intvec iv=1..ne;
807  }
808  list l=matrixT1(M,3);
809  if (dim(std(l[2])) != 0)
810  {
811    ERROR("The matrix does not define an isolated space curve singularity");
812  }
813  module t1qh=l[2];
814//--------------------------------------------------------------------------
815// Passing to a new ring with extra variables e(i) corresponding to
816// the module generators gen(i) for weighted standard basis computation
817// accepting weights for the gen(i)
818//--------------------------------------------------------------------------
819  int jj=0;
820  for(int i=1; i<=ne; i++)
821  {
822    if(rvar(e(i)))
823    {
824      jj=-1;
825    }
826  }
827  if (jj==-1)
828  {
829    ERROR("Your ring contains a variable e(i)!");
830  }
831  if(defined(desiredorder)>1)
832  {
833    ringre="ring re=" + charstr(r) +",(e(1.." + string(ne) + "),"+
834                        varstr(basering) + "),Ws(";
835    intvec tempiv=intvec(wl[2]);
836    for(i=1;i<=ne;i++)
837    {
838      ringre=ringre + string((-1)*tempiv[desiredorder[i]]) + ",";
839    }
840    ringre= ringre  + string(wl[1]) + ");";
841  }
842  else
843  {
844    ringre="ring re=" + charstr(r) +",(e(1.." + string(ne) + "),"+ varstr(basering)
845                        + "),Ws(" + string((-1)*intvec(wl[2])) + ","
846                        + string(wl[1]) + ");";
847  }
848  execute(ringre);
849  module temp=imap(r,t1qh);
850  ideal t1qh=mod2id(temp,iv);
851  if (defined(watchProgress))
852  {
853    if (watchProgress[1]!=0)
854    {
855      option(prot);
856      "Protocol output of the groebner computation (quasihomogenous case)";
857    }
858  }
859  ideal t1qhs=std(t1qh);
860  if (defined(watchProgress))
861  {
862    if (watchProgress[1]!=0)
863    {
864      "groebner computation finished";
865      option(noprot);
866    }
867  }
868  ideal t1qhsl=lead(t1qhs);
869  module mo=id2mod(t1qhsl,iv);
870//--------------------------------------------------------------------------
871// Return to the initial ring to compute the kbase and noether there
872// (in the new ring t1qh is of course not of dimension 0 but of dimension 3
873// so we have to go back)
874//--------------------------------------------------------------------------
875  setring r;
876  module mo=imap(re,mo);
877  attrib(mo,"isSB",1);                // mo is monomial ==> SB
878  attrib(mo,"isHomog",intvec(wl[2])); // highcorner has to respect the weights
879  vector noe=highcorner(mo);
880  if (defined(watchProgress))
881  {
882    if (watchProgress[2]!=0)
883    {
884      "weights corresponding to the entries of the matrix:";
885      wl;
886      "leading term of the groebner basis (quasihomogeneous case)";
887      mo;
888      "noether";
889      noe;
890    }
891  }
892//--------------------------------------------------------------------------
893// Define the family of curves with the same quasihomogeneous initial
894// matrix M, compute T1 and pass again to the ring with the variables e(i)
895//--------------------------------------------------------------------------
896  if (defined(newname)>1)
897  {
898    list li=posweight(M,mo,2,newname+"1");
899    def rneu=basering;
900  }
901  else
902  {
903    list li=posweight(M,mo,2);
904  }
905  if (size(li)<=1)
906  {
907    ERROR("Internal Error: Problem determining perturbations of weight > 0.")
908  }
909  if (defined(watchProgress))
910  {
911    if(watchProgress[3]!=0)
912    {
913      "perturbed matrix and weights of the perturbations:";
914      li;
915    }
916  }
917  list li2=matrixT1(li[1],3);
918  module Mpert=transpose(matrix(ideal(li2[1])));
919  module t1pert=li2[2];
920  int nv=nvars(rneu)-nvars(r);
921  ring rtemp=0,(T(1..nv)),wp(li[2]);
922  def reneu=re+rtemp;
923  setring reneu;
924  module noe=matrix(imap(r,noe));
925  ideal noet=mod2id(noe,iv);
926  module temp=imap(rneu,t1pert);
927  ideal t1pert=mod2id(temp,iv);
928//--------------------------------------------------------------------------
929// Compute the standard basis and select those generators with leading term
930// divisible by some T(i)
931//--------------------------------------------------------------------------
932  noether=noet[size(noet)];
933  if (defined(watchProgress))
934  {
935    if (watchProgress[1]!=0)
936    {
937      "protocol output of the groebner command (perturbed case)";
938      option(prot);
939    }
940  }
941  ideal t1perts=std(t1pert);
942  noether=noet[size(noet)];
943  t1perts=interred(t1perts);
944  if (defined(Debug))
945  {
946    if (watchProgress[1]!=0)
947    {
948      "groebner computation finished (perturbed case)";
949      option(noprot);
950    }
951  }
952  ideal templ=lead(t1perts);
953  for(int j=1;j<=nv;j++)
954  {
955    templ=subst(templ,T(j),0);
956  }
957  ideal mx;
958  ideal mt;
959  for(j=1;j<=size(t1perts);j++)
960  {
961    if(templ[j]!=0)
962    {
963      mx=mx,t1perts[j];
964    }
965    else
966    {
967      mt=mt,t1perts[j];
968    }
969  }
970//--------------------------------------------------------------------------
971// multiply by the initial ring variables to shift the generators with
972// leading term divisible by some T(i) and reduce afterwards
973//--------------------------------------------------------------------------
974                       // This is obviously no SB, but we have to reduce by
975  attrib(mx,"isSB",1); // it and setting isSB suppresses error messages
976  noether=noet[size(noet)];
977  ideal ker_gen=reduce(mt,mx);
978  ideal ovar=var(ne+1),var(ne+2),var(ne+3);
979  j=1;
980  noether=noet[size(noet)];
981  if (defined(watchProgress))
982  {
983    if (watchProgress[4]!=0)
984    {
985      "generators of the kernel as a C[T]{x} module:";
986      mt;
987      "noether:";
988      noether;
989    }
990  }
991  int zeros;
992  templ=ker_gen;
993  while(zeros==0)
994  {
995    zeros=1;
996    templ=templ*ovar;
997    templ=reduce(templ,mx);
998    if(defined(watchProgress))
999    {
1000      if(watchProgress[4]>1)
1001      {
1002        templ;
1003      }
1004    }
1005    if (size(templ)!= 0)
1006    {
1007      zeros=0;
1008      ker_gen=ker_gen,templ;
1009    }
1010  }
1011//-------------------------------------------------------------------------
1012// kill zero entries, keep only one of identical entries
1013//-------------------------------------------------------------------------
1014  ovar=var(1);
1015  for(i=2;i<=ne;i++)
1016  {
1017    ovar=ovar,var(i);
1018  }
1019  ker_gen=ker_gen,ovar^2;
1020  noether=noet[size(noet)];
1021  ker_gen=simplify(ker_gen,10);
1022//-------------------------------------------------------------------------
1023// interreduce ker_gen as a k[T]-module
1024//-------------------------------------------------------------------------
1025  intvec mgen=1..(ne+3);
1026  ideal Mpert=mod2id(imap(rneu,Mpert),iv);
1027  templ=0;
1028  for(i=1;i<=nv;i++)
1029  {
1030    templ[i]=diff(Mpert[size(Mpert)],T(i));
1031  }
1032  templ=templ,ovar^2;
1033  list retl=subrInterred(templ,ker_gen,mgen);
1034// Build up the matrix representing L
1035  module retlm=transpose(retl[2]);
1036  for(i=1;i<=size(retl[1]);i++)
1037  {
1038    if(reduce(retl[1][1,i],std(ovar^2))==0)
1039    {
1040      retlm[i]=0;
1041    }
1042  }
1043  retlm=simplify(transpose(simplify(transpose(retlm),10)),10);
1044  if(defined(watchProgress))
1045  {
1046    if(watchProgress[5]>0)
1047    {
1048      print(retlm);
1049    }
1050  }
1051  ker_gen=retl[3];
1052// we define ret=i(L),(delta_j(t_k))_jk
1053  list ret=id2mod(ker_gen,iv),matrix(retlm);
1054// cleanups - define what we previously killed
1055  if(defined(kksave)>1)
1056  {
1057    def watchProgress=kksave;
1058    export watch Progress;
1059  }
1060  option(set,optvec);
1061// make sure that the exported ring has the right name
1062  if (defined(newname)>1)
1063  {
1064    def `newname`=reneu;
1065    setring `newname`;
1066    export `newname`;
1067    keepring `newname`;
1068  }
1069  else
1070  {
1071    export reneu;
1072    keepring reneu;
1073  }
1074  return(ret[2]);
1075}
1076example
1077{ "EXAMPLE:"; echo=2;
1078  ring r=0,(x,y,z),ds;
1079  matrix M[3][2]=z-x^7,0,y^2,z,x^9,y;
1080  def KS=KSpencerKernel(M,"ar");
1081  print(KS);
1082  nameof(basering);
1083  basering;
1084}
1085///////////////////////////////////////////////////////////////////////////
1086
Note: See TracBrowser for help on using the repository browser.