source: git/Singular/LIB/gaussman.lib @ d70bc7

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