source: git/Singular/LIB/surfsig.lib @ 12603f

spielwiese
Last change on this file since 12603f was 12603f, checked in by Hans Schönemann <hannes@…>, 14 years ago
rename signature.lib to surfsig.lib git-svn-id: file:///usr/local/Singular/svn/trunk@12618 2c84dea3-7e68-4137-9b89-c4e89433aadc
  • Property mode set to 100644
File size: 7.3 KB
Line 
1version="$Id$";
2category="Singularities";
3info="
4LIBRARY:  signature.lib        signature of surface singularity
5AUTHORS:  Gerhard Pfister,     pfister@mathematik.uni-kl.de
6          Muhammad Ahsan,      ahsanbanyamin@gmail.com
7
8OVERVIEW:
9 A library for computing the signature of irreducible surface singularity.
10 The library contains also procedure for computing the newton pairs of surface singularity.
11
12 PROCEDURES:
13 brieskornSign(a,b,c);   signature of Brieskorn singularity x^a+y^b+z^c=0
14 newtonpairs(f);         newton pairs of surface singularity
15 signature(N,f);         signature of singularity z^+f(x,y)=0,f irreducible
16
17";
18
19LIB "hnoether.lib";
20///////////////////////////////////////////////////////////////////////////////
21proc signature(int N,poly f)
22"USAGE:signature(N,f);N=integer,f=irreducible poly in x,y
23 RETURN:signature of surface singularity defined by z^N+f=0
24 EXAMPLE:example signature; shows an example
25"
26{
27   def R=basering;
28   ring S=0,(x,y),dp;
29   map phi =R,x,y;
30   poly f=phi(f);
31   list L=newtonpairs(f);
32   setring R;
33   if(size(L)>2)
34   {
35     return(Generalcase(N,L));
36   }
37   if(size(L)==2)
38   {
39     return(signtwopairs(N,L));
40   }
41   return(brieskornSign(L[1][2],L[1][1],N));
42 }
43 example
44{ "EXAMPLE:"; echo = 2;
45   ring r=0,(x,y),dp;
46   int N=2;
47   poly f=y8+2x6y3+x10+x9y;
48   signature(N,f);
49   f=y4+2x3y2+x6+x5y;
50   signature(N,f);
51   N=3;
52   f=x15-21x14+8x13y-6x13-16x12y+20x11y2-x12+8x11y-36x10y2+24x9y3+4x9y2-16x8y3+26x7y4-6x6y4+8x5y5+4x3y6-y8;
53   signature(N,f);
54}
55
56proc newtonpairs(poly f)
57"USAGE:newtonpairs(f);f= irreducible bivariate poly
58 RETURN:newton pairs of curve singularity f(x,y)=0
59 EXAMPLE:example newtonpairs; shows an example
60"
61{
62 def R=basering;
63 ring S=0,(x,y),dp;
64 map phi =R,x,y;
65 poly f=phi(f);
66 list M=invariants(f);
67 setring R;
68 list L=M[1][3];
69 list K=M[1][4];
70 int i,j;
71 intvec v;
72 list N1,N2,P,T;
73 N1[1]=M[1][4][1];
74 N2[1]=M[1][3][1];
75 for(i=2;i<=size(M[1][3]);i++)
76 {
77  N1[i]=M[1][4][i];
78  N2[i]=M[1][3][i]-N1[i]*M[1][3][i-1];
79 }
80  P[1]=N1;
81  P[2]=N2;
82  for(j=1;j<=size(P[1]);j++)
83  {
84     v=P[1][j],P[2][j];
85     T[j]=v;
86   }
87  return(T);
88}
89example
90{ "EXAMPLE:"; echo = 2;
91   ring r=0,(x,y),dp;
92   newtonpairs(y4+2x3y2+x6+x5y);
93}
94
95proc brieskornSign(a,b,c)
96"USAGE:brieskornSign(a,b,c);a,b,c=integers
97 RETURN:signature of Brieskorn singularity x^a+y^b+z^c
98 EXAMPLE:example brieskornSign; shows an example
99"
100{
101   int i,j,k,d;
102   for(i=1;i<=a-1;i++)
103   {
104       for(j=1;j<=b-1;j++)
105       {
106          for(k=1;k<=c-1;k++)
107         {
108            d=d+signa(number(i)/a+number(j)/b+number(k)/c);
109         }
110       }
111    }
112    return(d);
113 }
114example
115{ "EXAMPLE:"; echo = 2;
116   ring R=0,x,dp;
117   brieskornSign(11,3,5);
118}
119
120static proc signsin(number n)
121"USAGE:signsin(n);n=number
122 RETURN:the signature of value of sine corresponding to n
123 EXAMPLE:example signSin; shows an example
124"
125{
126   def r=basering;
127   int a;
128   int b=10;
129   ring s=(real,10),x,dp;
130   number m=imap(r,n);
131   number pi = number_pi(11);
132   number t=m*pi;
133   poly f=sin(b);
134   poly h=subst(f,x,t);
135   if(h>0){a=1;}
136   if(h<0){a=-1;}
137   setring r;
138   return(a);
139}
140example
141{ "EXAMPLE:"; echo = 2;
142   ring r=0,x,dp;
143   signsin(11/3);
144}
145
146static proc split1(number n)
147"USAGE:split1(n);n=number
148 RETURN:integral and fractional parts of number n
149 EXAMPLE:example split1; shows an example
150 "
151{
152   number a,b;
153   int r;
154   a=numerator(n);
155   b=denominator(n);
156   int z=int(number(a));
157   int y=int(number(b));
158   r=z mod y;
159   int q=(z-r) div y;
160   number n1=q;
161   number n2=n-n1;
162   list l=n1,n2;
163   return(l);
164}
165example
166{ "EXAMPLE:"; echo = 2;
167     ring r=0,x,dp;
168     split1(11/3);
169}
170
171static proc sin( int n)
172"USAGE:sin(n);n=integer
173 RETURN:approximate value of sine by using maclaurin series corresponding to n
174 EXAMPLE:example sin; shows an example
175 "
176{
177   def R=basering;
178   ring S=0,x,dp;
179   int i;
180   poly f;
181   int z;
182   for(i=1;i<=n;i=i+2)
183   {
184     f=f+(-1)^z*x^i/factorial(i,0) ;
185     z++;
186   }
187   setring R;
188   map phi=S,var(1);
189   poly f=phi(f);
190   return(f);
191}
192example
193{ "EXAMPLE:"; echo = 2;
194   ring r=0,x,dp;
195   sin(10);
196}
197
198static proc cos(int n)
199"USAGE:cos(n);n=integer
200 RETURN:approximate value of cosine by using maclaurin series corresponding to n
201 EXAMPLE:example cos; shows an example
202 "
203{
204   def R=basering;
205   ring S=0,x,dp;
206   poly f;
207   int i;
208   int z;
209   for(i=0;i<=n;i=i+2)
210   {
211      f=f+(-1)^z*x^i/factorial(i,0);
212      z++;
213   }
214   setring R;
215   map phi=S,var(1);
216   poly f=phi(f);
217   return(f);
218 }
219example
220{ "EXAMPLE:"; echo = 2;
221   ring r=0,x,dp;
222   cos(10);
223}
224
225static proc signcos(number n)
226"USAGE:signcos(n);n=number
227 RETURN:the signature of value of cosine corresponding to n
228 EXAMPLE:example signcos; shows an example
229"
230{
231   def r=basering;
232   int a;
233   int b=10;
234   ring s=(real,10),x,dp;
235   number m=imap(r,n);
236   number pi = number_pi(11);
237   number t=m*pi;
238   poly f=cos(b);
239   poly h=subst(f,x,t);
240   if(h>0){a=1;}
241   if(h<0){a=-1;}
242   setring r;
243   return(a);
244}
245example
246{ "EXAMPLE:"; echo = 2;
247   ring r=0,x,dp;
248   signcos(11/3);
249}
250
251static proc  signa( number u)
252"USAGE:signa(u);u=number
253 RETURN:the signa of a number
254 EXAMPLE:example signa; shows an example
255"
256{
257   list l=split1(u);
258   int z;
259   if( l[1] mod 2==0 )
260   { z=signsin(l[2]); }
261   else
262   { z=signcos(l[1]);}
263   return(z);
264}
265example
266{ "EXAMPLE:"; echo = 2;
267   ring r=0,x,dp;
268   signa(11/3);
269}
270
271static proc prods(list L)
272"USAGE:product(L);L=list of intvec
273 RETURN:product of first components of Newton pairs in L
274 EXAMPLE:example product; shows an example
275"
276{
277   int a=L[2][1];
278   int i;
279   for(i=1;i<=size(L)-2;i++)
280   {
281      a=a*L[i+2][1];
282   }
283   return(a);
284}
285example
286{ "EXAMPLE:"; echo = 2;
287   list L=intvec(2,3),intvec(2,1);
288   prods(L);
289}
290
291static proc Generalcase(int N, list L)
292"USAGE:Generalcase(N,f);N=integer,list L of intvec
293 RETURN:signature of surface singularity with Newton pairs in L
294 ASSUME:number of newton pairs greater than 2
295 EXAMPLE:example Generalcase; shows an example
296"
297{
298   int i,j,k,n,m,t,p;
299   int a=L[1][2];
300   int b=prods(L);
301   int d=gcd(N,b);
302   int q=d*brieskornSign(a,L[1][1],N/d);
303   list A;
304   list B;
305   list S;
306   for(i=1;i<=size(L)-1;i++)
307   {
308     a=L[i+1][2]+L[i+1][1]*L[i][1]*a;
309     A[i]=a;
310     S[i]=L[i+1][1];
311   }
312   for(m=1;m<=size(L)-2;m++)
313   {
314     B[m]=L[m+2][1];
315   }
316   list C;
317   int c=B[size(B)];
318   C[size(B)]=c;
319   for(j=1;j<=size(B)-1;j++)
320   {
321      c=c*B[size(B)-j];
322      C[size(B)-j]=c;
323   }
324   list D;
325   D[size(L)-1]=1;
326   for(k=1;k<=size(L)-2;k++)
327   {
328      D[k]=gcd(N,C[k]);
329   }
330   for(n=1;n<=size(L)-1;n++)
331   {
332     t=t+D[n]*brieskornSign(A[n],S[n],N/D[n]);
333   }
334   return(q+t);
335}
336example
337{ "EXAMPLE:"; echo = 2;
338   int N=2;
339   list L=intvec(2,3),intvec(2,1),intvec(2,1);
340   Generalcase(N,L);
341
342}
343
344static proc signtwopairs(int N,list L)
345"USAGE:signtwopairs(N,f);N=integer,L=list of intvec
346 RETURN:signature of surface singularity with Newton pairs in L
347 ASSUME:number of newton pairs equal to 2
348 EXAMPLE:example signtwopairs; shows an example
349"
350{
351  int a1,a2,b,d1,q,t;
352  a1=L[1][2];
353  b=prods(L);
354  d1=gcd(N,b);
355  q=d1*brieskornSign(a1,L[1][1],N/d1);
356  a2=L[2][2]+L[2][1]*L[1][1]*a1;
357  t=brieskornSign(a2,L[2][1],N);
358  return(q+t);
359}
360example
361{ "EXAMPLE:"; echo = 2;
362   int N=2;
363   list L=intvec(2,3),intvec(2,1);
364   signtwopairs(N,L);
365}
366
367static proc DedekindSum(number b, number c, int a)
368{
369   number s,d,e;
370   int k;
371   for(k=1;k<=a-1;k++)
372   {
373      d=k*b mod a;
374      e=k*c mod a;
375      if(d*e!=0)
376      {
377         s=s+(d/a-1/2)*(e/a-1/2);
378      }
379   }
380   return(s);
381}
382
Note: See TracBrowser for help on using the repository browser.