source: git/Singular/LIB/deform.lib @ 400884

spielwiese
Last change on this file since 400884 was 6f2edc, checked in by Olaf Bachmann <obachman@…>, 27 years ago
Mon Apr 28 21:00:07 1997 Olaf Bachmann <obachman@ratchwum.mathematik.uni-kl.de (Olaf Bachmann)> * dunno why I am committing these libs -- have not modified any of them git-svn-id: file:///usr/local/Singular/svn/trunk@205 2c84dea3-7e68-4137-9b89-c4e89433aadc
  • Property mode set to 100644
File size: 18.6 KB
Line 
1// $Id: deform.lib,v 1.2 1997-04-28 19:27:15 obachman Exp $
2//(BM/GMG, last modified 22.06.96)
3///////////////////////////////////////////////////////////////////////////////
4LIBRARY:  deform.lib    PROCEDURES FOR COMPUTING MINIVERSAL DEFORMATION
5
6 miniversal(id[,deg]);  miniversal deformation of an isolated singularity id
7
8  SUB-PROCEDURES        used by main procedure:
9  apply_col(A,B);       put A into col-nf and apply same col-operations to B
10  defining_system(A,B); defining system for next degree of massey products
11  reduce_s(i,j,n);      add var(1)^(n+ord) to all polys of i and reduce mod j
12  lift_kbase(N,M);      coef-matrix expressing N as lin. comb. of k-basis of M
13  coef_ideal(M,s);      coef_matrices with respect to first s variables
14
15LIB "inout.lib";
16LIB "general.lib";
17LIB "sing.lib";
18LIB "matrix.lib";
19///////////////////////////////////////////////////////////////////////////////
20
21proc miniversal (ideal id,list #)
22USAGE:   miniversal(id[,d,na,va,o,iv]); id=ideal, d=integer,
23         na,va,o=strings, iv=intvec of positive integers
24COMUPTE: miniversal deformation of id up to degree d (default d=100)
25CREATE:  A ring with name `na` (e.g. R if na="R", default na="Ont") extending
26         the basering by new variables given by va (deformation parameters).
27         -- The new vars come before the old vars
28         -- The characteristic of `na`   is the characteristic of the basering.
29         -- The new vars are derived from va. If va is a single letter, say
30            va="T", and if n<=26 then T and the following n-1 letters from
31            T..Z..T (resp. T(1..n) if n>26) are taken as additional variables.
32            If va is a single letter followed by (, say va="x(", the new
33            variables are x(1),...,x(n) (default va="A").
34         -- The ordering is the product ordering between the ordering of r and
35            an ordering derived from `o`, which has to be local!! (default:
36            o="ds") [and iv (a weight vector)].
37            Type 'help extendring' for a more detailed explanation of the
38            ordering
39         -- Even if na,va,o are given, d and/or iv may be ommited. Then the
40            default values d=100, iv=0 (i.e. all weights = 1) are used.
41         The procedure creates also two ideals:
42            ideal jetJ - defining the miniversal base space (in `na`)
43            ideal jetF - defining miniversal total space (in `na`)
44NOTE:    printlevel >=0: display dimT1,T2 and explain created objects (default)
45         printlevel >=1: show partial + final result during computation
46         printlevel >=2: show also memory and time usage
47         printlevel >=3: test and show obstructions
48         printlevel >=4: create a file 'minbaseout' and (over) write part of
49                         ideal of miniversal base up to current degree into it
50         This proc uses 'execute' or calls a procedure using 'execute'.
51         If you use it in your own proc, let the local names of your proc
52         start with @ (see the file HelpForProc)
53EXAMPLE: example miniversal; shows an example
54{
55//------- initialisation ------------------------------------------------------
56   int @d,@deg,@t1,@t2,@colR,@noObstr,@j;
57   int p = printlevel-voice+3;  // p=printlevel+1 (default: p=1)
58   intvec @iv,@jv;
59   string @na,@va,@o;
60   if( size(#)==0 ) { @deg=100; @na="Ont"; @va="A"; @o="ds"; }
61   if( size(#)>=1 ) { if( typeof(#[1])!="int" ) { # = 100,#[1..size(#)]; }}
62   if( size(#)==1 ) { @deg=#[1]; @na="Ont"; @va="A"; @o="ds"; }
63   if( size(#)==2 ) { @deg=#[1]; @na=#[2];  @va="A"; @o="ds"; }
64   if( size(#)==3 ) { @deg=#[1]; @na=#[2];  @va=#[3]; @o="ds";}
65   if( size(#)==4 ) { @deg=#[1]; @na=#[2];  @va=#[3]; @o=#[4];}
66   if( size(#)==5 ) { @deg=#[1]; @na=#[2];  @va=#[3]; @o=#[4]; @iv=#[5]; }
67   if( find(@o,"s")==0 )
68   { "// ordering must be an s-ordering, please change!"; return();}
69
70  def @Pn = basering;
71   string @ords = ordstr(@Pn);
72   id = simplify(id,10);
73   int @rowR = size(id);
74   if( @rowR<=1 )
75   {
76      "// hypersurface, use proc deform from sing.lib";
77      return();
78   }
79//------- change ordering if not correct --------------------------------------
80   @t1=1;
81   for( @d=1;@d<=nvars(@Pn);@d=@d+1 ) { @t1=@t1*(lead(1+var(@d))==var(@d)); }
82   if( @t1==0 )
83   {
84      if( @ords[size(@ords)]!="c" and @ords[size(@ords)]!="C" )
85      {
86         if( @ords[1]=="c" ) { @ords=@ords[3,size(@ords)-2]+",c"; @t1=1;}
87         if( @ords[1]=="C" ) { @ords=@ords[3,size(@ords)-2]+",C"; @t1=1;}
88      }
89      if( @t1==1 )
90      {
91         changeord("@On",@ords,@Pn);
92         ideal id  = imap(@Pn,id);
93      }
94   }
95   if( defined(@On)==0 ) { def @On=@Pn; setring @On; }
96//-------  reproduce T12 -------------------------------------------------------
97   list   Ls   = T12(id,1);
98   matrix Ro   = Ls[6];                         //syz(i)
99   matrix InfD = Ls[5];                         //matrix of inf. deformations
100   matrix PreO = Ls[7];                         //present. mat of Syz/Kos^*
101   module PreT = Ls[9];                         //present. module of modT2
102   @t1 = Ls[3];                                 //vdim of T1
103   @t2 = Ls[4];                                 //vdim of T2
104   kill Ls;
105   dbprint(p-1,"","// ___ matrix of infinitesimal deformations:",InfD);
106   @colR = ncols(Ro);
107   ideal i0 = std(id);
108  qring @Ox = i0;                               //ring of singularity to deform
109   matrix Cup,lCup;
110   ideal testid;
111   matrix Ro   = fetch(@On,Ro);
112   matrix PreO = fetch(@On,PreO);
113   module PreT = fetch(@On,PreT);
114//---- create new ring with @t1=dim T1 additional variables and initialize ----
115
116  extendring(@na,@t1,@va,@o,@iv,0,@On);         //ring  containing miniversal
117                                                //deformation
118   @jv[@t1]=0; @jv=@jv+1; @jv[nvars(basering)]=0;       //@jv=
119                                                //weight-vector for calculating
120                                                //rel-jet with resp to def-para
121   ideal  jetF  = imap(@On,id);                 //(jet)ideal of minversal defor
122   export jetF;
123   matrix Fo = matrix(jetF);                    //initial equations
124   matrix Ro = imap(@On,Ro);
125   matrix Rs = imap(@On,Ro);                    //deformed syzygies
126   ideal  jetJ;                                 //(jet)ideal of minversal defor
127   export jetJ;
128   ideal  testid,Jo;
129   Jo  =  std(Jo);
130   matrix Fs[1][@rowR];                          //deformed equations
131   matrix F_R[1][@colR];                         //product Fs*Rs
132   matrix F_r[1][@colR];                         //reduced product mod jetJ
133   matrix Fn[1][@rowR];                          //last homog part of Fs
134   matrix Rn[@rowR][@colR];                      //last homog part of Rs
135   matrix Cup,lCup,Test;                         //presenting obstructions
136   matrix Mon[@t1][1]=maxideal(1);               //occuring monomials in deg d
137   Fn  = transpose(imap(@On,InfD)*Mon);          //infinitesimal deformations
138   Fs  = Fo + Fn;
139   jetF= Fs;
140   F_R = Fs*Rs;
141   if (@t2<=0) { @d=0; }                         //finished, if "T2=0"
142//------- start the loop ------------------------------------------------------
143   for (@d=1;@d<=@deg;@d=@d+1)
144   {
145      dbprint(p-1,"","// ___ start computation in degree "+string(@d)+":");
146      dbprint(p-2,"// memory = "+string(kmemory())+"k");
147//------- lift relation to next degree ----------------------------------------
148      F_r = reduce_s(F_R,Jo,@d+1);
149      Cup = matrix(jet(F_r,@d,@jv),1,@colR);
150      Rn  = (-1)*lift(Fo,Cup);
151      Rs  = Rs + Rn;
152      F_R = F_R + Fs*Rn;
153//------- test: already finished? ---------------------------------------------
154      testid = simplify(reduce(ideal(F_R),Jo),10);
155      if (testid[1]==0)
156      {  dbprint(p,"// ___ computation finished in degree "+string(@d));
157         if( @d==@deg )
158         { dbprint(p,"// ___ degree bound reached, result may not yet be complete!");}
159         break;
160      }
161//------- compute obstruction-matrix  -----------------------------------------
162      F_r = reduce_s(F_R,Jo,@d+1);
163      Cup = matrix(jet(F_r,@d+1,@jv),1,@colR);
164      Test= Cup;
165      dbprint(p-3,"","// ___ obstruction vector:",ideal(Cup));
166      Cup,Mon = coef_ideal(Cup,@t1);
167//------- express obstructions in kbase of T2  --------------------------------
168   setring @Ox;
169      Cup  = imap(`@na`,Cup);
170      lCup = lift(PreO,Cup);
171      lCup = lift_kbase(lCup,PreT);
172      @t2   = nrows(lCup);
173      dbprint(p-3,"","// ___ obstructions in kbase of T2:",lCup);
174      testid = simplify(ideal(lCup),10);               // test no obstructions
175      if (testid[1]==0)
176      { @noObstr=1;dbprint(p-3,"// ___ no obstruction"); } else { @noObstr=0; }
177      @j=size(module(gauss_col(lCup)));                // test:full obstruction
178      if (@j==ncols(lCup))
179      {  dbprint(p,"","// nothing to lift!",
180         "// ___ miniversal base, defined by jetJ, is a fat point!");
181         break;
182      }
183//------- compute ideal of minversal base (its k-jet) -------------------------
184   setring `@na`;
185      if (@noObstr==0)                              //case of non-zero obstr.
186      {
187         lCup = imap(@Ox,lCup);
188         Jo   = lCup*transpose(Mon);
189         jetJ = matrix(jetJ,1,@t2)+matrix(Jo,1,@t2);
190         dbprint(p-1,"","// ___ degree-"+string(@d+1)+"-part of ideal of miniversal base"+":",Jo);
191         if( p-1>=4 )
192         { write (">minbaseout","// part of ideal of miniversal base up to degree <= "+string(@d+1)+":",jetJ); }
193         Jo = std(jetJ);
194      }
195      F_r = reduce_s(F_R,Jo,@d+1);
196      Cup = matrix(jet(F_r,@d+1,@jv),1,@colR);
197//---------------- repeat test: jetJ ok in deg d+1? --------------------------
198      if( (p-1>=3) && (@noObstr==0) )
199      {
200         lCup,Mon = coef_ideal(Cup,@t1);
201      setring @Ox;
202         Cup  = imap(`@na`,Cup);
203         lCup = lift(PreO,Cup);
204         lCup = lift_kbase(lCup,PreT);
205         dbprint(p-3,"","// ____ test: jetJ ok iff all entries are 0",lCup);
206      setring `@na`;
207      }
208//---------------- lift equations F -----------------------------------------
209      if (defined(Qrg)) {kill Qrg;}
210  qring Qrg = std(ideal(Fo));
211      def Ro=fetch(`@na`,Ro);
212      def Cup=fetch(`@na`,Cup);
213      def Fn = lift(transpose(Ro),transpose(Cup));
214      Fn=(-1)*transpose(Fn);
215  setring `@na`;
216      Fn  = fetch(Qrg,Fn);
217      Fs  = Fs+Fn;
218      F_R = F_R+Fn*Rs;
219      jetF = matrix(Fs);
220      dbprint(p-1,"","// ___ degree-"+string(@d+1)+"-part of deformed equations:",Fn);
221   }
222//---------  end loop and final output ---------------------------------------
223dbprint(p-1,"","// ___ Equations of miniversal base space ___",jetJ,
224            "","// ___ Equations of miniversal total space ___",jetF);
225dbprint(p,"","// Result belongs to ring "+@na+".",
226       "// Equations of total space of miniversal deformation are ",
227       "// given by jetF, equations of miniversal base space by jetJ.",
228       "// Make "+@na+" the basering and list objects defined in "+@na+" by typing:",
229       "   setring "+@na+"; show("+@na+");","   listvar(ideal);");
230  kill @On;
231  return();
232}
233example
234{ "EXAMPLE:"; echo = 2;
235   int p          = printlevel;
236   ring r1        = 0,(x,y,z,u,v),ds;
237   matrix m[2][4] = x,y,z,u,y,z,u,v;
238   ideal i        = minor(m,2);          //cone over rational normal curve of degree 4
239   miniversal(i,"R","T(");
240   setring R;"";
241   // ___ Equations of miniversal base space ___:
242   jetJ;"";
243   // ___ Equations of miniversal total space ___:
244   jetF;"";
245   ring  r        = 0,(x,y,z),ds;
246   ideal i        = x2,xy,yz,zx;
247   printlevel     = 3;
248   miniversal(i);"";
249   printlevel     = p;
250   // NOTE: rings R and Ont are still alive!
251}
252///////////////////////////////////////////////////////////////////////////////
253
254proc apply_col (matrix A, matrix B)
255USAGE:   apply_col(A,B);  A,B=matrices
256ASSUME:  A = constant matrix in row-reduced (upper triangular) normal form,
257         B = matrix of same size
258COMUPTE: apply to B those col-operations which reduce A into col-reduced nf
259RETURN:  two transformed matrices: col-reduced A, transformed B
260EXAMPLE: example apply_col; shows an example
261{
262   int i,j,k;
263   poly m;
264   int r=nrows(A);
265   int c=ncols(A);
266   matrix C  = concat(transpose(A),transpose(B));
267   module mC = transpose(C);
268   for( k=1;k<=r;k=k+1 )
269   {
270      j=1;
271      while( C[j,k]==0 && j<c ) { j=j+1; }
272      for( i=j+1;i<=c;i=i+1 )
273      {
274         m = C[i,k];
275         mC[i] = mC[i]-m*mC[j];
276      }
277   }
278   C = transpose(matrix(mC));
279   matrix a[c][r] = C[1..c,1..r];
280   matrix b[c][nrows(B)] = C[1..c,1+r..ncols(C)];
281   return(transpose(a),transpose(b));
282}
283example
284{ "EXAMPLE:"; echo = 2;
285   ring R=0,(x,y,z),dp;
286   matrix A[3][3]=1,2,3;
287   print(A);
288   matrix B[3][3]=x,y,z,x2,y2,z2,xy,xz,yz;
289   print(B);
290   print(apply_col(A,B));
291   list L=apply_col(A,B);
292   print(L[2]);
293}
294///////////////////////////////////////////////////////////////////////////////
295
296proc defining_system (matrix A,matrix B)
297USAGE:   defining_system(A,B);  A,B=matrices
298ASSUME:  A a constant matrix
299COMPUTE: a defining system for next degree of massey products
300         (transform A into row reduced normal form, apply proc 'apply_col' to
301         A,B and store indices of 0-columns of A in intvec iv)
302RETURN:  two objects: intvec iv, matrix M (the transformed matrix B)
303         The columns of M with index from iv are a defining sytem
304EXAMPLE: example defining_system; shows an example
305{
306   int    k,l;
307   ideal  id;
308   intvec iv;
309   A      = gauss_row(A);                  // row-reduced nf of A
310   int rg = ncols(A);
311   A,B    = apply_col(A,B);                // special columne-reduction
312   for( k=1;k<=rg;k=k+1 )                  // collect zero-cols of B
313   {
314      if( A[k]==0) {l=l+1;iv[l]=k;}        // test if kth column is 0
315   }                                       // collect indices of 0-columns in iv
316   return(iv,B);
317}
318example
319{ "EXAMPLE:"; echo = 2;
320   ring R=0,(x,y,z),dp;
321   matrix A[3][3]=1,2,3,2,4,6,4,8,12;
322   print(A);
323   matrix B[3][3]=x,y,z,x2,y2,z2,xy,xz,yz;
324   print(B);
325   print(defining_system(A,B));
326}
327///////////////////////////////////////////////////////////////////////////////
328
329proc reduce_s (ideal i,ideal j,int n)
330USAGE:   reduce_s(i,j,n); i,j=ideals, n=integer
331RETURN:  add to all polys of i var(1)^(n+ord) and reduce mod std(j)
332         (to get correct reduction in s-order)
333NOTE:    apply jet(i,n-1) to get correct reduction (n > maxord(i)
334EXAMPLE: example reduce_s; shows an example
335
336{
337  int m = ncols(i);
338  int d,k;
339  ideal j0 = std(j);
340  for (k=1;k<=m;k=k+1)
341  {
342    if (deg(i[k])>=0)
343    {
344      d = n+deg(i[k])+1;
345      i[k]= reduce(i[k]+var(1)^d,j0);
346    }
347  }
348  return(i);
349}
350example
351{ "EXAMPLE:"; echo = 2;
352   ring r = 0,(x,y),ds;
353   poly f = x7+y7+(x-y)^2*x^2*y^2;
354   ideal j = jacob(f);
355   reduce_s(f,j,10);
356}
357///////////////////////////////////////////////////////////////////////////////
358
359proc lift_kbase (N, M)
360USAGE:   lift_kbase(N,M); N,M=poly/ideal/vector/module
361RETURN:  matrix A, coefficient matrix expressing N as linear combination of
362         k-basis of M. Let the k-basis have k elements and size(N)=c columns.
363         Then A satisfies:
364             matrix(reduce(N,std(M)),k,c) = matrix(kbase(std(M)))*A
365ASSUME:  dim(M)=0 and the monomial ordering is a well ordering or the last
366         block of the ordering is c or C
367EXAMPLE: example lift_kbase; shows an example
368{
369//----------  initialisation  -------------------------------------------------
370   string ords = ordstr(basering);
371   int    d,col,k,l;
372   module kb;
373   matrix testm;
374   vector v,p,q;
375//------- check wether ordering is correct ------------------------------------
376   k=1;
377   for( l=1;l<=nvars(basering);l=l+1 ) { k=k*(lead(1+var(l))==var(l)); }
378   if( k==0 )
379   {
380      if( ords[size(ords)]!="c" and ords[size(ords)]!="C" )
381      {
382         "// change ordering!";
383         "// ordering "+ordstr(basering)+" not implemented for this proc";
384         return();
385      }
386   }
387//----------  check assumtions  -----------------------------------------------
388   if( typeof(N)=="poly" ) { ideal J=ideal(N); kill N; module N=J; kill J; }
389   if( typeof(M)=="poly" ) { ideal J=ideal(M); kill M; module M=J; }
390   M = std(M);
391   d = vdim(M);
392   if( d<1 )
393   { "// second argument in `lift_kbase` has vdim",d; return(); }
394//----------  compute kbase and reduce(N,M) -----------------------------------
395   kb = kbase(M);
396   col = ncols(N);
397   N = reduce(N,M);
398   N = matrix(N,nrows(N),col);
399//----------  collecting coefficients of reduce(N,M) --------------------------
400   matrix result[d][col];
401   for( l=1;l<=col;l=l+1 )
402   {
403      v = N[l];
404      if( size(v)>0 )
405      {
406         for( k=1;k<=d;k=k+1 )
407         {
408            p = kb[k];
409            q = lead(v);
410            if( size(p-q)<2 )
411            {
412               result[k,l] = leadcoef(q);
413               v = v-q;
414               if( size(v)<1 ) { k=d+1; }
415               else { k=0; }
416            }
417         }
418      }
419   }
420//---------  final test -------------------------------------------------------
421   testm = matrix(N,nrows(kb),ncols(result))- matrix(kb)*result;
422   if( size(module(testm))!=0 )
423   {
424      "// proc `lift_kbase` did'nt work correctly!";
425      "// Please inform tthe authors";
426      return();
427   }
428   return(result);
429}
430example
431{"EXAMPLE:";     echo=2;
432  ring R=0,(x,y),ds;
433  module M=[x2,xy],[y2,xy],[0,xx],[0,yy];
434  module N=[x3+xy,x],[x,x+y2];
435  print(M);
436  module kb=kbase(std(M));
437  print(kb);
438  print(N);
439  matrix A=lift_kbase(N,M);
440  print(A);
441  matrix(reduce(N,std(M)),nrows(kb),ncols(A)) - matrix(kbase(std(M)))*A;
442}
443///////////////////////////////////////////////////////////////////////////////
444
445proc coef_ideal (matrix M,int s)
446USAGE:   coef_ideal(M,s); M=matrix, s=integer
447ASSUME:  M=matrix with only one row and without any constant term
448COMPUTE: coef_matrices with respect to first s variables
449RETURN:  2 matrices:
450         matrix of coefficients (each column is formed by the coefficients
451           of M with respect to some monomial)
452         row-matrix of corresponding monomials
453EXAMPLE: example coef_ideal; shows an example
454{
455  int   k,l,n,z;
456  int   cM = ncols(M);
457  ideal flatM = M;
458  ideal monId,flat;
459  poly  mon = product(maxideal(1),1..s);
460//--------- collect all monomials (!=1) ---------------------------------------
461  for (k=1;k<=cM;k=k+1)
462  {
463    matrix mci(k) = coef(flatM[k],mon);
464    flat = mci(k)[1,1..ncols(mci(k))];
465    if (flat[1]!=1)
466    { monId = monId,flat;}
467  }
468  monId = monId+ideal(0);
469  k=size(monId);
470  matrix BIG[cM][k];
471//---------  create coef_matrices  --------------------------------------------
472  for (n=1;n<=k;n=n+1)
473  {
474    for (l=1;l<=cM;l=l+1)
475    {
476      for (z=1;z<=ncols(mci(l));z=z+1)
477      {
478        if(mci(l)[1,z]==monId[n])
479        { BIG[l,n] = mci(l)[2,z];}
480      }
481    }
482  }
483  return(BIG,matrix(monId));
484}
485example
486{ "EXAMPLE:"; echo = 2;
487  ring Z = 0,(A,B,C,x,y,z),ds;
488  int  s = 3;
489  matrix M[1][4]=A+yB,2C,3AA,4BB+5CC;
490  print(M);
491  matrix Coe,Mon;
492  Coe,Mon = coef_ideal(M,s);
493  print(Coe);
494  print(Mon);
495}
496///////////////////////////////////////////////////////////////////////////////
Note: See TracBrowser for help on using the repository browser.