source: git/Singular/LIB/gmssing.lib @ 0dd77c2

spielwiese
Last change on this file since 0dd77c2 was 0610f0e, checked in by Hans Schoenemann <hannes@…>, 14 years ago
format git-svn-id: file:///usr/local/Singular/svn/trunk@12790 2c84dea3-7e68-4137-9b89-c4e89433aadc
  • Property mode set to 100644
File size: 37.5 KB
Line 
1///////////////////////////////////////////////////////////////////////////////
2version="$Id$";
3category="Singularities";
4
5info="
6LIBRARY:  gaussman.lib  Gauss-Manin System of Isolated Singularities
7
8AUTHOR:   Mathias Schulze, email: mschulze@mathematik.uni-kl.de
9
10OVERVIEW: A library to compute invariants related to the the Gauss-Manin system
11          of an isolated hypersurface singularity
12
13PROCEDURES:
14 gmsring(t,s);              Gauss-Manin system of t with variable s
15 gmsnf(p,K);                Gauss-Manin normal form of p
16 gmscoeffs(p,K);            Gauss-Manin basis representation of p
17 bernstein(t);              Bernstein-Sato polynomial of t
18 monodromy(t);              Jordan data of complex monodromy of t
19 spectrum(t);               singularity spectrum of t
20 sppairs(t);                spectral pairs of t
21 vfilt(t);                  V-filtration of t on Brieskorn lattice
22 vwfilt(t);                 weighted V-filtration of t on Brieskorn lattice
23 tmatrix(t);                matrix of t w.r.t. good basis of Brieskorn lattice
24 endvfilt(V);               endomorphism V-filtration on Jacobian algebra
25 sppnf(a,w[,m]);            spectral pairs normal form of (a,w[,m])
26 sppprint(spp);             print spectral pairs spp
27 spadd(sp1,sp2);            sum of spectra sp1 and sp2
28 spsub(sp1,sp2);            difference of spectra sp1 and sp2
29 spmul(sp0,k);              linear combination of spectra sp
30 spissemicont(sp[,opt]);    semicontinuity test of spectrum sp
31 spsemicont(sp0,sp[,opt]);  semicontinuous combinations of spectra sp0 in sp
32 spmilnor(sp);              Milnor number of spectrum sp
33 spgeomgenus(sp);           geometrical genus of spectrum sp
34 spgamma(sp);               gamma invariant of spectrum sp
35
36SEE ALSO: mondromy_lib, spectrum_lib, gmspoly_lib
37
38KEYWORDS: singularities; Gauss-Manin system; Brieskorn lattice;
39          mixed Hodge structure; V-filtration; weight filtration
40          Bernstein-Sato polynomial; monodromy; spectrum; spectral pairs;
41          good basis
42";
43
44LIB "linalg.lib";
45
46///////////////////////////////////////////////////////////////////////////////
47
48static proc stdtrans(ideal I)
49{
50  def @R=basering;
51
52  string os=ordstr(@R);
53  int j=find(os,",C");
54  if(j==0)
55  {
56    j=find(os,"C,");
57  }
58  if(j==0)
59  {
60    j=find(os,",c");
61  }
62  if(j==0)
63  {
64    j=find(os,"c,");
65  }
66  if(j>0)
67  {
68    os[j..j+1]="  ";
69  }
70
71  execute("ring @S="+charstr(@R)+",(gmspoly,"+varstr(@R)+"),(c,dp,"+os+");");
72
73  ideal I=homog(imap(@R,I),gmspoly);
74  module M=transpose(transpose(I)+freemodule(ncols(I)));
75  M=std(M);
76
77  setring(@R);
78  execute("map h=@S,1,"+varstr(@R)+";");
79  module M=h(M);
80
81  for(int i=ncols(M);i>=1;i--)
82  {
83    for(j=ncols(M);j>=1;j--)
84    {
85      if(M[i][1]==0)
86      {
87        M[i]=0;
88      }
89      if(i!=j&&M[j][1]!=0)
90      {
91        if(lead(M[i][1])/lead(M[j][1])!=0)
92        {
93          M[i]=0;
94        }
95      }
96    }
97  }
98
99  M=transpose(simplify(M,2));
100  I=M[1];
101  attrib(I,"isSB",1);
102  M=M[2..ncols(M)];
103  module U=transpose(M);
104
105  return(list(I,U));
106}
107///////////////////////////////////////////////////////////////////////////////
108
109proc gmsring(poly t,string s)
110"USAGE:    gmsring(t,s); poly t, string s
111ASSUME:   characteristic 0; local degree ordering;
112          isolated critical point 0 of t
113RETURN:
114@format
115ring G;  Gauss-Manin system of t with variable s
116  poly gmspoly=t;
117  ideal gmsjacob;  Jacobian ideal of t
118  ideal gmsstd;  standard basis of Jacobian ideal
119  matrix gmsmatrix;  matrix(gmsjacob)*gmsmatrix==matrix(gmsstd)
120  ideal gmsbasis;  monomial vector space basis of Jacobian algebra
121  int gmsmaxdeg;  maximal weight of variables
122@end format
123NOTE:     gmsbasis is a C[[s]]-basis of H'' and [t,s]=s^2
124KEYWORDS: singularities; Gauss-Manin system; Brieskorn lattice
125EXAMPLE:  example gmsring; shows examples
126"
127{
128  def @R=basering;
129  if(charstr(@R)!="0")
130  {
131    ERROR("characteristic 0 expected");
132  }
133  for(int i=nvars(@R);i>=1;i--)
134  {
135    if(var(i)>1)
136    {
137      ERROR("local ordering expected");
138    }
139  }
140
141  ideal dt=jacob(t);
142  list l=stdtrans(dt);
143  ideal g=l[1];
144  if(vdim(g)<=0)
145  {
146    if(vdim(g)==0)
147    {
148      ERROR("singularity at 0 expected");
149    }
150    else
151    {
152      ERROR("isolated critical point 0 expected");
153    }
154  }
155  matrix B=l[2];
156  ideal m=kbase(g);
157
158  int gmsmaxdeg;
159  for(i=nvars(@R);i>=1;i--)
160  {
161    if(deg(var(i))>gmsmaxdeg)
162    {
163      gmsmaxdeg=deg(var(i));
164    }
165  }
166
167  string os=ordstr(@R);
168  int j=find(os,",C");
169  if(j==0)
170  {
171    j=find(os,"C,");
172  }
173  if(j==0)
174  {
175    j=find(os,",c");
176  }
177  if(j==0)
178  {
179    j=find(os,"c,");
180  }
181  if(j>0)
182  {
183    os[j..j+1]="  ";
184  }
185
186  execute("ring G="+string(charstr(@R))+",("+s+","+varstr(@R)+"),(ws("+
187    string(deg(highcorner(g))+2*gmsmaxdeg)+"),"+os+",c);");
188
189  poly gmspoly=imap(@R,t);
190  ideal gmsjacob=imap(@R,dt);
191  ideal gmsstd=imap(@R,g);
192  matrix gmsmatrix=imap(@R,B);
193  ideal gmsbasis=imap(@R,m);
194
195  attrib(gmsstd,"isSB",1);
196  export gmspoly,gmsjacob,gmsstd,gmsmatrix,gmsbasis,gmsmaxdeg;
197  exportto(Top, gmsmaxdeg);
198
199  return(G);
200}
201example
202{ "EXAMPLE:"; echo=2;
203  ring @R=0,(x,y),ds;
204  poly t=x5+x2y2+y5;
205  def G=gmsring(t,"s");
206  setring(G);
207  gmspoly;
208  print(gmsjacob);
209  print(gmsstd);
210  print(gmsmatrix);
211  print(gmsbasis);
212  gmsmaxdeg;
213}
214///////////////////////////////////////////////////////////////////////////////
215
216proc gmsnf(ideal p,int K)
217"USAGE:    gmsnf(p,K); poly p, int K
218ASSUME:   basering returned by gmsring
219RETURN:
220  list nf;
221  ideal nf[1];  projection of p to <gmsbasis>C[[s]] mod s^(K+1)
222  ideal nf[2];  p==nf[1]+nf[2]
223NOTE:     computation can be continued by setting p=nf[2]
224KEYWORDS: singularities; Gauss-Manin system; Brieskorn lattice
225EXAMPLE:  example gmsnf; shows examples
226"
227{
228  if(system("with","gms"))
229  {
230    return(system("gmsnf",p,gmsstd,gmsmatrix,(K+1)*deg(var(1))-2*gmsmaxdeg,K));
231  }
232
233  intvec v=1;
234  v[nvars(basering)]=0;
235
236  int k;
237  ideal r,q;
238  r[ncols(p)]=0;
239  q[ncols(p)]=0;
240
241  poly s;
242  int i,j;
243  for(k=ncols(p);k>=1;k--)
244  {
245    while(p[k]!=0&&deg(lead(p[k]),v)<=K)
246    {
247      i=1;
248      s=lead(p[k])/lead(gmsstd[i]);
249      while(i<ncols(gmsstd)&&s==0)
250      {
251        i++;
252        s=lead(p[k])/lead(gmsstd[i]);
253      }
254      if(s!=0)
255      {
256        p[k]=p[k]-s*gmsstd[i];
257        for(j=1;j<=nrows(gmsmatrix);j++)
258        {
259          p[k]=p[k]+diff(s*gmsmatrix[j,i],var(j+1))*var(1);
260        }
261      }
262      else
263      {
264        r[k]=r[k]+lead(p[k]);
265        p[k]=p[k]-lead(p[k]);
266      }
267      while(deg(lead(p[k]))>(K+1)*deg(var(1))-2*gmsmaxdeg&&
268        deg(lead(p[k]),v)<=K)
269      {
270        q[k]=q[k]+lead(p[k]);
271        p[k]=p[k]-lead(p[k]);
272      }
273    }
274    q[k]=q[k]+p[k];
275  }
276
277  return(list(r,q));
278}
279example
280{ "EXAMPLE:"; echo=2;
281  ring R=0,(x,y),ds;
282  poly t=x5+x2y2+y5;
283  def G=gmsring(t,"s");
284  setring(G);
285  list l0=gmsnf(gmspoly,0);
286  print(l0[1]);
287  list l1=gmsnf(gmspoly,1);
288  print(l1[1]);
289  list l=gmsnf(l0[2],1);
290  print(l[1]);
291}
292///////////////////////////////////////////////////////////////////////////////
293
294proc gmscoeffs(ideal p,int K)
295"USAGE:    gmscoeffs(p,K); poly p, int K
296ASSUME:   basering constructed by gmsring
297RETURN:
298@format
299list l;
300  matrix l[1];  C[[s]]-basis representation of p mod s^(K+1)
301  ideal l[2];  p==matrix(gmsbasis)*l[1]+l[2]
302@end format
303NOTE:     computation can be continued by setting p=l[2]
304KEYWORDS: singularities; Gauss-Manin system; Brieskorn lattice
305EXAMPLE:  example gmscoeffs; shows examples
306"
307{
308  list l=gmsnf(p,K);
309  ideal r,q=l[1..2];
310  poly v=1;
311  for(int i=2;i<=nvars(basering);i++)
312  {
313    v=v*var(i);
314  }
315  matrix C=coeffs(r,gmsbasis,v);
316  return(list(C,q));
317}
318example
319{ "EXAMPLE:"; echo=2;
320  ring R=0,(x,y),ds;
321  poly t=x5+x2y2+y5;
322  def G=gmsring(t,"s");
323  setring(G);
324  list l0=gmscoeffs(gmspoly,0);
325  print(l0[1]);
326  list l1=gmscoeffs(gmspoly,1);
327  print(l1[1]);
328  list l=gmscoeffs(l0[2],1);
329  print(l[1]);
330}
331///////////////////////////////////////////////////////////////////////////////
332
333static proc mindegree(matrix A)
334{
335  int d=-1;
336
337  int i,j;
338  for(i=nrows(A);i>=1;i--)
339  {
340    for(j=ncols(A);j>=1;j--)
341    {
342      if(d==-1||(ord(A[i,j])<d&&ord(A[i,j])>-1))
343      {
344        d=ord(A[i,j]);
345      }
346    }
347  }
348
349  return(d);
350}
351///////////////////////////////////////////////////////////////////////////////
352
353static proc maxdegree(matrix A)
354{
355  int d=-1;
356
357  int i,j;
358  for(i=nrows(A);i>=1;i--)
359  {
360    for(j=ncols(A);j>=1;j--)
361    {
362      if(deg(A[i,j])>d)
363      {
364        d=deg(A[i,j]);
365      }
366    }
367  }
368
369  return(d);
370}
371///////////////////////////////////////////////////////////////////////////////
372
373static proc saturate()
374{
375  int mu=ncols(gmsbasis);
376  ideal r=gmspoly*gmsbasis;
377  matrix A0[mu][mu],C;
378  module H0;
379  module H,H1=freemodule(mu),freemodule(mu);
380  int k=-1;
381  list l;
382
383  dbprint(printlevel-voice+2,"// compute saturation of H''");
384  while(size(reduce(H,std(H0*var(1))))>0)
385  {
386    dbprint(printlevel-voice+2,"// compute matrix A of t");
387    k++;
388    dbprint(printlevel-voice+2,"// k="+string(k));
389    l=gmscoeffs(r,k);
390    C,r=l[1..2];
391    A0=A0+C;
392
393    dbprint(printlevel-voice+2,"// compute saturation step");
394    H0=H;
395    H1=jet(module(A0*H1+var(1)^2*diff(matrix(H1),var(1))),k);
396    H=H*var(1)+H1;
397  }
398
399  A0=A0-k*var(1);
400  dbprint(printlevel-voice+2,"// compute basis of saturation of H''");
401  H=std(H0);
402
403  dbprint(printlevel-voice+2,"// transform H'' to saturation of H''");
404  H0=division(freemodule(mu)*var(1)^k,H,k*deg(var(1)))[1];
405
406  return(A0,r,H,H0,k);
407}
408///////////////////////////////////////////////////////////////////////////////
409
410static proc tjet(matrix A0,ideal r,module H,int K0,int K)
411{
412  dbprint(printlevel-voice+2,"// compute matrix A of t");
413  dbprint(printlevel-voice+2,"// k="+string(K0+K+1));
414  list l=gmscoeffs(r,K0+K+1);
415  matrix C;
416  C,r=l[1..2];
417  A0=A0+C;
418  dbprint(printlevel-voice+2,"// transform A to saturation of H''");
419  matrix A=division(A0*H+var(1)^2*diff(matrix(H),var(1)),H,
420    (K+1)*deg(var(1)))[1]/var(1);
421  return(A,A0,r);
422}
423///////////////////////////////////////////////////////////////////////////////
424
425static proc eigenval(matrix A0,ideal r,module H,int K0)
426{
427  dbprint(printlevel-voice+2,
428    "// compute eigenvalues e with multiplicities m of A1");
429  matrix A;
430  A,A0,r=tjet(A0,r,H,K0,0);
431  list l=eigenvals(A);
432  def e,m=l[1..2];
433  dbprint(printlevel-voice+2,"// e="+string(e));
434  dbprint(printlevel-voice+2,"// m="+string(m));
435  return(e,m,A0,r);
436}
437///////////////////////////////////////////////////////////////////////////////
438
439static proc transform(matrix A,matrix A0,ideal r,module H,module H0,ideal e,
440  intvec m,int K0,int K,int opt)
441{
442  int mu=ncols(gmsbasis);
443
444  int i,j,k;
445  intvec d;
446  d[ncols(e)]=0;
447  if(opt)
448  {
449    dbprint(printlevel-voice+2,
450      "// compute rounded maximal differences d of e");
451    for(i=1;i<=ncols(e);i++)
452    {
453      d[i]=int(e[ncols(e)]-e[i]);
454    }
455  }
456  else
457  {
458    dbprint(printlevel-voice+2,
459      "// compute maximal integer differences d of e");
460    for(i=1;i<ncols(e);i++)
461    {
462      for(j=i+1;j<=ncols(e);j++)
463      {
464        k=int(e[j]-e[i]);
465        if(number(e[j]-e[i])==k)
466        {
467          if(k>d[i])
468          {
469            d[i]=k;
470          }
471          if(-k>d[j])
472          {
473            d[j]=-k;
474          }
475        }
476      }
477    }
478  }
479  dbprint(printlevel-voice+2,"// d="+string(d));
480
481  for(i,k=1,0;i<=size(d);i++)
482  {
483    if(k<d[i])
484    {
485      k=d[i];
486    }
487  }
488  A,A0,r=tjet(A0,r,H,K0,K+k);
489
490  module U,V;
491  if(k>0)
492  {
493    int i0,j0,i1,j1;
494    list l;
495
496    while(k>0)
497    {
498      dbprint(printlevel-voice+2,"// transform to separate eigenvalues");
499      U=0;
500      for(i=1;i<=ncols(e);i++)
501      {
502        U=U+syz(power(jet(A,0)-e[i],m[i]));
503      }
504      V=inverse(U);
505      A=V*A*U;
506      H=H*U;
507      H0=V*H0;
508
509      dbprint(printlevel-voice+2,"// transform to reduce maximum of d by 1");
510      for(i0,i=1,1;i0<=ncols(e);i0++)
511      {
512        for(i1=1;i1<=m[i0];i1,i=i1+1,i+1)
513        {
514          for(j0,j=1,1;j0<=ncols(e);j0++)
515          {
516            for(j1=1;j1<=m[j0];j1,j=j1+1,j+1)
517            {
518              if(d[i0]==0&&d[j0]>=1)
519              {
520                A[i,j]=A[i,j]*var(1);
521              }
522              if(d[i0]>=1&&d[j0]==0)
523              {
524                A[i,j]=A[i,j]/var(1);
525              }
526            }
527          }
528        }
529      }
530
531      H0=transpose(H0);
532      for(i0,i=1,1;i0<=ncols(e);i0++)
533      {
534        if(d[i0]>=1)
535        {
536          for(i1=1;i1<=m[i0];i1,i=i1+1,i+1)
537          {
538            H[i]=H[i]*var(1);
539          }
540          d[i0]=d[i0]-1;
541        }
542        else
543        {
544          for(i1=1;i1<=m[i0];i1,i=i1+1,i+1)
545          {
546            A[i,i]=A[i,i]-1;
547            H0[i]=H0[i]*var(1);
548          }
549          e[i0]=e[i0]-1;
550        }
551      }
552      H0=transpose(H0);
553
554      l=sppnf(list(e,d,m));
555      e,d,m=l[1..3];
556
557      k--;
558      K0++;
559    }
560
561    A=jet(A,K);
562  }
563
564  dbprint(printlevel-voice+2,"// transform to separate eigenvalues");
565  U=0;
566  for(i=1;i<=ncols(e);i++)
567  {
568    U=U+syz(power(jet(A,0)-e[i],m[i]));
569  }
570  V=inverse(U);
571  A=V*A*U;
572  H=H*U;
573  H0=V*H0;
574
575  return(A,A0,r,H,H0,e,m,K0);
576}
577///////////////////////////////////////////////////////////////////////////////
578
579proc bernstein(poly t)
580"USAGE:    bernstein(t); poly t
581ASSUME:   characteristic 0; local degree ordering;
582          isolated critical point 0 of t
583RETURN:
584@format
585list bs;  Bernstein-Sato polynomial b(s) of t
586  ideal bs[1];
587    number bs[1][i];  i-th root of b(s)
588  intvec bs[2];
589    int bs[2][i];  multiplicity of i-th root of b(s)
590@end format
591KEYWORDS: singularities; Gauss-Manin system; Brieskorn lattice;
592          Bernstein-Sato polynomial
593EXAMPLE:  example bernstein; shows examples
594"
595{
596  def @R=basering;
597  int n=nvars(@R)-1;
598  def @G=gmsring(t,"s");
599  setring(@G);
600
601  matrix A;
602  module U0;
603  ideal e;
604  intvec m;
605
606  def A0,r,H,H0,K0=saturate();
607  A,A0,r=tjet(A0,r,H,K0,0);
608  list l=minipoly(A);
609  e,m=l[1..2];
610  e=-e;
611  l=spnf(spadd(list(e,m),list(ideal(-1),intvec(1))));
612
613  setring(@R);
614  list l=imap(@G,l);
615  kill @G,gmsmaxdeg;
616
617  return(l);
618}
619example
620{ "EXAMPLE:"; echo=2;
621  ring R=0,(x,y),ds;
622  poly t=x5+x2y2+y5;
623  bernstein(t);
624}
625///////////////////////////////////////////////////////////////////////////////
626
627proc monodromy(poly t)
628"USAGE:    monodromy(t); poly t
629ASSUME:   characteristic 0; local degree ordering;
630          isolated critical point 0 of t
631RETURN:
632@format
633list l;  Jordan data jordan(M) of monodromy matrix exp(-2*pi*i*M)
634  ideal l[1];
635    number l[1][i];  eigenvalue of i-th Jordan block of M
636  intvec l[2];
637    int l[2][i];  size of i-th Jordan block of M
638  intvec l[3];
639    int l[3][i];  multiplicity of i-th Jordan block of M
640@end format
641SEE ALSO: mondromy_lib, linalg_lib
642KEYWORDS: singularities; Gauss-Manin system; Brieskorn lattice; monodromy
643EXAMPLE:  example monodromy; shows examples
644"
645{
646  def @R=basering;
647  int n=nvars(@R)-1;
648  def @G=gmsring(t,"s");
649  setring(@G);
650
651  matrix A;
652  module U0;
653  ideal e;
654  intvec m;
655
656  def A0,r,H,H0,K0=saturate();
657  e,m,A0,r=eigenval(A0,r,H,K0);
658  A,A0,r,H,H0,e,m,K0=transform(A,A0,r,H,H0,e,m,K0,0,0);
659
660  list l=jordan(A,e,m);
661  setring(@R);
662  list l=imap(@G,l);
663  kill @G,gmsmaxdeg;
664
665  return(l);
666}
667example
668{ "EXAMPLE:"; echo=2;
669  ring R=0,(x,y),ds;
670  poly t=x5+x2y2+y5;
671  monodromy(t);
672}
673///////////////////////////////////////////////////////////////////////////////
674
675proc spectrum(poly t)
676"USAGE:    spectrum(t); poly t
677ASSUME:   characteristic 0; local degree ordering;
678          isolated critical point 0 of t
679RETURN:
680@format
681list sp;  singularity spectrum of t
682  ideal sp[1];
683    number sp[1][i];  i-th spectral number
684  intvec sp[2];
685    int sp[2][i];  multiplicity of i-th spectral number
686@end format
687SEE ALSO: spectrum_lib
688KEYWORDS: singularities; Gauss-Manin system; Brieskorn lattice;
689          mixed Hodge structure; V-filtration; spectrum
690EXAMPLE:  example spectrum; shows examples
691"
692{
693  list l=vwfilt(t);
694  return(spnf(list(l[1],l[3])));
695}
696example
697{ "EXAMPLE:"; echo=2;
698  ring R=0,(x,y),ds;
699  poly t=x5+x2y2+y5;
700  spprint(spectrum(t));
701}
702///////////////////////////////////////////////////////////////////////////////
703
704proc sppairs(poly t)
705"USAGE:    sppairs(t); poly t
706ASSUME:   characteristic 0; local degree ordering;
707          isolated critical point 0 of t
708RETURN:
709@format
710list spp;  spectral pairs of t
711  ideal spp[1];
712    number spp[1][i];  V-filtration index of i-th spectral pair
713  intvec spp[2];
714    int spp[2][i];  weight filtration index of i-th spectral pair
715  intvec spp[3];
716    int spp[3][i];  multiplicity of i-th spectral pair
717@end format
718SEE ALSO: spectrum_lib
719KEYWORDS: singularities; Gauss-Manin system; Brieskorn lattice;
720          mixed Hodge structure; V-filtration; weight filtration;
721          spectrum; spectral pairs
722EXAMPLE:  example sppairs; shows examples
723"
724{
725  list l=vwfilt(t);
726  return(list(l[1],l[2],l[3]));
727}
728example
729{ "EXAMPLE:"; echo=2;
730  ring R=0,(x,y),ds;
731  poly t=x5+x2y2+y5;
732  sppprint(sppairs(t));
733}
734///////////////////////////////////////////////////////////////////////////////
735
736proc vfilt(poly t)
737"USAGE:    vfilt(t); poly t
738ASSUME:   characteristic 0; local degree ordering;
739          isolated critical point 0 of t
740RETURN:
741@format
742list v;  V-filtration on H''/s*H''
743  ideal v[1];
744    number v[1][i];  V-filtration index of i-th spectral number
745  intvec v[2];
746    int v[2][i];  multiplicity of i-th spectral number
747  list v[3];
748    module v[3][i];  vector space of i-th graded part in terms of v[4]
749  ideal v[4];  monomial vector space basis of H''/s*H''
750  ideal v[5];  standard basis of Jacobian ideal
751@end format
752SEE ALSO: spectrum_lib
753KEYWORDS: singularities; Gauss-Manin system; Brieskorn lattice;
754          mixed Hodge structure; V-filtration; spectrum
755EXAMPLE:  example vfilt; shows examples
756"
757{
758  list l=vwfilt(t);
759  return(spnf(list(l[1],l[3],l[4]))+list(l[5],l[6]));
760}
761example
762{ "EXAMPLE:"; echo=2;
763  ring R=0,(x,y),ds;
764  poly t=x5+x2y2+y5;
765  vfilt(t);
766}
767///////////////////////////////////////////////////////////////////////////////
768
769proc vwfilt(poly t)
770"USAGE:    vwfilt(t); poly t
771ASSUME:   characteristic 0; local degree ordering;
772          isolated critical point 0 of t
773RETURN:
774@format
775list vw;  weighted V-filtration on H''/s*H''
776  ideal vw[1];
777    number vw[1][i];  V-filtration index of i-th spectral pair
778  intvec vw[2];
779    int vw[2][i];  weight filtration index of i-th spectral pair
780  intvec vw[3];
781    int vw[3][i];  multiplicity of i-th spectral pair
782  list vw[4];
783    module vw[4][i];  vector space of i-th graded part in terms of vw[5]
784  ideal vw[5];  monomial vector space basis of H''/s*H''
785  ideal vw[6];  standard basis of Jacobian ideal
786@end format
787SEE ALSO: spectrum_lib
788KEYWORDS: singularities; Gauss-Manin system; Brieskorn lattice;
789          mixed Hodge structure; V-filtration; weight filtration;
790          spectrum; spectral pairs
791EXAMPLE:  example vwfilt; shows examples
792"
793{
794  def @R=basering;
795  int n=nvars(@R)-1;
796  def @G=gmsring(t,"s");
797  setring(@G);
798
799  int mu=ncols(gmsbasis);
800  matrix A;
801  ideal e;
802  intvec m;
803
804  def A0,r,H,H0,K0=saturate();
805  e,m,A0,r=eigenval(A0,r,H,K0);
806  A,A0,r,H,H0,e,m,K0=transform(A,A0,r,H,H0,e,m,K0,0,1);
807
808  dbprint(printlevel-voice+2,"// compute weight filtration basis");
809  list l=jordanbasis(A,e,m);
810  def U,v=l[1..2];
811  kill l;
812  vector u0;
813  int v0;
814  int i,j,k,l;
815  for(k,l=1,1;l<=ncols(e);k,l=k+m[l],l+1)
816  {
817    for(i=k+m[l]-1;i>=k+1;i--)
818    {
819      for(j=i-1;j>=k;j--)
820      {
821        if(v[i]>v[j])
822        {
823          v0=v[i];v[i]=v[j];v[j]=v0;
824          u0=U[i];U[i]=U[j];U[j]=u0;
825        }
826      }
827    }
828  }
829
830  dbprint(printlevel-voice+2,"// transform to weight filtration basis");
831  matrix V=inverse(U);
832  A=V*A*U;
833  dbprint(printlevel-voice+2,"// compute standard basis of H''");
834  H=H*U;
835  H0=std(V*H0);
836
837  dbprint(printlevel-voice+2,"// compute spectral pairs");
838  ideal a;
839  intvec w;
840  for(i=1;i<=mu;i++)
841  {
842    j=leadexp(H0[i])[nvars(basering)+1];
843    a[i]=A[j,j]+ord(H0[i])/deg(var(1))-1;
844    w[i]=v[j]+n;
845  }
846  H=H*H0;
847  H=simplify(jet(H/var(1)^(mindegree(H)/deg(var(1))),0),1);
848
849  kill l;
850  list l=sppnf(list(a,w,H))+list(gmsbasis,gmsstd);
851  setring(@R);
852  list l=imap(@G,l);
853  kill @G,gmsmaxdeg;
854  attrib(l[5],"isSB",1);
855
856  return(l);
857}
858example
859{ "EXAMPLE:"; echo=2;
860  ring R=0,(x,y),ds;
861  poly t=x5+x2y2+y5;
862  vwfilt(t);
863}
864///////////////////////////////////////////////////////////////////////////////
865
866static proc fsplit(ideal e0,intvec m0,matrix A,module H,module H0)
867{
868  int mu=ncols(gmsbasis);
869
870  dbprint(printlevel-voice+2,"// compute standard basis of H''");
871  H0=std(H0);
872  H0=simplify(H0,1);
873
874  dbprint(printlevel-voice+2,"// compute Hodge filtration");
875  int i,j,k;
876  ideal e;
877  intvec m;
878  e[mu]=0;
879  for(i=1;i<=ncols(e0);i++)
880  {
881    for(j=m0[i];j>=1;j--)
882    {
883      k++;
884      e[k]=e0[i];
885      m[k]=i;
886    }
887  }
888
889  number n,n0;
890  vector v,v0;
891  list F;
892  for(i=ncols(e0);i>=1;i--)
893  {
894    F[i]=module(matrix(0,mu,1));
895  }
896  for(i=mu;i>=1;i--)
897  {
898    v=H0[i];
899    v0=lead(v);
900    n0=leadcoef(e[leadexp(v0)[nvars(basering)+1]])+leadexp(v0)[1];
901    v=v-lead(v);
902    while(v!=0)
903    {
904      n=leadcoef(e[leadexp(v)[nvars(basering)+1]])+leadexp(v)[1];
905      if(n==n0)
906      {
907        v0=v0+lead(v);
908        v=v-lead(v);
909      }
910      else
911      {
912        v=0;
913      }
914    }
915    j=m[leadexp(v0)[nvars(basering)+1]];
916    F[j]=F[j]+v0;
917  }
918
919  dbprint(printlevel-voice+2,"// compute splitting of Hodge filtration");
920  matrix A0=jet(A,0);
921  module U,U0,U1,U2;
922  matrix N;
923  s=0;
924  for(i=size(F);i>=1;i--)
925  {
926    N=A0-e0[i];
927    U0=0;
928    while(size(F[i])>0)
929    {
930      U1=jet(F[i],0);
931      k=0;
932      while(size(U1)>0)
933      {
934        for(j=ncols(U1);j>=1;j--)
935        {
936          if(size(reduce(U1[j],std(U0)))>0)
937          {
938            U0=U0+U1[j];
939          }
940        }
941        U1=N*U1;
942        k++;
943      }
944      F[i]=module(F[i]/var(1));
945    }
946    U=U0+U;
947  }
948
949  dbprint(printlevel-voice+2,"// transform to Hodge splitting basis");
950  H=H*U;
951  H0=lift(U,H0);
952  A=lift(U,A*U);
953
954  return(e,A,H,H0);
955}
956///////////////////////////////////////////////////////////////////////////////
957
958static proc glift(ideal e,matrix A,module H,module H0,int K)
959{
960  poly s=var(1);
961  int mu=ncols(gmsbasis);
962
963  dbprint(printlevel-voice+2,"// compute standard basis of H''");
964  H0=std(H0);
965  H0=simplify(H0,1);
966
967  int i,j,k;
968  ideal v;
969  for(i=mu;i>=1;i--)
970  {
971    v[i]=e[leadexp(H0[i])[nvars(basering)+1]]+leadexp(H0[i])[1];
972  }
973
974  dbprint(printlevel-voice+2,
975    "// compute matrix A0 of t w.r.t. good basis H0 of H''");
976  number c;
977  matrix h0[mu][1];
978  matrix m[mu][1];
979  matrix a0[mu][1];
980  matrix A0[mu][mu];
981  module M=H0;
982  module N=jet(s*A*matrix(H0)+s^2*diff(matrix(H0),s),K+1);
983  while(size(N)>0)
984  {
985    j=mu;
986    for(k=mu-1;k>=1;k--)
987    {
988      if(N[k]>N[j])
989      {
990        j=k;
991      }
992    }
993    i=mu;
994    while(leadexp(M[i])[nvars(basering)+1]!=leadexp(N[j])[nvars(basering)+1])
995    {
996      i--;
997    }
998    k=leadexp(N[j])[1]-leadexp(M[i])[1];
999    if(k==0||i==j)
1000    {
1001      dbprint(printlevel-voice+3,"// compute A0["+string(i)+","+string(j)+"]");
1002      c=leadcoef(N[j])/leadcoef(M[i]);
1003      A0[i,j]=A0[i,j]+c*s^k;
1004      N[j]=jet(N[j]-c*s^k*M[i],K+1);
1005    }
1006    else
1007    {
1008      dbprint(printlevel-voice+3,
1009        "// reduce H0["+string(j)+"] with H0["+string(i)+"]");
1010      c=leadcoef(N[j])/leadcoef(M[i])/(1-k-leadcoef(v[i])+leadcoef(v[j]));
1011      H0[j]=H0[j]+c*s^(k-1)*H0[i];
1012      M[j]=M[j]+c*s^(k-1)*M[i];
1013      h0=c*s^(k-1)*H0[i];
1014      N[j]=N[j]+jet(s*A*h0+s^2*diff(h0,s),K+1)[1];
1015      m=M[i];
1016      a0=transpose(A0)[j];
1017      N=N-jet(c*s^(k-1)*m*transpose(a0),K+1);
1018    }
1019  }
1020
1021  H0=H*H0;
1022  H0=H0/var(1)^(mindegree(H0)/deg(var(1)));
1023
1024  return(A0,H0);
1025}
1026///////////////////////////////////////////////////////////////////////////////
1027
1028proc tmatrix(poly t)
1029"USAGE:    tmatrix(t); poly t
1030ASSUME:   characteristic 0; local degree ordering;
1031          isolated critical point 0 of t
1032RETURN:
1033@format
1034list l=A0,A1,T,M;
1035  matrix A0,A1;  t=A0+s*A1+s^2*(d/ds) on H'' w.r.t. C[[s]]-basis M*T
1036  module T;  C-basis of C^mu
1037  ideal M;  monomial C-basis of H''/sH''
1038@end format
1039KEYWORDS: singularities; Gauss-Manin system; Brieskorn lattice;
1040          mixed Hodge structure; V-filtration; weight filtration;
1041          monodromy; spectrum; spectral pairs; good basis
1042EXAMPLE:  example tmatrix; shows examples
1043"
1044{
1045  def @R=basering;
1046  int n=nvars(@R)-1;
1047  def @G=gmsring(t,"s");
1048  setring(@G);
1049
1050  int mu=ncols(gmsbasis);
1051  matrix A;
1052  module U0;
1053  ideal e;
1054  intvec m;
1055
1056  def A0,r,H,H0,K0=saturate();
1057  e,m,A0,r=eigenval(A0,r,H,K0);
1058  A,A0,r,H,H0,e,m,K0=transform(A,A0,r,H,H0,e,m,K0,K0+int(e[ncols(e)]-e[1]),1);
1059  A,H0=glift(fsplit(e,m,A,H,H0),K0);
1060
1061  A0=jet(A,0);
1062  A=jet(A/var(1),0);
1063
1064  list l=A0,A,H0,gmsbasis;
1065  setring(@R);
1066  list l=imap(@G,l);
1067  kill @G,gmsmaxdeg;
1068
1069  return(l);
1070}
1071example
1072{ "EXAMPLE:"; echo=2;
1073  ring R=0,(x,y),ds;
1074  poly t=x5+x2y2+y5;
1075  list l=tmatrix(t);
1076  print(l[1]);
1077  print(l[2]);
1078  print(l[3]);
1079  print(l[4]);
1080}
1081///////////////////////////////////////////////////////////////////////////////
1082
1083proc endvfilt(list v)
1084"USAGE:   endvfilt(v); list v
1085ASSUME:  v returned by vfilt
1086RETURN:
1087@format
1088list ev;  V-filtration on Jacobian algebra
1089  ideal ev[1];
1090    number ev[1][i];  i-th V-filtration index
1091  intvec ev[2];
1092    int ev[2][i];  i-th multiplicity
1093  list ev[3];
1094    module ev[3][i];  vector space of i-th graded part in terms of ev[4]
1095  ideal ev[4];  monomial vector space basis of Jacobian algebra
1096  ideal ev[5];  standard basis of Jacobian ideal
1097@end format
1098KEYWORDS: singularities; Gauss-Manin system; Brieskorn lattice;
1099          mixed Hodge structure; V-filtration; endomorphism filtration
1100EXAMPLE:  example endvfilt; shows examples
1101"
1102{
1103  def a,d,V,m,g=v[1..5];
1104  attrib(g,"isSB",1);
1105  int mu=ncols(m);
1106
1107  module V0=V[1];
1108  for(int i=2;i<=size(V);i++)
1109  {
1110    V0=V0,V[i];
1111  }
1112
1113  dbprint(printlevel-voice+2,"// compute multiplication in Jacobian algebra");
1114  list M;
1115  module U=freemodule(ncols(m));
1116  for(i=ncols(m);i>=1;i--)
1117  {
1118    M[i]=division(coeffs(reduce(m[i]*m,g,U),m)*V0,V0)[1];
1119  }
1120
1121  int j,k,i0,j0,i1,j1;
1122  number b0=number(a[1]-a[ncols(a)]);
1123  number b1,b2;
1124  matrix M0;
1125  module L;
1126  list v0=freemodule(ncols(m));
1127  ideal a0=b0;
1128  list l;
1129
1130  while(b0<number(a[ncols(a)]-a[1]))
1131  {
1132    dbprint(printlevel-voice+2,"// find next possible index");
1133    b1=number(a[ncols(a)]-a[1]);
1134    for(j=ncols(a);j>=1;j--)
1135    {
1136      for(i=ncols(a);i>=1;i--)
1137      {
1138        b2=number(a[i]-a[j]);
1139        if(b2>b0&&b2<b1)
1140        {
1141          b1=b2;
1142        }
1143        else
1144        {
1145          if(b2<=b0)
1146          {
1147            i=0;
1148          }
1149        }
1150      }
1151    }
1152    b0=b1;
1153
1154    l=ideal();
1155    for(k=ncols(m);k>=2;k--)
1156    {
1157      l=l+list(ideal());
1158    }
1159
1160    dbprint(printlevel-voice+2,"// collect conditions for EV["+string(b0)+"]");
1161    j=ncols(a);
1162    j0=mu;
1163    while(j>=1)
1164    {
1165      i0=1;
1166      i=1;
1167      while(i<ncols(a)&&a[i]<a[j]+b0)
1168      {
1169        i0=i0+d[i];
1170        i++;
1171      }
1172      if(a[i]<a[j]+b0)
1173      {
1174        i0=i0+d[i];
1175        i++;
1176      }
1177      for(k=1;k<=ncols(m);k++)
1178      {
1179        M0=M[k];
1180        if(i0>1)
1181        {
1182          l[k]=l[k],M0[1..i0-1,j0-d[j]+1..j0];
1183        }
1184      }
1185      j0=j0-d[j];
1186      j--;
1187    }
1188
1189    dbprint(printlevel-voice+2,"// compose condition matrix");
1190    L=transpose(module(l[1]));
1191    for(k=2;k<=ncols(m);k++)
1192    {
1193      L=L,transpose(module(l[k]));
1194    }
1195
1196    dbprint(printlevel-voice+2,"// compute kernel of condition matrix");
1197    v0=v0+list(syz(L));
1198    a0=a0,b0;
1199  }
1200
1201  dbprint(printlevel-voice+2,"// compute graded parts");
1202  option(redSB);
1203  for(i=1;i<size(v0);i++)
1204  {
1205    v0[i+1]=std(v0[i+1]);
1206    v0[i]=std(reduce(v0[i],v0[i+1]));
1207  }
1208  option(noredSB);
1209
1210  dbprint(printlevel-voice+2,"// remove trivial graded parts");
1211  i=1;
1212  while(size(v0[i])==0)
1213  {
1214    i++;
1215  }
1216  list v1=v0[i];
1217  intvec d1=size(v0[i]);
1218  ideal a1=a0[i];
1219  i++;
1220  while(i<=size(v0))
1221  {
1222    if(size(v0[i])>0)
1223    {
1224      v1=v1+list(v0[i]);
1225      d1=d1,size(v0[i]);
1226      a1=a1,a0[i];
1227    }
1228    i++;
1229  }
1230  return(list(a1,d1,v1,m,g));
1231}
1232example
1233{ "EXAMPLE:"; echo=2;
1234  ring R=0,(x,y),ds;
1235  poly t=x5+x2y2+y5;
1236  endvfilt(vfilt(t));
1237}
1238///////////////////////////////////////////////////////////////////////////////
1239
1240proc sppnf(list sp)
1241"USAGE:   sppnf(list(a,w[,m])); ideal a, intvec w, intvec m
1242ASSUME:  ncols(e)==size(w)==size(m)
1243RETURN:  order (a[i][,w[i]]) with multiplicity m[i] lexicographically
1244EXAMPLE: example sppnf; shows examples
1245"
1246{
1247  ideal a=sp[1];
1248  intvec w=sp[2];
1249  int n=ncols(a);
1250  intvec m;
1251  list V;
1252  module v;
1253  int i,j;
1254  for(i=3;i<=size(sp);i++)
1255  {
1256    if(typeof(sp[i])=="intvec")
1257    {
1258      m=sp[i];
1259    }
1260    if(typeof(sp[i])=="module")
1261    {
1262      v=sp[i];
1263      for(j=n;j>=1;j--)
1264      {
1265        V[j]=module(v[j]);
1266      }
1267    }
1268    if(typeof(sp[i])=="list")
1269    {
1270      V=sp[i];
1271    }
1272  }
1273  if(m==0)
1274  {
1275    for(i=n;i>=1;i--)
1276    {
1277      m[i]=1;
1278    }
1279  }
1280
1281  int k;
1282  ideal a0;
1283  intvec w0,m0;
1284  list V0;
1285  number a1;
1286  int w1,m1;
1287  for(i=n;i>=1;i--)
1288  {
1289    if(m[i]!=0)
1290    {
1291      for(j=i-1;j>=1;j--)
1292      {
1293        if(m[j]!=0)
1294        {
1295          if(number(a[i])>number(a[j])||
1296            (number(a[i])==number(a[j])&&w[i]<w[j]))
1297          {
1298            a1=number(a[i]);
1299            a[i]=a[j];
1300            a[j]=a1;
1301            w1=w[i];
1302            w[i]=w[j];
1303            w[j]=w1;
1304            m1=m[i];
1305            m[i]=m[j];
1306            m[j]=m1;
1307            if(size(V)>0)
1308            {
1309              v=V[i];
1310              V[i]=V[j];
1311              V[j]=v;
1312            }
1313          }
1314          if(number(a[i])==number(a[j])&&w[i]==w[j])
1315          {
1316            m[i]=m[i]+m[j];
1317            m[j]=0;
1318            if(size(V)>0)
1319            {
1320              V[i]=V[i]+V[j];
1321            }
1322          }
1323        }
1324      }
1325      k++;
1326      a0[k]=a[i];
1327      w0[k]=w[i];
1328      m0[k]=m[i];
1329      if(size(V)>0)
1330      {
1331        V0[k]=V[i];
1332      }
1333    }
1334  }
1335
1336  if(size(V0)>0)
1337  {
1338    n=size(V0);
1339    module U=std(V0[n]);
1340    for(i=n-1;i>=1;i--)
1341    {
1342      V0[i]=simplify(reduce(V0[i],U),1);
1343      if(i>=2)
1344      {
1345        U=std(U+V0[i]);
1346      }
1347    }
1348  }
1349
1350  if(k>0)
1351  {
1352    sp=a0,w0,m0;
1353    if(size(V0)>0)
1354    {
1355      sp[4]=V0;
1356    }
1357  }
1358  return(sp);
1359}
1360example
1361{ "EXAMPLE:"; echo=2;
1362  ring R=0,(x,y),ds;
1363  list sp=list(ideal(-1/2,-3/10,-3/10,-1/10,-1/10,0,1/10,1/10,3/10,3/10,1/2),
1364    intvec(2,1,1,1,1,1,1,1,1,1,0));
1365  sppprint(sppnf(sp));
1366}
1367///////////////////////////////////////////////////////////////////////////////
1368
1369proc sppprint(list spp)
1370"USAGE:   sppprint(spp); list spp
1371RETURN:  string s;  spectral pairs spp
1372EXAMPLE: example sppprint; shows examples
1373"
1374{
1375  string s;
1376  for(int i=1;i<size(spp[3]);i++)
1377  {
1378    s=s+"(("+string(spp[1][i])+","+string(spp[2][i])+"),"
1379      +string(spp[3][i])+"),";
1380  }
1381  s=s+"(("+string(spp[1][i])+","+string(spp[2][i])+"),"+string(spp[3][i])+")";
1382  return(s);
1383}
1384example
1385{ "EXAMPLE:"; echo=2;
1386  ring R=0,(x,y),ds;
1387  list spp=list(ideal(-1/2,-3/10,-1/10,0,1/10,3/10,1/2),intvec(2,1,1,1,1,1,0),
1388    intvec(1,2,2,1,2,2,1));
1389  sppprint(spp);
1390}
1391///////////////////////////////////////////////////////////////////////////////
1392
1393proc spadd(list sp1,list sp2)
1394"USAGE:   spadd(sp1,sp2); list sp1, list sp2
1395RETURN:  list sp;  sum of spectra sp1 and sp2
1396EXAMPLE: example spadd; shows examples
1397"
1398{
1399  ideal s;
1400  intvec m;
1401  int i,i1,i2=1,1,1;
1402  while(i1<=size(sp1[2])||i2<=size(sp2[2]))
1403  {
1404    if(i1<=size(sp1[2]))
1405    {
1406      if(i2<=size(sp2[2]))
1407      {
1408        if(number(sp1[1][i1])<number(sp2[1][i2]))
1409        {
1410          s[i]=sp1[1][i1];
1411          m[i]=sp1[2][i1];
1412          i++;
1413          i1++;
1414        }
1415        else
1416        {
1417          if(number(sp1[1][i1])>number(sp2[1][i2]))
1418          {
1419            s[i]=sp2[1][i2];
1420            m[i]=sp2[2][i2];
1421            i++;
1422            i2++;
1423          }
1424          else
1425          {
1426            if(sp1[2][i1]+sp2[2][i2]!=0)
1427            {
1428              s[i]=sp1[1][i1];
1429              m[i]=sp1[2][i1]+sp2[2][i2];
1430              i++;
1431            }
1432            i1++;
1433            i2++;
1434          }
1435        }
1436      }
1437      else
1438      {
1439        s[i]=sp1[1][i1];
1440        m[i]=sp1[2][i1];
1441        i++;
1442        i1++;
1443      }
1444    }
1445    else
1446    {
1447      s[i]=sp2[1][i2];
1448      m[i]=sp2[2][i2];
1449      i++;
1450      i2++;
1451    }
1452  }
1453  return(list(s,m));
1454}
1455example
1456{ "EXAMPLE:"; echo=2;
1457  ring R=0,(x,y),ds;
1458  list sp1=list(ideal(-1/2,-3/10,-1/10,0,1/10,3/10,1/2),intvec(1,2,2,1,2,2,1));
1459  spprint(sp1);
1460  list sp2=list(ideal(-1/6,1/6),intvec(1,1));
1461  spprint(sp2);
1462  spprint(spadd(sp1,sp2));
1463}
1464///////////////////////////////////////////////////////////////////////////////
1465
1466proc spsub(list sp1,list sp2)
1467"USAGE:   spsub(sp1,sp2); list sp1, list sp2
1468RETURN:  list sp;  difference of spectra sp1 and sp2
1469EXAMPLE: example spsub; shows examples
1470"
1471{
1472  return(spadd(sp1,spmul(sp2,-1)));
1473}
1474example
1475{ "EXAMPLE:"; echo=2;
1476  ring R=0,(x,y),ds;
1477  list sp1=list(ideal(-1/2,-3/10,-1/10,0,1/10,3/10,1/2),intvec(1,2,2,1,2,2,1));
1478  spprint(sp1);
1479  list sp2=list(ideal(-1/6,1/6),intvec(1,1));
1480  spprint(sp2);
1481  spprint(spsub(sp1,sp2));
1482}
1483///////////////////////////////////////////////////////////////////////////////
1484
1485proc spmul(list #)
1486"USAGE:   spmul(sp0,k); list sp0, int[vec] k
1487RETURN:  list sp;  linear combination of spectra sp0 with coefficients k
1488EXAMPLE: example spmul; shows examples
1489"
1490{
1491  if(size(#)==2)
1492  {
1493    if(typeof(#[1])=="list")
1494    {
1495      if(typeof(#[2])=="int")
1496      {
1497        return(list(#[1][1],#[1][2]*#[2]));
1498      }
1499      if(typeof(#[2])=="intvec")
1500      {
1501        list sp0=list(ideal(),intvec(0));
1502        for(int i=size(#[2]);i>=1;i--)
1503        {
1504          sp0=spadd(sp0,spmul(#[1][i],#[2][i]));
1505        }
1506        return(sp0);
1507      }
1508    }
1509  }
1510  return(list(ideal(),intvec(0)));
1511}
1512example
1513{ "EXAMPLE:"; echo=2;
1514  ring R=0,(x,y),ds;
1515  list sp=list(ideal(-1/2,-3/10,-1/10,0,1/10,3/10,1/2),intvec(1,2,2,1,2,2,1));
1516  spprint(sp);
1517  spprint(spmul(sp,2));
1518  list sp1=list(ideal(-1/6,1/6),intvec(1,1));
1519  spprint(sp1);
1520  list sp2=list(ideal(-1/3,0,1/3),intvec(1,2,1));
1521  spprint(sp2);
1522  spprint(spmul(list(sp1,sp2),intvec(1,2)));
1523}
1524///////////////////////////////////////////////////////////////////////////////
1525
1526proc spissemicont(list sp,list #)
1527"USAGE:   spissemicont(sp[,1]); list sp, int opt
1528RETURN:
1529@format
1530int k=
1531  1;  if sum of sp is positive on all intervals [a,a+1) [and (a,a+1)]
1532  0;  if sum of sp is negative on some interval [a,a+1) [or (a,a+1)]
1533@end format
1534EXAMPLE: example spissemicont; shows examples
1535"
1536{
1537  int opt=0;
1538  if(size(#)>0)
1539  {
1540    if(typeof(#[1])=="int")
1541    {
1542      opt=1;
1543    }
1544  }
1545  int i,j,k;
1546  i=1;
1547  while(i<=size(sp[2])-1)
1548  {
1549    j=i+1;
1550    k=0;
1551    while(j+1<=size(sp[2])&&number(sp[1][j])<=number(sp[1][i])+1)
1552    {
1553      if(opt==0||number(sp[1][j])<number(sp[1][i])+1)
1554      {
1555        k=k+sp[2][j];
1556      }
1557      j++;
1558    }
1559    if(j==size(sp[2])&&number(sp[1][j])<=number(sp[1][i])+1)
1560    {
1561      if(opt==0||number(sp[1][j])<number(sp[1][i])+1)
1562      {
1563        k=k+sp[2][j];
1564      }
1565    }
1566    if(k<0)
1567    {
1568      return(0);
1569    }
1570    i++;
1571  }
1572  return(1);
1573}
1574example
1575{ "EXAMPLE:"; echo=2;
1576  ring R=0,(x,y),ds;
1577  list sp1=list(ideal(-1/2,-3/10,-1/10,0,1/10,3/10,1/2),intvec(1,2,2,1,2,2,1));
1578  spprint(sp1);
1579  list sp2=list(ideal(-1/6,1/6),intvec(1,1));
1580  spprint(sp2);
1581  spissemicont(spsub(sp1,spmul(sp2,3)));
1582  spissemicont(spsub(sp1,spmul(sp2,4)));
1583}
1584///////////////////////////////////////////////////////////////////////////////
1585
1586proc spsemicont(list sp0,list sp,list #)
1587"USAGE:   spsemicont(sp0,sp,k[,1]); list sp0, list sp
1588RETURN:
1589@format
1590list l;
1591  intvec l[i];  if the spectra sp0 occur with multiplicities k
1592                in a deformation of a [quasihomogeneous] singularity
1593                with spectrum sp then k<=l[i]
1594@end format
1595EXAMPLE: example spsemicont; shows examples
1596"
1597{
1598  list l,l0;
1599  int i,j,k;
1600  while(spissemicont(sp0,#))
1601  {
1602    if(size(sp)>1)
1603    {
1604      l0=spsemicont(sp0,list(sp[1..size(sp)-1]));
1605      for(i=1;i<=size(l0);i++)
1606      {
1607        if(size(l)>0)
1608        {
1609          j=1;
1610          while(j<size(l)&&l[j]!=l0[i])
1611          {
1612            j++;
1613          }
1614          if(l[j]==l0[i])
1615          {
1616            l[j][size(sp)]=k;
1617          }
1618          else
1619          {
1620            l0[i][size(sp)]=k;
1621            l=l+list(l0[i]);
1622          }
1623        }
1624        else
1625        {
1626          l=l0;
1627        }
1628      }
1629    }
1630    sp0=spsub(sp0,sp[size(sp)]);
1631    k++;
1632  }
1633  if(size(sp)>1)
1634  {
1635    return(l);
1636  }
1637  else
1638  {
1639    return(list(intvec(k-1)));
1640  }
1641}
1642example
1643{ "EXAMPLE:"; echo=2;
1644  ring R=0,(x,y),ds;
1645  list sp0=list(ideal(-1/2,-3/10,-1/10,0,1/10,3/10,1/2),intvec(1,2,2,1,2,2,1));
1646  spprint(sp0);
1647  list sp1=list(ideal(-1/6,1/6),intvec(1,1));
1648  spprint(sp1);
1649  list sp2=list(ideal(-1/3,0,1/3),intvec(1,2,1));
1650  spprint(sp2);
1651  list sp=sp1,sp2;
1652  list l=spsemicont(sp0,sp);
1653  l;
1654  spissemicont(spsub(sp0,spmul(sp,l[1])));
1655  spissemicont(spsub(sp0,spmul(sp,l[1]-1)));
1656  spissemicont(spsub(sp0,spmul(sp,l[1]+1)));
1657}
1658///////////////////////////////////////////////////////////////////////////////
1659
1660proc spmilnor(list sp)
1661"USAGE:   spmilnor(sp); list sp
1662RETURN:  int mu;  Milnor number of spectrum sp
1663EXAMPLE: example spmilnor; shows examples
1664"
1665{
1666  return(sum(sp[2]));
1667}
1668example
1669{ "EXAMPLE:"; echo=2;
1670  ring R=0,(x,y),ds;
1671  list sp=list(ideal(-1/2,-3/10,-1/10,0,1/10,3/10,1/2),intvec(1,2,2,1,2,2,1));
1672  spprint(sp);
1673  spmilnor(sp);
1674}
1675///////////////////////////////////////////////////////////////////////////////
1676
1677proc spgeomgenus(list sp)
1678"USAGE:   spgeomgenus(sp); list sp
1679RETURN:  int g;  geometrical genus of spectrum sp
1680EXAMPLE: example spgeomgenus; shows examples
1681"
1682{
1683  int g=0;
1684  int i=1;
1685  while(i+1<=size(sp[2])&&number(sp[1][i])<=number(0))
1686  {
1687    g=g+sp[2][i];
1688    i++;
1689  }
1690  if(i==size(sp[2])&&number(sp[1][i])<=number(0))
1691  {
1692    g=g+sp[2][i];
1693  }
1694  return(g);
1695}
1696example
1697{ "EXAMPLE:"; echo=2;
1698  ring R=0,(x,y),ds;
1699  list sp=list(ideal(-1/2,-3/10,-1/10,0,1/10,3/10,1/2),intvec(1,2,2,1,2,2,1));
1700  spprint(sp);
1701  spgeomgenus(sp);
1702}
1703///////////////////////////////////////////////////////////////////////////////
1704
1705proc spgamma(list sp)
1706"USAGE:   spgamma(sp); list sp
1707RETURN:  number gamma;  gamma invariant of spectrum sp
1708EXAMPLE: example spgamma; shows examples
1709"
1710{
1711  int i,j;
1712  number g=0;
1713  for(i=1;i<=ncols(sp[1]);i++)
1714  {
1715    for(j=1;j<=sp[2][i];j++)
1716    {
1717      g=g+(number(sp[1][i])-number(nvars(basering)-2)/2)^2;
1718    }
1719  }
1720  g=-g/4+sum(sp[2])*number(sp[1][ncols(sp[1])]-sp[1][1])/48;
1721  return(g);
1722}
1723example
1724{ "EXAMPLE:"; echo=2;
1725  ring R=0,(x,y),ds;
1726  list sp=list(ideal(-1/2,-3/10,-1/10,0,1/10,3/10,1/2),intvec(1,2,2,1,2,2,1));
1727  spprint(sp);
1728  spgamma(sp);
1729}
1730///////////////////////////////////////////////////////////////////////////////
Note: See TracBrowser for help on using the repository browser.