source: git/Singular/LIB/goettsche.lib @ cbe2b8a

spielwiese
Last change on this file since cbe2b8a was cbe2b8a, checked in by Sachin <sachinkm308@…>, 5 years ago
replacing execute with create_ring() and for loops changes (part 4)
  • Property mode set to 100644
File size: 28.6 KB
Line 
1////////////////////////////////////////////////////////////////
2version = "version goettsche.lib 0.931 Feb_2019 ";      //$Id$
3info="
4LIBRARY:  goettsche.lib     Drezet's formula for the Betti numbers of the moduli space
5                            of Kronecker modules;
6                            Goettsche's formula for the Betti numbers of the Hilbert scheme
7                            of points on a surface;
8                            Nakajima's and Yoshioka's formula for the Betti numbers
9                            of the punctual Quot-schemes on a plane or, equivalently,
10                            of the moduli spaces of the framed torsion-free planar sheaves;
11                            Macdonald's formula for the symmetric product
12
13AUTHOR:  Oleksandr Iena,    o.g.yena@gmail.com
14
15REFERENCES:
16  [1] Drezet, Jean-Marc     Cohomologie des varie'te's de modules de hauter nulle.
17                            Mathematische Annalen: 281, 43-85, (1988).
18
19  [2] Goettsche, Lothar,    The Betti numbers of the Hilbert scheme of ponts
20                            on a smooth projective surface.
21                            Mathematische Annalen: 286, 193-208, (1990).
22
23  [3] Macdonald, I. G.,     The Poincare polynomial of a symmetric product,
24                            Mathematical proceedings of the Cambridge Philosophical Society:
25                            58, 563-568, (1962).
26
27  [4] Nakajima, Hiraku;     Lectures on instanton counting, CRM Proceedings and Lecture Notes,
28      Yoshioka, Kota        Volume 88, 31-101, (2004).
29
30PROCEDURES:
31  GoettscheF(z, t, n, b);   The Goettsche's formula up to n-th degree
32  PPolyH(z, n, b);          Poincare Polynomial of the Hilbert scheme of n points on a surface
33  BettiNumsH(n, b);         Betti numbers of the Hilbert scheme of n points on a surface
34  NakYoshF(z, t, r, n);     The Nakajima-Yoshioka formula up to n-th degree
35  PPolyQp(z, n, b);         Poincare Polynomial of the punctual Quot-scheme
36                            of rank r on n planar points
37  BettiNumsQp(n, b);        Betti numbers of the punctual Quot-scheme
38                            of rank r on n planar points
39  MacdonaldF(z, t, n, b);   The Macdonald's formula up to n-th degree
40  PPolyS(z, n, b);          Poincare Polynomial of the n-th symmetric power of a variety
41  BettiNumsS(n, b);         Betti numbers of the n-th symmetric power of a variety
42  PPolyN(t, q, m, n);       Poincare Polynomial of the moduli space
43                            of Kronecker modules N (q; m, n)
44  BettiNumsN(q, m, n);      Betti numbers of the moduli space
45                            of Kronecker modules N (q; m, n)
46
47KEYWORDS:  Betty number; Goettsche's formula; Macdonald's formula; Kronecker module; Hilbert scheme; Quot-scheme; framed sheaves; symmetric product
48";
49//----------------------------------------------------------
50
51proc GoettscheF(poly z, poly t, int n, list b)
52"USAGE:   GoettscheF(z, t, n, b);  z, t polynomials, n integer, b list of non-negative integers
53RETURN:   polynomial in z and t
54PURPOSE:  computes the Goettsche's formula up to degree n in t
55EXAMPLE:  example GoettscheF; shows an example
56NOTE:     zero is returned if n<0 or b is not a list of non-negative integers
57          or if there are not enough Betti numbers
58"
59{
60  // check the input data
61  if( !checkBetti(b) )
62  {
63    print("the Betti numbers must be non-negative integers");
64    print("zero polynomial is returned");
65    return( poly(0) );
66  }
67  if(n<0)
68  {
69    print("the number of points must be non-negative");
70    print("zero polynomial is returned");
71    return( poly(0) );
72  }
73  // now n is non-negative and b is a list of non-negative integers
74  if(size(b) < 5) // if there are not enough Betti numbers
75  {
76    print("a surface must habe 5 Betti numbers b_0, b_1, b_2, b_3, b_4");
77    print("zero polynomial is returned");
78    return( poly(0) );
79  }
80  // now there are at least 5 non-negative Betti numbers b_0, b_1, b_2, b_3, b_4
81  def br@=basering; // remember the base ring
82  // add additional variables z@, t@ to the base ring
83  ring r@ = create_ring(ringlist(basering)[1], "("+varstr(basering)+", z@, t@)", "dp", "no_minpoly");
84  execute( "map F= br@,"+varstr(br@)+";" ); // define the corresponding inclusion of rings
85  // compute the generating function by the Goettsche's formula up to degree n in t@
86  poly rez=1;
87  int k,i;
88  ideal I=std(t@^(n+1));
89  for(k=1;k<=n;k++)
90  {
91    for(i=0;i<=4;i++)
92    {
93      rez=NF( rez*generFactor( z@^(2*k-2+i)*t@^k, k, i, b[i+1], n), I);
94    }
95  }
96  setring br@; // come back to the initial base ring
97  // define the specialization homomorphism z@=z, t@=t
98  execute( "map FF= r@,"+varstr(br@)+", z, t;" );
99  poly rez=FF(rez); // bring the result to the base ring
100  return(rez);
101}
102example
103{
104  "EXAMPLE:"; echo=2;
105  ring r=0, (t, z), ls;
106  // consider the projective plane with Betti numbers 1,0,1,0,1
107  list b=1,0,1,0,1;
108  // get the Goettsche's formula up to degree 3
109  print( GoettscheF(z, t, 3, b) );
110}
111//----------------------------------------------------------
112
113proc PPolyH(poly z, int n, list b)
114"USAGE:   PPolyH(z, n, b);  z polynomial, n integer, b list of non-negative integers
115RETURN:   polynomial in z
116PURPOSE:  computes the Poincare polynomial of the Hilbert scheme
117          of n points on a surface with Betti numbers b
118EXAMPLE:  example PPolyH; shows an example
119NOTE:     zero is returned if n<0 or b is not a list of non-negative integers
120          or if there are not enough Betti numbers
121"
122{
123  // check the input data
124  if( !checkBetti(b) )
125  {
126    print("the Betti numbers must be non-negative integers");
127    print("zero polynomial is returned");
128    return( poly(0) );
129  }
130  if(n<0)
131  {
132    print("the number of points must be non-negative");
133    print("zero polynomial is returned");
134    return( poly(0) );
135  }
136  // now n is non-negative and b is a list of non-negative integers
137  if(size(b) < 5) // if there are not enough Betti numbers
138  {
139    print("a surface must habe 5 Betti numbers b_0, b_1, b_2, b_3, b_4");
140    print("zero polynomial is returned");
141    return( poly(0) );
142  }
143  // now there are at least 5 non-negative Betti numbers b_0, b_1, b_2, b_3, b_4
144  def br@=basering; // remember the base ring
145  // add additional variables z@, t@ to the base ring
146  ring r@ = create_ring(ringlist(basering)[1], "("+varstr(basering)+", z@, t@)", "dp", "no_minpoly");
147  execute( "map F= br@,"+varstr(br@)+";" ); // define the corresponding inclusion of rings
148  // compute the generating function by the Goettsche's formula up to degree n in t@
149  poly rez=1;
150  int k,i;
151  ideal I=std(t@^(n+1));
152  for(k=1;k<=n;k++)
153  {
154    for(i=0;i<=4;i++)
155    {
156      rez=NF(rez*generFactor( z@^(2*k-2+i)*t@^k, k, i, b[i+1], n), I);
157    }
158  }
159  rez= coeffs(rez, t@)[n+1, 1]; // take the coefficient of the n-th power of t@
160  setring br@; // come back to the initial base ring
161  // define the specialization homomorphism z@=z, t@=0
162  execute( "map FF= r@,"+varstr(br@)+",z, 0;" );
163  poly rez=FF(rez); // bring the result to the base ring
164  return(rez);
165}
166example
167{
168  "EXAMPLE:"; echo=2;
169  ring r=0, (z), ls;
170  // consider the projective plane P_2 with Betti numbers 1,0,1,0,1
171  list b=1,0,1,0,1;
172  // get the Poincare polynomial of the Hilbert scheme of 3 points on P_2
173  print( PPolyH(z, 3, b) );
174}
175//----------------------------------------------------------
176
177proc BettiNumsH(int n, list b)
178"USAGE:   BettiNumsH(n, b);  n integer, b list of non-negative integers
179RETURN:   list of non-negative integers
180PURPOSE:  computes the Betti numbers of the Hilbert scheme
181          of n points on a surface with Betti numbers b
182EXAMPLE:  example BettiNumsH; shows an example
183NOTE:     an empty list is returned if n<0 or b is not a list of non-negative integers
184          or if there are not enough Betti numbers
185"
186{
187  // check the input data
188  if( !checkBetti(b) )
189  {
190    print("the Betti numbers must be non-negative integers");
191    print("an empty list is returned");
192    return( list() );
193  }
194  if(n<0)
195  {
196    print("the number of points must be non-negative");
197    print("an empty list is returned");
198    return(list());
199  }
200  // now n is non-negative and b is a list of non-negative integers
201  if(size(b) < 5) // if there are not enough Betti numbers
202  {
203    print("a surface must habe 5 Betti numbers b_0, b_1, b_2, b_3, b_4");
204    print("an empty list is returned");
205    return( list() );
206  }
207  // now there are at least 5 non-negative Betti numbers b_0, b_1, b_2, b_3, b_4
208  def br@=basering; // remember the base ring
209  // add additional variables z@, t@ to the base ring
210  ring r@ = create_ring(ringlist(basering)[1], "("+varstr(basering)+", z@, t@)", "dp", "no_minpoly");
211  execute( "map F= br@,"+varstr(br@)+";" ); // define the corresponding inclusion of rings
212  poly rez=1;
213  int k,i;
214  ideal I=std(t@^(n+1));
215  for(k=1;k<=n;k++)
216  {
217    for(i=0;i<=4;i++)
218    {
219      rez=NF(rez*generFactor( z@^(2*k-2+i)*t@^k, k, i, b[i+1], n), I);
220    }
221  }
222  rez= coeffs(rez, t@)[n+1, 1]; // take the coefficient of the n-th power of t@
223  matrix CF=coeffs(rez, z@); // take the matrix of the coefficients
224  list res; // and transform it to a list
225  int d=size(CF);
226  for(i=1; i<=d; i++)
227  {
228    res=res+ list(int(CF[i, 1])) ;
229  }
230  setring br@; // come back to the initial base ring
231  return(res);
232}
233example
234{
235  "EXAMPLE:"; echo=2;
236  ring r=0, (z), ls;
237  // consider the projective plane P_2 with Betti numbers 1,0,1,0,1
238  list b=1,0,1,0,1;
239  // get the Betti numbers of the Hilbert scheme of 3 points on P_2
240  print( BettiNumsH(3, b) );
241}
242//----------------------------------------------------------
243
244proc NakYoshF(poly z, poly t, int r, int n)
245"USAGE:   NakYoshF(z, t, r, n);  z, t polynomials, r, n integers
246RETURN:   polynomial in z and t
247PURPOSE:  computes the formula of Nakajima and Yoshioka
248          up to degree n in t
249EXAMPLE:  example NakYoshF; shows an example
250NOTE:     zero is returned if n<0 or r<=0
251"
252{
253  // check the input data
254  if(n<0)
255  {
256    print("the number of points must be non-negative");
257    print("zero polynomial is returned");
258    return( poly(0) );
259  }
260  if(r<=0)
261  {
262    print("r must be positive");
263    print("zero polynomial is returned");
264    return( poly(0) );
265  }
266  // now n is non-negative and r is positive
267  def br@=basering; // remember the base ring
268  // add additional variables z@, t@ to the base ring
269  ring r@ = create_ring(ringlist(basering)[1], "("+varstr(basering)+", z@, t@)", "dp", "no_minpoly");
270  execute( "map F= br@,"+varstr(br@)+";" ); // define the corresponding inclusion of rings
271  // compute the generating function by the Nakajima-Yoshioka formula up to degree n in t@
272  poly rez=1;
273  int k,i;
274  ideal I=std(t@^(n+1));
275  for(k=1;k<=n;k++)
276  {
277    for(i=1;i<=r;i++)
278    {
279      rez=NF( rez*generFactor( z@^(2*(r*k-i))*t@^k, k, 0, 1, n), I);
280    }
281  }
282  setring br@; // come back to the initial base ring
283  // define the specialization homomorphism z@=z, t@=t
284  execute( "map FF= r@,"+varstr(br@)+", z, t;" );
285  poly rez=FF(rez); // bring the result to the base ring
286  return(rez);
287}
288example
289{
290  "EXAMPLE:"; echo=2;
291  ring r=0, (t, z), ls;
292  // get the Nakajima-Yoshioka formula for r=1 up to degree 3, i.e.,
293  // the generating function for the Poincare polynomials of the
294  // punctual Hilbert schemes of n planar points
295  print( NakYoshF(z, t, 1, 3) );
296}
297//----------------------------------------------------------
298
299proc PPolyQp(poly z, int r, int n)
300"USAGE:   PPolyQp(z, r, n);  z polynomial, r, n integers
301RETURN:   polynomial in z
302PURPOSE:  computes the Poincare polynomial of the punctual Quot-scheme
303          of rank r on n planar points
304EXAMPLE:  example PPolyQp; shows an example
305NOTE:     zero is returned if n<0 or r<=0
306"
307{
308  // check the input data
309  if(n<0)
310  {
311    print("the number of points must be non-negative");
312    print("zero polynomial is returned");
313    return( poly(0) );
314  }
315  if(r<=0)
316  {
317    print("r must be positive");
318    print("zero polynomial is returned");
319    return( poly(0) );
320  }
321  // now n is non-negative and r is positive
322  def br@=basering; // remember the base ring
323  // add additional variables z@, t@ to the base ring
324  ring r@ = create_ring(ringlist(basering)[1], "("+varstr(basering)+", z@, t@)", "dp", "no_minpoly");
325  execute( "map F= br@,"+varstr(br@)+";" ); // define the corresponding inclusion of rings
326  // compute the generating function by the Nakajima-Yoshioka formula up to degree n in t@
327  poly rez=1;
328  int k,i;
329  ideal I=std(t@^(n+1));
330  for(k=1;k<=n;k++)
331  {
332    for(i=1;i<=r;i++)
333    {
334      rez=NF(rez*generFactor( z@^(2*(r*k-i))*t@^k, k, 0, 1, n), I);
335    }
336  }
337  rez= coeffs(rez, t@)[n+1, 1]; // take the coefficient of the n-th power of t@
338  setring br@; // come back to the initial base ring
339  // define the specialization homomorphism z@=z, t@=0
340  execute( "map FF= r@,"+varstr(br@)+",z, 0;" );
341  poly rez=FF(rez); // bring the result to the base ring
342  return(rez);
343}
344example
345{
346  "EXAMPLE:"; echo=2;
347  ring r=0, (z), ls;
348  // get the Poincare polynomial of the punctual Hilbert scheme (r=1)
349  // of 3 planar points
350  print( PPolyQp(z, 1, 3) );
351}
352//----------------------------------------------------------
353
354proc BettiNumsQp(int r, int n)
355"USAGE:   BettiNumsQp(r, n);  n, r integers
356RETURN:   list of non-negative integers
357PURPOSE:  computes the Betti numbers of the punctual Quot-scheme
358          of rank r on n points on a plane
359EXAMPLE:  example BettiNumsQp; shows an example
360NOTE:     an empty list is returned if n<0 or r<=0
361"
362{
363  // check the input data
364  if(n<0)
365  {
366    print("the number of points must be non-negative");
367    print("zero polynomial is returned");
368    return( poly(0) );
369  }
370  if(r<=0)
371  {
372    print("r must be positive");
373    print("zero polynomial is returned");
374    return( poly(0) );
375  }
376  // now n is non-negative and r is positive
377  def br@=basering; // remember the base ring
378  // add additional variables z@, t@ to the base ring
379  ring r@ = create_ring(ringlist(basering)[1], "("+varstr(basering)+", z@, t@)", "dp", "no_minpoly");
380  execute( "map F= br@,"+varstr(br@)+";" ); // define the corresponding inclusion of rings
381  poly rez=1;
382  int k,i;
383  ideal I=std(t@^(n+1));
384  for(k=1;k<=n;k++)
385  {
386    for(i=1;i<=r;i++)
387    {
388      rez=NF(rez*generFactor( z@^(2*(r*k-i))*t@^k, k, 0, 1, n), I);
389    }
390  }
391  rez= coeffs(rez, t@)[n+1, 1]; // take the coefficient of the n-th power of t@
392  matrix CF=coeffs(rez, z@); // take the matrix of the coefficients
393  list res; // and transform it to a list
394  int d=size(CF);
395  for(i=1; i<=d; i++)
396  {
397    res=res+ list(int(CF[i, 1])) ;
398  }
399  setring br@; // come back to the initial base ring
400  return(res);
401}
402example
403{
404  "EXAMPLE:"; echo=2;
405  ring r=0, (z), ls;
406  // get the Betti numbers of the punctual Hilbert scheme (r=1)
407  // of 3 points on a plane
408  print( BettiNumsQp(1, 3) );
409}
410//----------------------------------------------------------
411
412proc MacdonaldF(poly z, poly t, int n, list b)
413"USAGE:   MacdonaldF(z, t, n, b);  z, t polynomials, n integer, b list of non-negative integers
414RETURN:   polynomial in z and t with integer coefficients
415PURPOSE:  computes the Macdonalds's formula up to degree n in t
416EXAMPLE:  example MacdonaldF; shows an example
417NOTE:     zero is returned if n<0 or b is not a list of non-negative integers
418"
419{
420  // check the input data
421  if( !checkBetti(b) )
422  {
423    print("the Betti numbers must be non-negative integers");
424    print("zero polynomial is returned");
425    return( poly(0) );
426  }
427  if(n<0)
428  {
429    print("the exponent of the symmetric power must be non-negative");
430    print("zero polynomial is returned");
431    return( poly(0) );
432  }
433  int d=size(b);
434  def br@=basering; // remember the base ring
435  // add additional variables z@, t@ to the base ring
436  ring r@ = create_ring(ringlist(basering)[1], "("+varstr(basering)+", z@, t@)", "dp", "no_minpoly");
437  execute( "map F= br@,"+varstr(br@)+";" ); // define the corresponding inclusion of rings
438  poly rez=1;
439  int i;
440  ideal I=std(t@^(n+1));
441  for(i=0;i<d;i++)
442  {
443      rez=NF(rez*generFactor( z@^i*t@, 1, i, b[i+1], n), I);
444  }
445  setring br@; // come back to the initial base ring
446  // define the specialization homomorphism z@=z, t@=t
447  execute( "map FF= r@,"+varstr(br@)+",z, t;" );
448  poly rez=FF(rez); // bring the result to the base ring
449  return(rez);
450}
451example
452{
453  "EXAMPLE:"; echo=2;
454  ring r=0, (t, z), ls;
455  // consider the projective plane with Betti numbers 1,0,1,0,1
456  list b=1,0,1,0,1;
457  // get the Macdonald's formula up to degree 3
458  print( MacdonaldF(z, t, 3, b) );
459}
460//----------------------------------------------------------
461
462proc PPolyS(poly z, int n, list b)
463"USAGE:   PPolyS(z, n, b);  z polynomial, n integer, b list of non-negative integers
464RETURN:   polynomial in z with integer coefficients
465PURPOSE:  computes the Poincare polynomial of the n-th symmetric power
466          of a variety with Betti numbers b
467EXAMPLE:  example PPolyS; shows an example
468NOTE:     zero is returned if n<0 or b is not a list of non-negative integers
469"
470{
471  // check the input data
472  if( !checkBetti(b) )
473  {
474    print("the Betti numbers must be non-negative integers");
475    print("zero polynomial is returned");
476    return( poly(0) );
477  }
478  if(n<0)
479  {
480    print("the exponent of the symmetric power must be non-negative");
481    print("zero polynomial is returned");
482    return( poly(0) );
483  }
484  int d=size(b);
485  def br@=basering; // remember the base ring
486  // add additional variables z@, t@ to the base ring
487  ring r@ = create_ring(ringlist(basering)[1], "("+varstr(basering)+", z@, t@)", "dp", "no_minpoly");
488  execute( "map F= br@,"+varstr(br@)+";" ); // define the corresponding inclusion of rings
489  poly rez=1;
490  int i;
491  ideal I=std(t@^(n+1));
492  for(i=0;i<d;i++)
493  {
494    rez=NF(rez*generFactor( z@^i*t@, 1, i, b[i+1], n), I);
495  }
496  rez= coeffs(rez, t@)[n+1, 1]; // take the coefficient of the n-th power of t@
497  setring br@; // come back to the initial base ring
498  // define the specialization homomorphism z@=z, t@=0
499  execute( "map FF= r@,"+varstr(br@)+",z, 0;" );
500  poly rez=FF(rez); // bring the result to the base ring
501  return(rez);
502}
503example
504{
505  "EXAMPLE:"; echo=2;
506  ring r=0, (z), ls;
507  // consider the projective plane P_2 with Betti numbers 1,0,1,0,1
508  list b=1,0,1,0,1;
509  // get the Poincare polynomial of the third symmetric power of P_2
510  print( PPolyS(z, 3, b) );
511}
512//----------------------------------------------------------
513
514proc BettiNumsS(int n, list b)
515"USAGE:   BettiNumsS(n, b);  n integer, b list of non-negative integers
516RETURN:   list of non-negative integers
517PURPOSE:  computes the Betti numbers of the n-th symmetric power of a variety with Betti numbers b
518EXAMPLE:  example BettiNumsS; shows an example
519NOTE:     an empty list is returned if n<0 or b is not a list of non-negative integers
520"
521{
522  // check the input data
523  if( !checkBetti(b) )
524  {
525    print("the Betti numbers must be non-negative integers");
526    print("an empty list is returned");
527    return( list() );
528  }
529  if(n<0)
530  {
531    print("the exponent of the symmetric power must be non-negative");
532    print("an empty list is returned");
533    return(list());
534  }
535  int d=size(b);
536  def br@=basering; // remember the base ring
537  // add additional variables z@, t@ to the base ring
538  ring r@ = create_ring(ringlist(basering)[1], "("+varstr(basering)+", z@, t@)", "dp", "no_minpoly");
539  execute( "map F= br@,"+varstr(br@)+";" ); // define the corresponding inclusion of rings
540  poly rez=1;
541  int i;
542  ideal I=std(t@^(n+1));
543  for(i=0;i<d;i++)
544  {
545      rez=NF(rez*generFactor( z@^i*t@, 1, i, b[i+1], n), I);
546  }
547  rez= coeffs(rez, t@)[n+1, 1]; // take the coefficient of the n-th power of t@
548  matrix CF=coeffs(rez, z@); // take the matrix of the coefficients
549  list res; // and transform it to a list
550  d=size(CF);
551  for(i=1; i<=d; i++)
552  {
553    res=res+ list(int(CF[i, 1])) ;
554  }
555  setring br@; // come back to the initial base ring
556  return(res);
557}
558example
559{
560  "EXAMPLE:"; echo=2;
561  ring r=0, (z), ls;
562  // consider a complex torus T (elliptic curve) with Betti numbers 1,2,1
563  list b=1,2,1;
564  // get the Betti numbers of the second symmetric power of T
565  print( BettiNumsS(2, b) );
566  // consider a projective plane P_2 with Betti numbers 1,0,1,0,1
567  b=1,0,1,0,1;
568  // get the Betti numbers of the third symmetric power of P_2
569  print( BettiNumsS(3, b) );
570}
571//----------------------------------------------------------
572
573proc PPolyN(poly t, int q, int m, int n)
574"USAGE:   PPolyN(t, q, m, n);  t polynomial, q, m, n integers
575RETURN:   polynomial in t
576PURPOSE:  computes the Poincare polynomial of the moduli space
577          of Kronecker modules N(q; m, n)
578EXAMPLE:  example PPolyN; shows an example
579NOTE:     if m and n are not coprime, the result does not necessary make sense
580"
581{
582  int d=dimKron(q, m, n);
583  if(d<0)
584  {
585    return(0);
586  }
587  if(gcd(m, n)!=1)
588  {
589    "You are trying to compute the Poincare polynomial";
590    "of the moduli space of Kronecker modules N("+string(q)+"; "+string(m)+", "+string(n)+").";
591    "Notice that gcd(m,n)=1 is expected to get the correct Poincare polynomial";
592    "of the moduli space N(q; m, n)!";
593  }
594  def br@=basering; // remember the base ring
595  // add additional variable t@ to the base ring
596  ring r@ = create_ring(ringlist(basering)[1], "("+varstr(basering)+", t@)", "dp", "no_minpoly");
597  execute( "map F= br@,"+varstr(br@)+";" ); // define the corresponding inclusion of rings
598  poly rez=(1-t@^2)*PPolyW(q, m, n, t@, d);
599  ideal I=t@^(2*d+1);
600  rez=NF(rez, I);
601  setring br@; // come back to the initial base ring
602  // define the specialization homomorphism t@=t
603  execute( "map FF= r@,"+varstr(br@)+", t;" );
604  poly rez=FF(rez); // bring the result to the base ring
605  return(rez);
606}
607example
608{
609  "EXAMPLE:"; echo=2;
610  ring r=0, (t), ls;
611  // get the Poincare polynomial of N(3; 2, 3)
612  print( PPolyN(t, 3, 2, 3) );
613}
614//----------------------------------------------------------
615
616proc BettiNumsN(int q, int m, int n)
617"USAGE:   BettiNumsN(q, m, n);  q, m, n integers
618RETURN:   list of integers
619PURPOSE:  computes the Betti numbers of the moduli space
620          of Kronecker modules N(q; m, n)
621EXAMPLE:  example BettiNumsN; shows an example
622NOTE:     if m and n are not coprime, the result does not necessary make sense
623"
624{
625  int d=dimKron(q, m, n);
626  if(d<0)
627  {
628    return(0);
629  }
630  if(gcd(m, n)!=1)
631  {
632    "You are trying to compute the Poincare polynomial";
633    "of the moduli space of Kronecker modules N("+string(q)+"; "+string(m)+", "+string(n)+").";
634    "Notice that gcd(m,n)=1 is expected to get the correct Poincare polynomial";
635    "of the moduli space N(q; m, n)!";
636  }
637  def br@=basering; // remember the base ring
638  // add additional variable t@ to the base ring
639  ring r@ = create_ring(ringlist(basering)[1], "("+varstr(basering)+", t@)", "dp", "no_minpoly");
640  execute( "map F= br@,"+varstr(br@)+";" ); // define the corresponding inclusion of rings
641  poly rez=(1-t@^2)*PPolyW(q, m, n, t@, d);
642  ideal I=t@^(2*d+1);
643  rez=NF(rez, I);
644  matrix CF=coeffs(rez, t@); // take the matrix of the coefficients
645  list res; // and transform it to a list
646  d=size(CF);
647  int i;
648  for(i=1; i<=d; i++)
649  {
650    res=res + list(int(CF[i, 1])) ;
651  }
652  setring br@; // come back to the initial base ring
653  return(res);
654}
655example
656{
657  "EXAMPLE:"; echo=2;
658  ring r=0, (t), dp;
659  // get the Betti numbers of N(3; 2, 3)
660  print( BettiNumsN(3, 2, 3) );
661}
662//----------------------------------------------------------------------------------------
663// The procedures below are for the internal usage only
664//----------------------------------------------------------------------------------------
665
666static proc checkBetti(list b)
667"USAGE:   checkBetti(b);  b list of integers
668RETURN:   integer 1 or 0
669PURPOSE:  checks whether all entries of b are non-negative integers
670EXAMPLE:  example checkBetti; shows an example
671NOTE:
672"
673{
674  int i;
675  int sz=size(b);
676  for(i=1;i<=sz;i++)
677  {
678    if( typeof(b[i])!="int" )
679    {
680      return(int(0));
681    }
682    if( b[i]<0 )
683    {
684      return(int(0));
685    }
686  }
687  return(int(1));
688}
689example
690{
691  "EXAMPLE:"; echo=2;
692  ring r=0, (t), dp;
693  // not all entries are integers
694  list b=1,0,t,0,1;
695  print(checkBetti(b));
696  // all entries are integers but not all are non-negative
697  list b=1,0,-1,0,1;
698  print(checkBetti(b));
699  // all entries are non-negative integers
700  list b=1,0,1,0,1;
701  print(checkBetti(b));
702}
703//----------------------------------------------------------
704
705static proc generFactor(poly X, int k, int i, int b, int n)
706"USAGE:   generFactor;  X polynomial, k, b, n integers
707RETURN:   polynomial
708PURPOSE:  computes the corresponding factor from Goettsche's formula
709EXAMPLE:  example generFactor; shows an example
710NOTE:
711"
712{
713  poly rez=0;
714  int j;
715  int pow;
716  pow=(-1)^(i+1)*b;
717  if(pow > 0)
718  {
719    rez=(1+X)^pow;
720  }
721  else
722  {
723    int m=n div k + 1;
724    for(j=0;j<m;j++)
725    {
726      rez=rez+ X^j;
727    }
728    rez=rez^(-pow);
729  }
730  return(rez);
731}
732example
733{
734  "EXAMPLE:"; echo=2;
735  ring r=0, (t), ds;
736  // get the polynomial expansion of 1/(1-t)^2
737  // using the Taylor expansion of 1/(1-t) up to degree 11
738  // and assuming that the degree of t is 3
739  print( generFactor(t, 3, 0, 2, 11) );
740}
741//----------------------------------------------------------------------------------------
742// The procedures below are related to the Kronecker modules
743//----------------------------------------------------------------------------------------
744
745static proc PPolyW(int q, int m, int n, poly t, int d, list #)
746{
747  // without loss of generality assume that m >= n
748  int N;
749  int M;
750  if(n>m)
751  {
752    M = n;
753    N = m;
754  }
755  else
756  {
757    M = m;
758    N = n;
759  }
760  // now M >= N;
761  int i;
762  int j;
763  list plg;// will be the matrix-list with all the data
764  list newPlg;// will be used for computation of new entries of plg
765  // initial intitialization of plg, M entries
766  for(i=1;i<=M;i++)
767  {
768    plg = plg + list( list()   );
769  }
770  int ii;
771  int jj;
772  int st;
773  list P;
774  list PP;
775  int c;
776  int sz;
777  int pow;
778  poly pterm;
779  poly rez;// to be the result
780  ideal I=t^(2*d+1);
781  // starting in the bottom row, moving from left to right and from the bottom upwards
782  for(j=0;j<=N;j++)
783  {
784    for(i=max(j, 1);i<=M;i++)
785    {
786      // for each entry compute the relevant data inductively
787      // add the trivial polygon
788      newPlg = list( list( list( list(int(0), int(0)), list(i, j)) , poly(0),  int(0) ) );
789      // first summand in the Drezet's formula
790      if(j==0)// if in the bottom row
791      {
792        if(i==1)
793        {
794          rez=geomS(t^2, d);
795        }
796        else
797        {
798          rez=plg[i-1][1][1][2]*geomS(t^(2*i), d div i );
799        }
800      }
801      else// otherwise use the values from the bottom row
802      {
803        rez=plg[i][1][1][2]*plg[j][1][1][2];
804      }
805      rez=NF(rez, I);// throw away the higher powers
806      //inductively compute the polygons
807      for(ii = 0; ii <= i; ii++)
808      {
809        st= ((j*ii) div  i) + 1;
810        for(jj = st; jj <= j; jj++)
811        {
812          PP=list();// to be the list of polygons that will be added
813          P = plg[i-ii][j-jj+1];// list of smaller polygons
814          sz=size(P);
815          for(c=1;c<=sz;c++)// for every smaller polygon
816          {
817            if( jj*P[c][1][2][1]-P[c][1][2][2]*ii > 0  )// if the slopes fit
818            {
819              pow =  P[c][3]+  jj*( q*(i-ii)-(j-jj)  )-ii*(i-ii);// get the corresponding power
820              // and the corresponding product
821              pterm = NF(P[c][2]* plg[max(ii,jj)][min(ii,jj)+1][1][2], I);
822              // and add the data to PP
823              PP = PP + list(list(list(list(int(0),int(0))) + shift(P[c][1],ii,jj),pterm,pow));
824              // throw away the summands from the polygons with non-admissible slopes and pow<0
825              if(pterm!=0)
826              {
827                rez=rez-t^(2*pow) * pterm;// add the next summand
828              }
829            }
830          }
831          newPlg=newPlg + PP;// add the new polygons to the list
832        }
833      }
834      rez=NF(rez, I);// throw away the higher powers
835      newPlg[1][2]=rez;// set the polynomial corresponding to the trivial polygon
836      plg[i]=plg[i]+list(newPlg);// add the new data
837      // now all the data for (i, j) have been computed
838    }
839  }
840  if(size(#)==0)// if there are no optional parameters
841  {
842    return(plg[M][N+1][1][2]);// return the polynomial of the upper right entry
843  }
844  else// otherwise return all the computed data
845  {
846    return(plg);
847  }
848}
849//----------------------------------------------------------
850
851static proc dimKron(int q, int m, int n)
852{
853  if( (q<3)||(m<0)||(n<0) )
854  {
855    "Check the input data!";
856    "It is expected that for the moduli space of Kronecker modules N(q; m, n)";
857    "q >= 3, m >= 0, n >= 0.";
858    return(int(-1));
859  }
860  int ph=m^2+n^2-q*m*n;
861  if(ph<0)
862  {
863    return(1-ph);
864  }
865  int g=gcd(m, n);
866  if(g==0)
867  {
868    return(int(-1));
869  }
870  m = m div g;
871  n = n div g;
872  ph = m^2+n^2-q*m*n;
873  if(ph==1)
874  {
875    return(int(0));
876  }
877  else
878  {
879    return(int(-1));
880  }
881}
882//----------------------------------------------------------
883
884static proc shift(list l, int a, int b)
885{
886  int sz=size(l);
887  int i;
888  for(i=1;i<=sz;i++)
889  {
890    l[i][1]=l[i][1]+a;
891    l[i][2]=l[i][2]+b;
892  }
893  return(l);
894}
895//----------------------------------------------------------
896
897static proc geomS(poly t, int d)
898{
899  poly rez=1;
900  int i;
901  for(i=1;i<=d;i++)
902  {
903    rez=rez+t^i;
904  }
905  return(rez);
906}
907//----------------------------------------------------------
Note: See TracBrowser for help on using the repository browser.