source: git/Singular/LIB/gaussman.lib @ 549d8e

fieker-DuValspielwiese
Last change on this file since 549d8e was 341696, checked in by Hans Schönemann <hannes@…>, 15 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
RevLine 
[0c4bd7]1///////////////////////////////////////////////////////////////////////////////
[341696]2version="$Id$";
[fd3fb7]3category="Singularities";
[c52356d]4
[0c4bd7]5info="
[46af92]6LIBRARY:  gaussman.lib  Gauss-Manin System of Isolated Singularities
[0c4bd7]7
[61dadae]8AUTHOR:   Mathias Schulze, email: mschulze@mathematik.uni-kl.de
[0c4bd7]9
[2d3b6e6]10OVERVIEW: A library for the Gauss-Manin system
11          of an isolated hypersurface singularity
[cc3a04]12
[0c4bd7]13PROCEDURES:
[26a4bb]14 gmsring(t,s);              Gauss-Manin system of t with variable s
[91fc5e]15 gmsnf(p,K);                Gauss-Manin normal form of p
16 gmscoeffs(p,K);            Gauss-Manin basis representation of p
[779ee3]17 bernstein(t);              roots of the Bernstein polynomial of t
[91fc5e]18 monodromy(t);              Jordan data of complex monodromy of t
[275721f]19 spectrum(t);               singularity spectrum of t
[e480544]20 sppairs(t);                spectral pairs of t
[04c344]21 vfilt(t);                  V-filtration of t on Brieskorn lattice
22 vwfilt(t);                 weighted V-filtration of t on Brieskorn lattice
[5dfbc0]23 tmatrix(t);                C[[s]]-matrix of t on Brieskorn lattice
[64eab4]24 endvfilt(V);               endomorphism V-filtration on Jacobian algebra
[2d3b6e6]25 sppnf(a,w[,m]);            spectral pairs normal form of (a,w[,m])
[d70bc7]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
[275721f]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
[91fc5e]32 spmilnor(sp);              Milnor number of spectrum sp
[d70bc7]33 spgeomgenus(sp);           geometrical genus of spectrum sp
34 spgamma(sp);               gamma invariant of spectrum sp
[cc3a04]35
[b30162]36SEE ALSO: mondromy_lib, spectrum_lib
[8a87a6]37
[46af92]38KEYWORDS: singularities; Gauss-Manin system; Brieskorn lattice;
[d70bc7]39          mixed Hodge structure; V-filtration; weight filtration
[3c4dcc]40          Bernstein polynomial; monodromy; spectrum; spectral pairs;
[46af92]41          good basis;
[0c4bd7]42";
43
[e9124e]44LIB "linalg.lib";
[0c4bd7]45
46///////////////////////////////////////////////////////////////////////////////
47
[442ed6]48static proc stdtrans(ideal I)
49{
[500122]50  def R=basering;
[442ed6]51
[34a9eb1]52  string os=ordstr(R);
53  int j=find(os,",C");
[442ed6]54  if(j==0)
55  {
[34a9eb1]56    j=find(os,"C,");
[442ed6]57  }
58  if(j==0)
59  {
[34a9eb1]60    j=find(os,",c");
[442ed6]61  }
62  if(j==0)
63  {
[34a9eb1]64    j=find(os,"c,");
[442ed6]65  }
66  if(j>0)
67  {
[34a9eb1]68    os[j..j+1]="  ";
[442ed6]69  }
70
[34a9eb1]71  execute("ring S="+charstr(R)+",(gmspoly,"+varstr(R)+"),(c,dp,"+os+");");
[442ed6]72
[500122]73  ideal I=homog(imap(R,I),gmspoly);
[442ed6]74  module M=transpose(transpose(I)+freemodule(ncols(I)));
75  M=std(M);
76
[500122]77  setring(R);
[d341d0]78  execute("map h=S,1,"+varstr(R)+";");
[442ed6]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
[500122]109proc gmsring(poly t,string s)
[275721f]110"USAGE:    gmsring(t,s); poly t, string s
111ASSUME:   characteristic 0; local degree ordering;
[a8cc0a]112          isolated critical point 0 of t
[e3f423]113RETURN:
114@format
[26a4bb]115ring G;  Gauss-Manin system of t with variable s
[275721f]116  poly gmspoly=t;
117  ideal gmsjacob;  Jacobian ideal of t
118  ideal gmsstd;  standard basis of Jacobian ideal
[04c344]119  matrix gmsmatrix;  matrix(gmsjacob)*gmsmatrix==matrix(gmsstd)
[275721f]120  ideal gmsbasis;  monomial vector space basis of Jacobian algebra
[9526639]121  int gmsmaxdeg;  maximal weight of variables
[e3f423]122@end format
[5dfbc0]123NOTE:     gmsbasis is a C[[s]]-basis of H'' and [t,s]=s^2
[46af92]124KEYWORDS: singularities; Gauss-Manin system; Brieskorn lattice
[275721f]125EXAMPLE:  example gmsring; shows examples
[e3f423]126"
[04b295]127{
[500122]128  def R=basering;
129  if(charstr(R)!="0")
[04b295]130  {
131    ERROR("characteristic 0 expected");
132  }
[500122]133  for(int i=nvars(R);i>=1;i--)
[04b295]134  {
135    if(var(i)>1)
136    {
137      ERROR("local ordering expected");
138    }
139  }
140
141  ideal dt=jacob(t);
[442ed6]142  list l=stdtrans(dt);
143  ideal g=l[1];
[04b295]144  if(vdim(g)<=0)
145  {
146    if(vdim(g)==0)
147    {
148      ERROR("singularity at 0 expected");
149    }
150    else
151    {
[a8cc0a]152      ERROR("isolated critical point 0 expected");
[04b295]153    }
[e9124e]154  }
[9526639]155  matrix B=l[2];
[04b295]156  ideal m=kbase(g);
157
[9526639]158  int gmsmaxdeg;
[500122]159  for(i=nvars(R);i>=1;i--)
160  {
[9526639]161    if(deg(var(i))>gmsmaxdeg)
[500122]162    {
[9526639]163      gmsmaxdeg=deg(var(i));
[500122]164    }
165  }
166
[34a9eb1]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
[d341d0]186  execute("ring G="+string(charstr(R))+",("+s+","+varstr(R)+"),(ws("+
[9526639]187    string(deg(highcorner(g))+2*gmsmaxdeg)+"),"+os+",c);");
[04b295]188
[500122]189  poly gmspoly=imap(R,t);
190  ideal gmsjacob=imap(R,dt);
191  ideal gmsstd=imap(R,g);
[9526639]192  matrix gmsmatrix=imap(R,B);
[500122]193  ideal gmsbasis=imap(R,m);
[04b295]194
[500122]195  attrib(gmsstd,"isSB",1);
[9526639]196  export gmspoly,gmsjacob,gmsstd,gmsmatrix,gmsbasis,gmsmaxdeg;
[04b295]197
[500122]198  return(G);
[e3f423]199}
200example
201{ "EXAMPLE:"; echo=2;
202  ring R=0,(x,y),ds;
[86c1f0]203  poly t=x5+x2y2+y5;
204  def G=gmsring(t,"s");
[e3f423]205  setring(G);
[500122]206  gmspoly;
207  print(gmsjacob);
208  print(gmsstd);
209  print(gmsmatrix);
[86c1f0]210  print(gmsbasis);
[9526639]211  gmsmaxdeg;
[04b295]212}
213///////////////////////////////////////////////////////////////////////////////
214
[38c0dca]215proc gmsnf(ideal p,int K)
216"USAGE:    gmsnf(p,K); poly p, int K
217ASSUME:   basering returned by gmsring
[e3f423]218RETURN:
219@format
[e9124e]220list nf;
[74d9b7]221  ideal nf[1];  projection of p to <gmsbasis>C[[s]] mod s^(K+1)
[91fc5e]222  ideal nf[2];  p==nf[1]+nf[2]
[e3f423]223@end format
[91fc5e]224NOTE:     computation can be continued by setting p=nf[2]
[46af92]225KEYWORDS: singularities; Gauss-Manin system; Brieskorn lattice
[e3f423]226EXAMPLE:  example gmsnf; shows examples
227"
[04b295]228{
[e9124e]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));
[e3f423]279}
280example
281{ "EXAMPLE:"; echo=2;
282  ring R=0,(x,y),ds;
[86c1f0]283  poly t=x5+x2y2+y5;
284  def G=gmsring(t,"s");
[e3f423]285  setring(G);
[500122]286  list l0=gmsnf(gmspoly,0);
[e3f423]287  print(l0[1]);
[500122]288  list l1=gmsnf(gmspoly,1);
[e3f423]289  print(l1[1]);
290  list l=gmsnf(l0[2],1);
291  print(l[1]);
[04b295]292}
293///////////////////////////////////////////////////////////////////////////////
294
[38c0dca]295proc gmscoeffs(ideal p,int K)
296"USAGE:    gmscoeffs(p,K); poly p, int K
297ASSUME:   basering constructed by gmsring
[e3f423]298RETURN:
299@format
[e9124e]300list l;
[5dfbc0]301  matrix l[1];  C[[s]]-basis representation of p mod s^(K+1)
[91fc5e]302  ideal l[2];  p==matrix(gmsbasis)*l[1]+l[2]
[e3f423]303@end format
[91fc5e]304NOTE:     computation can be continued by setting p=l[2]
[46af92]305KEYWORDS: singularities; Gauss-Manin system; Brieskorn lattice
[e3f423]306EXAMPLE:  example gmscoeffs; shows examples
307"
[04b295]308{
[38c0dca]309  list l=gmsnf(p,K);
[e3f423]310  ideal r,q=l[1..2];
[04b295]311  poly v=1;
312  for(int i=2;i<=nvars(basering);i++)
313  {
314    v=v*var(i);
315  }
[500122]316  matrix C=coeffs(r,gmsbasis,v);
[04b295]317  return(C,q);
318}
[e3f423]319example
320{ "EXAMPLE:"; echo=2;
321  ring R=0,(x,y),ds;
[86c1f0]322  poly t=x5+x2y2+y5;
323  def G=gmsring(t,"s");
[e3f423]324  setring(G);
[500122]325  list l0=gmscoeffs(gmspoly,0);
[e3f423]326  print(l0[1]);
[500122]327  list l1=gmscoeffs(gmspoly,1);
[e3f423]328  print(l1[1]);
329  list l=gmscoeffs(l0[2],1);
330  print(l[1]);
331}
[04b295]332///////////////////////////////////////////////////////////////////////////////
333
[e9124e]334static proc nmin(ideal e)
[0c4bd7]335{
[0ff6b5]336  int i;
337  number m=number(e[1]);
338  for(i=2;i<=ncols(e);i++)
[0c4bd7]339  {
[0ff6b5]340    if(number(e[i])<m)
[0c4bd7]341    {
[0ff6b5]342      m=number(e[i]);
[0c4bd7]343    }
344  }
[0ff6b5]345  return(m);
[0c4bd7]346}
347///////////////////////////////////////////////////////////////////////////////
348
[e9124e]349static proc nmax(ideal e)
[0c4bd7]350{
[0ff6b5]351  int i;
352  number m=number(e[1]);
353  for(i=2;i<=ncols(e);i++)
[8960ec]354  {
[0ff6b5]355    if(number(e[i])>m)
[8960ec]356    {
[0ff6b5]357      m=number(e[i]);
[0c4bd7]358    }
359  }
[0ff6b5]360  return(m);
361}
362///////////////////////////////////////////////////////////////////////////////
[8960ec]363
[2ca72f]364static proc saturate()
[0ff6b5]365{
[86c1f0]366  int mu=ncols(gmsbasis);
[34a9eb1]367  ideal r=gmspoly*gmsbasis;
368  matrix A0[mu][mu],C;
[0c4bd7]369  module H0;
[0ff6b5]370  module H,H1=freemodule(mu),freemodule(mu);
[0c4bd7]371  int k=-1;
[0ff6b5]372  list l;
373
[7b55a0]374  dbprint(printlevel-voice+2,"// compute saturation of H''");
[4f364b]375  while(size(reduce(H,std(H0*var(1))))>0)
[0c4bd7]376  {
[0ff6b5]377    dbprint(printlevel-voice+2,"// compute matrix A of t");
[0c4bd7]378    k++;
[1418c4]379    dbprint(printlevel-voice+2,"// k="+string(k));
[38c0dca]380    l=gmscoeffs(r,k);
[34a9eb1]381    C,r=l[1..2];
[04b295]382    A0=A0+C;
[12c3e5]383
[7b55a0]384    dbprint(printlevel-voice+2,"// compute saturation step");
[04b295]385    H0=H;
[4f364b]386    H1=jet(module(A0*H1+var(1)^2*diff(matrix(H1),var(1))),k);
387    H=H*var(1)+H1;
[04b295]388  }
389
[4f364b]390  A0=A0-k*var(1);
[1418c4]391  dbprint(printlevel-voice+2,"// compute basis of saturation of H''");
[34a9eb1]392  H=std(H0);
[0ff6b5]393
394  dbprint(printlevel-voice+2,"// transform H'' to saturation of H''");
[4f364b]395  H0=division(freemodule(mu)*var(1)^k,H,k*deg(var(1)))[1];
[0ff6b5]396
[61549b]397  return(A0,r,H,H0,k);
[0ff6b5]398}
399///////////////////////////////////////////////////////////////////////////////
400
[e9124e]401static proc tjet(matrix A0,ideal r,module H,int k0,int K)
[0ff6b5]402{
[1418c4]403  dbprint(printlevel-voice+2,"// compute matrix A of t");
[61549b]404  dbprint(printlevel-voice+2,"// k="+string(K+k0+1));
[38c0dca]405  list l=gmscoeffs(r,K+k0+1);
[0ff6b5]406  matrix C;
[34a9eb1]407  C,r=l[1..2];
[04b295]408  A0=A0+C;
[1418c4]409  dbprint(printlevel-voice+2,"// transform A to saturation of H''");
[4f364b]410  matrix A=division(A0*H+var(1)^2*diff(matrix(H),var(1)),H,
411    (K+1)*deg(var(1)))[1]/var(1);
[0ff6b5]412  return(A,A0,r);
413}
414///////////////////////////////////////////////////////////////////////////////
[04b295]415
[e9124e]416static proc eigenval(matrix A0,ideal r,module H,int k0)
[0ff6b5]417{
[04b295]418  dbprint(printlevel-voice+2,
[7b55a0]419    "// compute eigenvalues e with multiplicities m of A1");
[0ff6b5]420  matrix A;
[e9124e]421  A,A0,r=tjet(A0,r,H,k0,0);
[275721f]422  list l=eigenvals(A);
[1418c4]423  def e,m=l[1..2];
424  dbprint(printlevel-voice+2,"// e="+string(e));
425  dbprint(printlevel-voice+2,"// m="+string(m));
[2ca72f]426  return(e,m,A0,r);
[0ff6b5]427}
428///////////////////////////////////////////////////////////////////////////////
[1418c4]429
[4f364b]430static proc transform(matrix A,matrix A0,ideal r,module H,module H0,ideal e,
431  intvec m,int k0,int K,int opt)
[0ff6b5]432{
[61549b]433  int mu=ncols(gmsbasis);
434
[e9124e]435  number e0,e1=nmin(e),nmax(e);
[2ca72f]436
437  int i,j,k;
438  intvec d;
439  d[ncols(e)]=0;
440  if(opt)
441  {
442    dbprint(printlevel-voice+2,
[7b55a0]443      "// compute rounded maximal differences d of e");
[2ca72f]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    {
[97403d]455      for(j=i+1;j<=ncols(e);j++)
[2ca72f]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
[7b55a0]482  A,A0,r=tjet(A0,r,H,k0,K+k);
[4f364b]483  module U0=var(1)^k0*freemodule(mu);
[0ff6b5]484
[2ca72f]485  if(k>0)
[0c4bd7]486  {
[2ca72f]487    int i0,j0,i1,j1;
[0ff6b5]488    module U,V;
[e480544]489    list l;
[0c4bd7]490
[2ca72f]491    while(k>0)
[0c4bd7]492    {
[0ff6b5]493      dbprint(printlevel-voice+2,"// transform to separate eigenvalues");
[34a9eb1]494      U=0;
[ccf8d9]495      for(i=1;i<=ncols(e);i++)
[0c4bd7]496      {
[ccf8d9]497        U=U+syz(power(jet(A,0)-e[i],m[i]));
[34a9eb1]498      }
[0ff6b5]499      V=inverse(U);
500      A=V*A*U;
501      H0=V*H0;
[61549b]502      U0=U0*U;
[34a9eb1]503
[2ca72f]504      dbprint(printlevel-voice+2,
[7b55a0]505        "// transform to reduce maximum of d by 1");
[0ff6b5]506      for(i0,i=1,1;i0<=ncols(e);i0++)
[34a9eb1]507      {
[0ff6b5]508        for(i1=1;i1<=m[i0];i1,i=i1+1,i+1)
[0c4bd7]509        {
[0ff6b5]510          for(j0,j=1,1;j0<=ncols(e);j0++)
[0c4bd7]511          {
[0ff6b5]512            for(j1=1;j1<=m[j0];j1,j=j1+1,j+1)
[34a9eb1]513            {
[2ca72f]514              if(d[i0]==0&&d[j0]>0)
[0ff6b5]515              {
[4f364b]516                A[i,j]=A[i,j]/var(1);
[0ff6b5]517              }
[2ca72f]518              if(d[i0]>0&&d[j0]==0)
[0ff6b5]519              {
[4f364b]520                A[i,j]=A[i,j]*var(1);
[0ff6b5]521              }
[34a9eb1]522            }
[3c4dcc]523          }
[0c4bd7]524        }
525      }
[0ff6b5]526
527      H0=transpose(H0);
528      for(i0,i=1,1;i0<=ncols(e);i0++)
[6ab855]529      {
[2ca72f]530        if(d[i0]>0)
[34a9eb1]531        {
[0ff6b5]532          for(i1=1;i1<=m[i0];i1,i=i1+1,i+1)
533          {
534            A[i,i]=A[i,i]-1;
[4f364b]535            H0[i]=H0[i]*var(1);
536            U0[i]=U0[i]/var(1);
[0ff6b5]537          }
538          e[i0]=e[i0]-1;
[2ca72f]539          d[i0]=d[i0]-1;
[34a9eb1]540        }
[ccf8d9]541        else
542        {
543          i=i+m[i0];
544        }
[6ab855]545      }
[0ff6b5]546      H0=transpose(H0);
[1418c4]547
[2d3b6e6]548      l=sppnf(list(e,d,m));
[2ca72f]549      e,d,m=l[1..3];
[e480544]550
[2ca72f]551      k--;
[6ab855]552    }
[34a9eb1]553
[0ff6b5]554    A=jet(A,K);
[0c4bd7]555  }
556
[61549b]557  return(A,A0,r,H0,U0,e,m);
[0ff6b5]558}
559///////////////////////////////////////////////////////////////////////////////
560
[779ee3]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
[3c4dcc]567KEYWORDS: singularities; Gauss-Manin system; Brieskorn lattice;
[779ee3]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();
[b5fcae]583  A,A0,r=tjet(A0,r,H,k0,0);
584  list l=minipoly(A);
585  e,m=l[1..2];
[779ee3]586
[b5fcae]587  for(int i=1;i<=ncols(e);i++)
[744dd08]588  {
[b5fcae]589    e[i]=-e[i];
590    if(e[i]==-1)
[744dd08]591    {
[b5fcae]592      m[i]=m[i]+1;
[744dd08]593    }
594  }
595
[779ee3]596  setring(R);
[b5fcae]597  ideal e=imap(G,e);
[779ee3]598  kill G,gmsmaxdeg;
599
[b5fcae]600  return(list(e,m));
[779ee3]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
[275721f]610proc monodromy(poly t)
[0ff6b5]611"USAGE:    monodromy(t); poly t
[275721f]612ASSUME:   characteristic 0; local degree ordering;
[a8cc0a]613          isolated critical point 0 of t
[e9124e]614RETURN:
615@format
[26a4bb]616list l;  Jordan data jordan(M) of monodromy matrix exp(-2*pi*i*M)
[3c4dcc]617  ideal l[1];
[e9124e]618    number l[1][i];  eigenvalue of i-th Jordan block of M
[3c4dcc]619  intvec l[2];
[e9124e]620    int l[2][i];  size of i-th Jordan block of M
[3c4dcc]621  intvec l[3];
[e9124e]622    int l[3][i];  multiplicity of i-th Jordan block of M
623@end format
624SEE ALSO: mondromy_lib, linalg_lib
[46af92]625KEYWORDS: singularities; Gauss-Manin system; Brieskorn lattice; monodromy
[0ff6b5]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;
[61549b]635  module U0;
[0ff6b5]636  ideal e;
637  intvec m;
638
[2ca72f]639  def A0,r,H,H0,k0=saturate();
[e9124e]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);
[0ff6b5]642
[51534b6]643  list l=jordan(A,e,m);
[500122]644  setring(R);
[51534b6]645  list l=imap(G,l);
[9526639]646  kill G,gmsmaxdeg;
[51534b6]647
648  return(l);
[0c4bd7]649}
650example
651{ "EXAMPLE:"; echo=2;
652  ring R=0,(x,y),ds;
[d70bc7]653  poly t=x5+x2y2+y5;
654  monodromy(t);
[0c4bd7]655}
656///////////////////////////////////////////////////////////////////////////////
657
[86c1f0]658proc spectrum(poly t)
659"USAGE:    spectrum(t); poly t
[275721f]660ASSUME:   characteristic 0; local degree ordering;
[a8cc0a]661          isolated critical point 0 of t
[057c22e]662RETURN:
[7c7ca9]663@format
[275721f]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
[86c1f0]669@end format
670SEE ALSO: spectrum_lib
[46af92]671KEYWORDS: singularities; Gauss-Manin system; Brieskorn lattice;
[d70bc7]672          mixed Hodge structure; V-filtration; spectrum
[61549b]673EXAMPLE:  example spectrum; shows examples
[86c1f0]674"
675{
[61549b]676  list l=vwfilt(t);
[2d3b6e6]677  return(spnf(list(l[1],l[3])));
[86c1f0]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
[61549b]687proc sppairs(poly t)
688"USAGE:    sppairs(t); poly t
[275721f]689ASSUME:   characteristic 0; local degree ordering;
[a8cc0a]690          isolated critical point 0 of t
[61549b]691RETURN:
692@format
[275721f]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
[e9124e]698  intvec spp[3];
[275721f]699    int spp[3][i];  multiplicity of i-th spectral pair
[61549b]700@end format
701SEE ALSO: spectrum_lib
[46af92]702KEYWORDS: singularities; Gauss-Manin system; Brieskorn lattice;
[d70bc7]703          mixed Hodge structure; V-filtration; weight filtration;
704          spectrum; spectral pairs
[61549b]705EXAMPLE:  example sppairs; shows examples
706"
[e480544]707{
[61549b]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));
[e480544]716}
717///////////////////////////////////////////////////////////////////////////////
718
[61549b]719proc vfilt(poly t)
720"USAGE:    vfilt(t); poly t
[275721f]721ASSUME:   characteristic 0; local degree ordering;
[a8cc0a]722          isolated critical point 0 of t
[275721f]723RETURN:
[86c1f0]724@format
[275721f]725list v;  V-filtration on H''/s*H''
726  ideal v[1];
[91fc5e]727    number v[1][i];  V-filtration index of i-th spectral number
[e9124e]728  intvec v[2];
[91fc5e]729    int v[2][i];  multiplicity of i-th spectral number
[e9124e]730  list v[3];
[04c344]731    module v[3][i];  vector space of i-th graded part in terms of v[4]
[275721f]732  ideal v[4];  monomial vector space basis of H''/s*H''
733  ideal v[5];  standard basis of Jacobian ideal
[86c1f0]734@end format
735SEE ALSO: spectrum_lib
[46af92]736KEYWORDS: singularities; Gauss-Manin system; Brieskorn lattice;
[61549b]737          mixed Hodge structure; V-filtration; spectrum
738EXAMPLE:  example vfilt; shows examples
739"
740{
741  list l=vwfilt(t);
[2d3b6e6]742  return(spnf(list(l[1],l[3],l[4]))+list(l[5],l[6]));
[61549b]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
[275721f]754ASSUME:   characteristic 0; local degree ordering;
[a8cc0a]755          isolated critical point 0 of t
[61549b]756RETURN:
757@format
[275721f]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
[e9124e]763  intvec vw[3];
[275721f]764    int vw[3][i];  multiplicity of i-th spectral pair
[e9124e]765  list vw[4];
[04c344]766    module vw[4][i];  vector space of i-th graded part in terms of vw[5]
[275721f]767  ideal vw[5];  monomial vector space basis of H''/s*H''
768  ideal vw[6];  standard basis of Jacobian ideal
[61549b]769@end format
770SEE ALSO: spectrum_lib
[46af92]771KEYWORDS: singularities; Gauss-Manin system; Brieskorn lattice;
[61549b]772          mixed Hodge structure; V-filtration; weight filtration;
[86c1f0]773          spectrum; spectral pairs
[61549b]774EXAMPLE:  example vwfilt; shows examples
[86c1f0]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);
[0ff6b5]783  matrix A;
[61549b]784  module U0;
[0ff6b5]785  ideal e;
786  intvec m;
[86c1f0]787
[2ca72f]788  def A0,r,H,H0,k0=saturate();
[e9124e]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);
[86c1f0]791
[409dbae]792  dbprint(printlevel-voice+2,"// compute weight filtration basis");
[e480544]793  list l=jordanbasis(A,e,m);
[0ff6b5]794  def U,v=l[1..2];
[61549b]795  kill l;
[ccf8d9]796  vector u0;
797  int v0;
[61549b]798  int i,j,k,l;
799  for(k,l=1,1;l<=ncols(e);k,l=k+m[l],l+1)
[86c1f0]800  {
[61549b]801    for(i=k+m[l]-1;i>=k+1;i--)
[86c1f0]802    {
[ccf8d9]803      for(j=i-1;j>=k;j--)
[86c1f0]804      {
[ccf8d9]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        }
[86c1f0]810      }
811    }
812  }
813
814  dbprint(printlevel-voice+2,"// transform to weight filtration basis");
[ccf8d9]815  matrix V=inverse(U);
[86c1f0]816  A=V*A*U;
[4f364b]817  dbprint(printlevel-voice+2,"// compute standard basis of H''");
[86c1f0]818  H0=std(V*H0);
[61549b]819  U0=U0*U;
[86c1f0]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];
[4f364b]827    a[i]=A[j,j]+ord(H0[i])/deg(var(1))-1;
[0ff6b5]828    w[i]=v[j]+n;
[86c1f0]829  }
[61549b]830  kill v;
[4f364b]831  module v=simplify(jet(H*U0*H0,2*k0)/var(1)^(2*k0),1);
[0ff6b5]832
[51534b6]833  kill l;
[2d3b6e6]834  list l=sppnf(list(a,w,v))+list(gmsbasis,gmsstd);
[86c1f0]835  setring(R);
[51534b6]836  list l=imap(G,l);
[9526639]837  kill G,gmsmaxdeg;
[51534b6]838  attrib(l[5],"isSB",1);
839
840  return(l);
[ccf8d9]841}
842example
843{ "EXAMPLE:"; echo=2;
844  ring R=0,(x,y),ds;
845  poly t=x5+x2y2+y5;
[61549b]846  vwfilt(t);
[ccf8d9]847}
848///////////////////////////////////////////////////////////////////////////////
849
[275721f]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;
[a8cc0a]874          isolated critical point 0 of t
[91fc5e]875RETURN:
876@format
[4f364b]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''
[91fc5e]881@end format
[46af92]882KEYWORDS: singularities; Gauss-Manin system; Brieskorn lattice;
883          mixed Hodge structure; V-filtration; good basis
[275721f]884EXAMPLE:  example tmatrix; shows examples
[61549b]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
[2ca72f]898  def A0,r,H,H0,k0=saturate();
[e9124e]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);
[4f364b]902  module T=H*U0;
[61549b]903
[51534b6]904  ring S=0,s,(ds,c);
905  matrix A=imap(G,A);
906  module H0=imap(G,H0);
[4f364b]907  module T=imap(G,T);
[51534b6]908  ideal e=imap(G,e);
909
[61549b]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;
[51534b6]914  module H=V*H0;
[4f364b]915  T=T*U;
[61549b]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];
[51534b6]922  matrix A0=commutator(jet(A,0));
[61549b]923  for(k=1;k<=k0+k1;k++)
924  {
925    for(j=0;j<k;j++)
926    {
[4f364b]927      V=matrix(V)-(jet(A,k-j)/var(1)^(k-j))*(jet(U,j)/var(1)^j);
[61549b]928    }
929    v=V[1..mu,1..mu];
930    v=inverse(A0+k)*v;
931    V=v[1..mu^2,1];
[4f364b]932    U=matrix(U)+var(1)^k*V;
[61549b]933  }
[962b1f]934  attrib(U,"isSB",1);
[61549b]935
936  dbprint(printlevel-voice+2,"// transform to V-splitting basis");
937  A=jet(A,0);
[4f364b]938  H=std(division(H,U,(k0+k1)*deg(var(1)))[1]);
939  T=T*U;
[61549b]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];
[4f364b]947    j0=ord(H1[k]);
[61549b]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];
[4f364b]953      j=ord(H1[k]);
[61549b]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];
[4f364b]959        j=ord(H1[k]);
[61549b]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;
[08fff3]977  module F0,I0,U0;
[61549b]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);
[275721f]986
[61549b]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      {
[4f364b]1005        F0[i]=F0[i]/var(1);
[61549b]1006      }
1007    }
1008
1009    I=list();
1010    I0=module();
[08fff3]1011    U0=std(module());
[61549b]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;
[e5dcf2e]1024        I0=reduce(N*matrix(I0,nrows(N),ncols(N)),U0);
[61549b]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;
[4f364b]1039  T=T*U;
[61549b]1040
1041  dbprint(printlevel-voice+2,"// compute reduced standard basis of H''");
[51534b6]1042  degBound=k0+k1+2;
[17f79e9]1043  option(redSB);
[61549b]1044  H=std(H);
[17f79e9]1045  option(noredSB);
[61549b]1046  degBound=0;
1047  H=simplify(jet(H,k0+k1),1);
[962b1f]1048  attrib(H,"isSB",1);
[61549b]1049  dbprint(printlevel-voice+2,"// compute matrix A0+sA1 of t");
[4f364b]1050  A=division(var(1)*A*H+var(1)^2*diff(matrix(H),var(1)),H,deg(var(1)))[1];
[d70bc7]1051  A0=jet(A,0);
[4f364b]1052  A=jet(A,1)/var(1);
1053  T=jet(T*H,2*k0)/var(1)^(2*k0);
[61549b]1054
1055  setring(R);
[51534b6]1056  matrix A0=imap(S,A0);
1057  matrix A1=imap(S,A);
[4f364b]1058  module T=imap(S,T);
1059  ideal M=imap(G,gmsbasis);
1060  kill G,gmsmaxdeg;
[51534b6]1061  kill S;
[4f364b]1062  return(list(A0,A1,T,M));
[61549b]1063}
1064example
1065{ "EXAMPLE:"; echo=2;
1066  ring R=0,(x,y),ds;
1067  poly t=x5+x2y2+y5;
[275721f]1068  list A=tmatrix(t);
[61549b]1069  print(A[1]);
1070  print(A[2]);
[4f364b]1071  print(A[3]);
1072  print(A[4]);
[61549b]1073}
1074///////////////////////////////////////////////////////////////////////////////
1075
[275721f]1076proc endvfilt(list v)
1077"USAGE:   endvfilt(v); list v
1078ASSUME:  v returned by vfilt
[057c22e]1079RETURN:
[7c7ca9]1080@format
[04c344]1081list ev;  V-filtration on Jacobian algebra
[275721f]1082  ideal ev[1];
[26a4bb]1083    number ev[1][i];  i-th V-filtration index
[e9124e]1084  intvec ev[2];
[26a4bb]1085    int ev[2][i];  i-th multiplicity
[e9124e]1086  list ev[3];
[04c344]1087    module ev[3][i];  vector space of i-th graded part in terms of ev[4]
[275721f]1088  ideal ev[4];  monomial vector space basis of Jacobian algebra
1089  ideal ev[5];  standard basis of Jacobian ideal
[c52356d]1090@end format
[46af92]1091KEYWORDS: singularities; Gauss-Manin system; Brieskorn lattice;
[d70bc7]1092          mixed Hodge structure; V-filtration; endomorphism filtration
[275721f]1093EXAMPLE:  example endvfilt; shows examples
[0c4bd7]1094"
1095{
[275721f]1096  def a,d,V,m,g=v[1..5];
[0049b4]1097  attrib(g,"isSB",1);
[0c4bd7]1098  int mu=ncols(m);
1099
[275721f]1100  module V0=V[1];
1101  for(int i=2;i<=size(V);i++)
[0c4bd7]1102  {
[275721f]1103    V0=V0,V[i];
[0c4bd7]1104  }
[d08457]1105
[1418c4]1106  dbprint(printlevel-voice+2,"// compute multiplication in Jacobian algebra");
[0c4bd7]1107  list M;
[409dbae]1108  module U=freemodule(ncols(m));
[0c4bd7]1109  for(i=ncols(m);i>=1;i--)
1110  {
[215349c]1111    M[i]=division(coeffs(reduce(m[i]*m,g,U),m)*V0,V0)[1];
[0c4bd7]1112  }
1113
[8960ec]1114  int j,k,i0,j0,i1,j1;
[8c4269a]1115  number b0=number(a[1]-a[ncols(a)]);
1116  number b1,b2;
[0c4bd7]1117  matrix M0;
1118  module L;
1119  list v0=freemodule(ncols(m));
[8c4269a]1120  ideal a0=b0;
[a25a6a]1121  list l;
[0c4bd7]1122
[8c4269a]1123  while(b0<number(a[ncols(a)]-a[1]))
[0c4bd7]1124  {
[1418c4]1125    dbprint(printlevel-voice+2,"// find next possible index");
[8c4269a]1126    b1=number(a[ncols(a)]-a[1]);
1127    for(j=ncols(a);j>=1;j--)
[0c4bd7]1128    {
[8c4269a]1129      for(i=ncols(a);i>=1;i--)
[0c4bd7]1130      {
[8c4269a]1131        b2=number(a[i]-a[j]);
1132        if(b2>b0&&b2<b1)
[0c4bd7]1133        {
[8c4269a]1134          b1=b2;
[0c4bd7]1135        }
1136        else
1137        {
[8c4269a]1138          if(b2<=b0)
[0c4bd7]1139          {
1140            i=0;
1141          }
1142        }
1143      }
1144    }
[8c4269a]1145    b0=b1;
[0c4bd7]1146
[a25a6a]1147    l=ideal();
[0c4bd7]1148    for(k=ncols(m);k>=2;k--)
1149    {
1150      l=l+list(ideal());
1151    }
1152
[61549b]1153    dbprint(printlevel-voice+2,"// collect conditions for EV["+string(b0)+"]");
[8c4269a]1154    j=ncols(a);
[a23a7fd]1155    j0=mu;
1156    while(j>=1)
[0c4bd7]1157    {
1158      i0=1;
1159      i=1;
[8c4269a]1160      while(i<ncols(a)&&a[i]<a[j]+b0)
[0c4bd7]1161      {
1162        i0=i0+d[i];
1163        i++;
1164      }
[8c4269a]1165      if(a[i]<a[j]+b0)
[0c4bd7]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        {
[a23a7fd]1175          l[k]=l[k],M0[1..i0-1,j0-d[j]+1..j0];
[0c4bd7]1176        }
1177      }
1178      j0=j0-d[j];
[a23a7fd]1179      j--;
[0c4bd7]1180    }
1181
[1418c4]1182    dbprint(printlevel-voice+2,"// compose condition matrix");
[0c4bd7]1183    L=transpose(module(l[1]));
1184    for(k=2;k<=ncols(m);k++)
1185    {
1186      L=L,transpose(module(l[k]));
1187    }
1188
[1418c4]1189    dbprint(printlevel-voice+2,"// compute kernel of condition matrix");
[0c4bd7]1190    v0=v0+list(syz(L));
[8c4269a]1191    a0=a0,b0;
[0c4bd7]1192  }
1193
[1418c4]1194  dbprint(printlevel-voice+2,"// compute graded parts");
[0c4bd7]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  }
[17f79e9]1201  option(noredSB);
[0c4bd7]1202
[1418c4]1203  dbprint(printlevel-voice+2,"// remove trivial graded parts");
[0c4bd7]1204  i=1;
1205  while(size(v0[i])==0)
1206  {
1207    i++;
1208  }
1209  list v1=v0[i];
[d5c289]1210  intvec d1=size(v0[i]);
[8c4269a]1211  ideal a1=a0[i];
[0c4bd7]1212  i++;
1213  while(i<=size(v0))
1214  {
1215    if(size(v0[i])>0)
1216    {
1217      v1=v1+list(v0[i]);
[d5c289]1218      d1=d1,size(v0[i]);
[8c4269a]1219      a1=a1,a0[i];
[0c4bd7]1220    }
1221    i++;
1222  }
[61549b]1223  return(list(a1,d1,v1,m,g));
[0c4bd7]1224}
1225example
1226{ "EXAMPLE:"; echo=2;
1227  ring R=0,(x,y),ds;
[86c1f0]1228  poly t=x5+x2y2+y5;
[61549b]1229  endvfilt(vfilt(t));
[34a9eb1]1230}
1231///////////////////////////////////////////////////////////////////////////////
1232
[2d3b6e6]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
[34a9eb1]1238"
1239{
[2d3b6e6]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++)
[34a9eb1]1248  {
[2d3b6e6]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    }
[34a9eb1]1350  }
[2d3b6e6]1351  return(sp);
[34a9eb1]1352}
1353example
1354{ "EXAMPLE:"; echo=2;
1355  ring R=0,(x,y),ds;
[2d3b6e6]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));
[34a9eb1]1358}
1359///////////////////////////////////////////////////////////////////////////////
1360
[d70bc7]1361proc sppprint(list spp)
1362"USAGE:   sppprint(spp); list spp
[275721f]1363RETURN:  string s;  spectral pairs spp
[e480544]1364EXAMPLE: example sppprint; shows examples
[8c4269a]1365"
1366{
1367  string s;
[d70bc7]1368  for(int i=1;i<size(spp[3]);i++)
[8c4269a]1369  {
[d70bc7]1370    s=s+"(("+string(spp[1][i])+","+string(spp[2][i])+"),"+string(spp[3][i])+"),";
[8c4269a]1371  }
[d70bc7]1372  s=s+"(("+string(spp[1][i])+","+string(spp[2][i])+"),"+string(spp[3][i])+")";
[8c4269a]1373  return(s);
1374}
1375example
1376{ "EXAMPLE:"; echo=2;
1377  ring R=0,(x,y),ds;
[d70bc7]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);
[8c4269a]1380}
1381///////////////////////////////////////////////////////////////////////////////
1382
[d70bc7]1383proc spadd(list sp1,list sp2)
[275721f]1384"USAGE:   spadd(sp1,sp2); list sp1, list sp2
1385RETURN:  list sp;  sum of spectra sp1 and sp2
[04b295]1386EXAMPLE: example spadd; shows examples
[8c4269a]1387"
1388{
1389  ideal s;
1390  intvec m;
1391  int i,i1,i2=1,1,1;
[d70bc7]1392  while(i1<=size(sp1[2])||i2<=size(sp2[2]))
[8c4269a]1393  {
[d70bc7]1394    if(i1<=size(sp1[2]))
[8c4269a]1395    {
[d70bc7]1396      if(i2<=size(sp2[2]))
[8c4269a]1397      {
[d70bc7]1398        if(number(sp1[1][i1])<number(sp2[1][i2]))
[8c4269a]1399        {
[d70bc7]1400          s[i]=sp1[1][i1];
1401          m[i]=sp1[2][i1];
[8c4269a]1402          i++;
1403          i1++;
1404        }
1405        else
1406        {
[d70bc7]1407          if(number(sp1[1][i1])>number(sp2[1][i2]))
[8c4269a]1408          {
[d70bc7]1409            s[i]=sp2[1][i2];
1410            m[i]=sp2[2][i2];
[8c4269a]1411            i++;
1412            i2++;
1413          }
1414          else
1415          {
[d70bc7]1416            if(sp1[2][i1]+sp2[2][i2]!=0)
[8c4269a]1417            {
[d70bc7]1418              s[i]=sp1[1][i1];
1419              m[i]=sp1[2][i1]+sp2[2][i2];
[8c4269a]1420              i++;
1421            }
1422            i1++;
1423            i2++;
1424          }
1425        }
1426      }
1427      else
1428      {
[d70bc7]1429        s[i]=sp1[1][i1];
1430        m[i]=sp1[2][i1];
[8c4269a]1431        i++;
1432        i1++;
1433      }
1434    }
1435    else
1436    {
[d70bc7]1437      s[i]=sp2[1][i2];
1438      m[i]=sp2[2][i2];
[8c4269a]1439      i++;
1440      i2++;
1441    }
1442  }
1443  return(list(s,m));
1444}
1445example
1446{ "EXAMPLE:"; echo=2;
1447  ring R=0,(x,y),ds;
[d70bc7]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));
[8c4269a]1453}
1454///////////////////////////////////////////////////////////////////////////////
1455
[d70bc7]1456proc spsub(list sp1,list sp2)
[275721f]1457"USAGE:   spsub(sp1,sp2); list sp1, list sp2
1458RETURN:  list sp;  difference of spectra sp1 and sp2
[04b295]1459EXAMPLE: example spsub; shows examples
[8c4269a]1460"
1461{
[d70bc7]1462  return(spadd(sp1,spmul(sp2,-1)));
[8c4269a]1463}
1464example
1465{ "EXAMPLE:"; echo=2;
1466  ring R=0,(x,y),ds;
[d70bc7]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));
[8c4269a]1472}
1473///////////////////////////////////////////////////////////////////////////////
1474
1475proc spmul(list #)
[275721f]1476"USAGE:   spmul(sp0,k); list sp0, int[vec] k
1477RETURN:  list sp;  linear combination of spectra sp0 with coefficients k
[04b295]1478EXAMPLE: example spmul; shows examples
[8c4269a]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      {
[d70bc7]1491        list sp0=list(ideal(),intvec(0));
[8c4269a]1492        for(int i=size(#[2]);i>=1;i--)
1493        {
[d70bc7]1494          sp0=spadd(sp0,spmul(#[1][i],#[2][i]));
[8c4269a]1495        }
[d70bc7]1496        return(sp0);
[8c4269a]1497      }
1498    }
1499  }
1500  return(list(ideal(),intvec(0)));
1501}
1502example
1503{ "EXAMPLE:"; echo=2;
1504  ring R=0,(x,y),ds;
[d70bc7]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)));
[8c4269a]1513}
1514///////////////////////////////////////////////////////////////////////////////
1515
[d70bc7]1516proc spissemicont(list sp,list #)
[275721f]1517"USAGE:   spissemicont(sp[,1]); list sp, int opt
[8c4269a]1518RETURN:
1519@format
1520int k=
[275721f]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)]
[8c4269a]1523@end format
[04b295]1524EXAMPLE: example spissemicont; shows examples
[8c4269a]1525"
1526{
1527  int opt=0;
1528  if(size(#)>0)
1529  {
1530    if(typeof(#[1])=="int")
1531    {
1532      opt=1;
1533    }
1534  }
[96a9c70]1535  int i,j,k;
1536  i=1;
[74d9b7]1537  while(i<=size(sp[2])-1)
[8c4269a]1538  {
[96a9c70]1539    j=i+1;
1540    k=0;
1541    while(j+1<=size(sp[2])&&number(sp[1][j])<=number(sp[1][i])+1)
[8c4269a]1542    {
[96a9c70]1543      if(opt==0||number(sp[1][j])<number(sp[1][i])+1)
[74d9b7]1544      {
1545        k=k+sp[2][j];
1546      }
[8c4269a]1547      j++;
1548    }
[96a9c70]1549    if(j==size(sp[2])&&number(sp[1][j])<=number(sp[1][i])+1)
[8c4269a]1550    {
[96a9c70]1551      if(opt==0||number(sp[1][j])<number(sp[1][i])+1)
[74d9b7]1552      {
1553        k=k+sp[2][j];
1554      }
[8c4269a]1555    }
[74d9b7]1556    if(k<0)
[8c4269a]1557    {
1558      return(0);
1559    }
[96a9c70]1560    i++;
[8c4269a]1561  }
1562  return(1);
1563}
1564example
1565{ "EXAMPLE:"; echo=2;
1566  ring R=0,(x,y),ds;
[d70bc7]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);
[74d9b7]1571  spissemicont(spsub(sp1,spmul(sp2,3)));
1572  spissemicont(spsub(sp1,spmul(sp2,4)));
[8c4269a]1573}
1574///////////////////////////////////////////////////////////////////////////////
1575
[d70bc7]1576proc spsemicont(list sp0,list sp,list #)
[275721f]1577"USAGE:   spsemicont(sp0,sp,k[,1]); list sp0, list sp
1578RETURN:
1579@format
1580list l;
[e9124e]1581  intvec l[i];  if the spectra sp0 occur with multiplicities k
1582                in a deformation of a [quasihomogeneous] singularity
[a8cc0a]1583                with spectrum sp then k<=l[i]
[275721f]1584@end format
[04b295]1585EXAMPLE: example spsemicont; shows examples
[8c4269a]1586"
1587{
1588  list l,l0;
[38f6b33]1589  int i,j,k;
[d70bc7]1590  while(spissemicont(sp0,#))
[8c4269a]1591  {
[d70bc7]1592    if(size(sp)>1)
[8c4269a]1593    {
[d70bc7]1594      l0=spsemicont(sp0,list(sp[1..size(sp)-1]));
[38f6b33]1595      for(i=1;i<=size(l0);i++)
[8c4269a]1596      {
[38f6b33]1597        if(size(l)>0)
[e9124e]1598        {
[38f6b33]1599          j=1;
1600          while(j<size(l)&&l[j]!=l0[i])
[e9124e]1601          {
[38f6b33]1602            j++;
1603          }
1604          if(l[j]==l0[i])
[e9124e]1605          {
[d70bc7]1606            l[j][size(sp)]=k;
[38f6b33]1607          }
1608          else
[e9124e]1609          {
[d70bc7]1610            l0[i][size(sp)]=k;
[38f6b33]1611            l=l+list(l0[i]);
1612          }
[e9124e]1613        }
[38f6b33]1614        else
[e9124e]1615        {
[38f6b33]1616          l=l0;
[e9124e]1617        }
[8c4269a]1618      }
1619    }
[d70bc7]1620    sp0=spsub(sp0,sp[size(sp)]);
[8c4269a]1621    k++;
1622  }
[d70bc7]1623  if(size(sp)>1)
[8c4269a]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;
[d70bc7]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);
[8c4269a]1643  l;
[d70bc7]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)));
[8c4269a]1647}
1648///////////////////////////////////////////////////////////////////////////////
1649
[d70bc7]1650proc spmilnor(list sp)
1651"USAGE:   spmilnor(sp); list sp
[275721f]1652RETURN:  int mu;  Milnor number of spectrum sp
[04b295]1653EXAMPLE: example spmilnor; shows examples
[8960ec]1654"
1655{
[d70bc7]1656  return(sum(sp[2]));
[8960ec]1657}
1658example
1659{ "EXAMPLE:"; echo=2;
1660  ring R=0,(x,y),ds;
[d70bc7]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);
[8960ec]1664}
1665///////////////////////////////////////////////////////////////////////////////
1666
[d70bc7]1667proc spgeomgenus(list sp)
1668"USAGE:   spgeomgenus(sp); list sp
[275721f]1669RETURN:  int g;  geometrical genus of spectrum sp
[04b295]1670EXAMPLE: example spgeomgenus; shows examples
[8c4269a]1671"
1672{
1673  int g=0;
1674  int i=1;
[d70bc7]1675  while(i+1<=size(sp[2])&&number(sp[1][i])<=number(0))
[8c4269a]1676  {
[d70bc7]1677    g=g+sp[2][i];
[8c4269a]1678    i++;
1679  }
[d70bc7]1680  if(i==size(sp[2])&&number(sp[1][i])<=number(0))
[8c4269a]1681  {
[d70bc7]1682    g=g+sp[2][i];
[8c4269a]1683  }
1684  return(g);
1685}
1686example
1687{ "EXAMPLE:"; echo=2;
1688  ring R=0,(x,y),ds;
[d70bc7]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);
[cc3a04]1692}
1693///////////////////////////////////////////////////////////////////////////////
[8960ec]1694
[d70bc7]1695proc spgamma(list sp)
1696"USAGE:   spgamma(sp); list sp
[275721f]1697RETURN:  number gamma;  gamma invariant of spectrum sp
[04b295]1698EXAMPLE: example spgamma; shows examples
[8960ec]1699"
1700{
1701  int i,j;
1702  number g=0;
[d70bc7]1703  for(i=1;i<=ncols(sp[1]);i++)
[8960ec]1704  {
[d70bc7]1705    for(j=1;j<=sp[2][i];j++)
[8960ec]1706    {
[d70bc7]1707      g=g+(number(sp[1][i])-number(nvars(basering)-2)/2)^2;
[8960ec]1708    }
1709  }
[d70bc7]1710  g=-g/4+sum(sp[2])*number(sp[1][ncols(sp[1])]-sp[1][1])/48;
[8960ec]1711  return(g);
1712}
1713example
1714{ "EXAMPLE:"; echo=2;
1715  ring R=0,(x,y),ds;
[d70bc7]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);
[8960ec]1719}
1720///////////////////////////////////////////////////////////////////////////////
Note: See TracBrowser for help on using the repository browser.