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

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