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

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