source: git/Singular/LIB/schubert.lib

spielwiese
Last change on this file was 1e1990, checked in by Frédéric Chapoton <chapoton@…>, 17 months ago
fixing various typos (found using egrep)
  • Property mode set to 100644
File size: 72.2 KB
Line 
1////////////////////////////////////////////////////////////////////////////////
2version="version schubert.lib 4.2.0.1 Jan_2021 "; // $Id$
3category="Algebraic Geometry";
4info="
5LIBRARY:    schubert.lib    Procedures for Intersection Theory
6
7AUTHOR:     Hiep Dang,          email: hiep@mathematik.uni-kl.de
8
9OVERVIEW:
10
11    We implement new classes (variety, sheaf, stack, graph) and methods for
12    computing with them. An abstract variety is represented by a nonnegative
13    integer which is its dimension and a graded ring which is its Chow ring.
14    An abstract sheaf is represented by a variety and a polynomial which is its
15    Chern character. In particular, we implement the concrete varieties such as
16    projective spaces, Grassmannians, and projective bundles.
17
18    An important task of this library is related to the computation of
19    Gromov-Witten invariants. In particular, we implement new tools for the
20    computation in equivariant intersection theory. These tools are based on the
21    localization of moduli spaces of stable maps and Bott's formula. They are
22    useful for the computation of Gromov-Witten invariants. In order to do this,
23    we have to deal with moduli spaces of stable maps, which were introduced by
24    Kontsevich, and the graphs corresponding to the fixed point components of a
25    torus action on the moduli spaces of stable maps.
26
27    As an insightful example, the numbers of rational curves on general complete
28    intersection Calabi-Yau threefolds in projective spaces are computed up to
29    degree 6. The results are all in agreement with predictions made from mirror
30    symmetry computations.
31
32REFERENCES:
33
34    Hiep Dang,  Intersection theory with applications to the computation of
35                Gromov-Witten invariants, Ph.D thesis, TU Kaiserslautern, 2013.
36
37    Sheldon Katz and Stein A. Stromme, Schubert-A Maple package for intersection
38                theory and enumerative geometry, 1992.
39
40    Daniel R. Grayson, Michael E. Stillman, Stein A. Stromme, David Eisenbud and
41    Charley Crissman, Schubert2-A Macaulay2 package for computation in
42                intersection theory, 2010.
43
44    Maxim Kontsevich, Enumeration of rational curves via torus actions, 1995.
45
46PROCEDURES:
47    makeVariety(int,ideal)              create a variety
48    printVariety(variety)               print procedure for a variety
49    productVariety(variety,variety)     make the product of two varieties
50    ChowRing(variety)                   create the Chow ring of a variety
51    Grassmannian(int,int)               create a Grassmannian as a variety
52    projectiveSpace(int)                create a projective space as a variety
53    projectiveBundle(sheaf)             create a projective bundle as a variety
54    integral(variety,poly)              degree of a 0-cycle on a variety
55    makeSheaf(variety,poly)             create a sheaf
56    printSheaf(sheaf)                   print procedure for sheaves
57    rankSheaf(sheaf)                    return the rank of a sheaf
58    totalChernClass(sheaf)              compute the total Chern class of a sheaf
59    ChernClass(sheaf,int)               compute the k-th Chern class of a sheaf
60    topChernClass(sheaf)                compute the top Chern class of a sheaf
61    totalSegreClass(sheaf)              compute the total Segre class of a sheaf
62    dualSheaf(sheaf)                    make the dual of a sheaf
63    tensorSheaf(sheaf,sheaf)            make the tensor of two sheaves
64    symmetricPowerSheaf(sheaf,int)      make the k-th symmetric power of a sheaf
65    quotSheaf(sheaf,sheaf)              make the quotient of two sheaves
66    addSheaf(sheaf,sheaf)               make the direct sum of two sheaves
67    makeGraphVE(list,list)              create a graph from a list of vertices
68                                        and a list of edges
69    printGraphG(graph)                   print procedure for graphs
70    moduliSpace(variety,int)            create a moduli space of stable maps as
71                                        an algebraic stack
72    printStack(stack)                   print procedure for stacks
73    dimStack(stack)                     compute the dimension of a stack
74    fixedPoints(stack)                  compute the list of graphs corresponding
75                                        the fixed point components of a torus
76                                        action on the stack
77    contributionBundle(stack,graph)     compute the contribution bundle on a
78                                        stack at a graph
79    normalBundle(stack,graph)           compute the normal bundle on a stack at
80                                        a graph
81    multipleCover(int)                  compute the contribution of multiple
82                                        covers of a smooth rational curve as a
83                                        Gromov-Witten invariant
84    linesHypersurface(int)              compute the number of lines on a general
85                                        hypersurface
86    rationalCurve(int,list)             compute the Gromov-Witten invariant
87                                        corresponding the number of rational
88                                        curves on a general Calabi-Yau threefold
89    sumofquotients(stack,list)          prepare a command for parallel
90                                        computation
91    homog_part(poly,int)                compute a homogeneous component of a
92                                        polynomial.
93    homog_parts(poly,int,int)           compute the sum of homogeneous
94                                        components of a polynomial
95    logg(poly,int)                      compute Chern characters from total
96                                        Chern classes.
97    expp(poly,int)                      compute total Chern classes from Chern
98                                        characters
99    SchubertClass(list)                 compute the Schubert classes on a
100                                        Grassmannian
101    dualPartition(list)                 compute the dual of a partition
102
103KEYWORDS:       Intersection theory; Enumerative geometry; Schubert calculus;
104                Bott's formula; Gromov-Witten invariants.
105
106";
107
108////////////////////////////////////////////////////////////////////////////////
109
110LIB "general.lib";
111LIB "homolog.lib";
112LIB "parallel.lib";
113LIB "ring.lib";
114
115////////////////////////////////////////////////////////////////////////////////
116/////////// create new objects in this library  ////////////////////////////////
117////////////////////////////////////////////////////////////////////////////////
118
119static proc mod_init()
120{
121    newstruct("variety","int dimension, ring baseRing, ideal relations");
122    newstruct("sheaf","variety currentVariety, poly ChernCharacter");
123    newstruct("graph","list vertices, list edges");
124    newstruct("stack","variety currentVariety, int degreeCurve");
125
126    system("install","variety","print",printVariety,1);
127    system("install","variety","*",productVariety,2);
128    system("install","sheaf","print",printSheaf,1);
129    system("install","sheaf","*",tensorSheaf,2);
130    system("install","sheaf","+",addSheaf,2);
131    system("install","sheaf","-",quotSheaf,2);
132    system("install","sheaf","^",symmetricPowerSheaf,2);
133    system("install","graph","print",printGraphG,1);
134    system("install","stack","print",printStack,1);
135}
136
137////////////////////////////////////////////////////////////////////////////////
138//////// Procedures concerned with moduli spaces of stable maps ////////////////
139////////////////////////////////////////////////////////////////////////////////
140
141proc printStack(stack M)
142"USAGE:     printStack(M); M stack
143ASSUME:     M is a moduli space of stable maps.
144THEORY:     This is the print function used by Singular to print a stack.
145KEYWORDS:   stack, moduli space of stable maps
146EXAMPLE:    example printStack; shows an example
147"
148{
149    "A moduli space of dimension", dimStack(M);
150}
151example
152{
153    "EXAMPLE:"; echo=2;
154    ring r = 0,(x),dp;
155    variety P = projectiveSpace(4);
156    stack M = moduliSpace(P,2);
157    M;
158}
159
160proc moduliSpace(variety V, int d)
161"USAGE:     moduliSpace(V,d); V variety, d int
162ASSUME:     V is a projective space and d is a positive integer.
163THEORY:     This is the function used by Singular to create a moduli space of
164            stable maps from a genus zero curve to a projective space.
165KEYWORDS:   stack, moduli space of stable maps, rational curves
166EXAMPLE:    example moduliSpace; shows an example
167"
168{
169    stack M;
170    M.currentVariety = V;
171    M.degreeCurve = d;
172    return(M);
173}
174example
175{
176    "EXAMPLE:"; echo=2;
177    ring r = 0,(x),dp;
178    variety P = projectiveSpace(4);
179    stack M = moduliSpace(P,2);
180    M;
181}
182
183proc dimStack(stack M)
184"USAGE:     dimStack(M); M stack
185RETURN:     int
186INPUT:      M is a moduli space of stable maps.
187OUTPUT:     the dimension of moduli space of stable maps.
188KEYWORDS:   dimension, moduli space of stable maps, rational curves
189EXAMPLE:    example dimStack; shows an example
190"
191{
192    variety V = M.currentVariety;
193    int n = V.dimension;
194    int d = M.degreeCurve;
195    return (n*d+n+d-3);
196}
197example
198{
199    "EXAMPLE:"; echo=2;
200    ring r = 0,(x),dp;
201    variety P = projectiveSpace(4);
202    stack M = moduliSpace(P,2);
203    dimStack(M);
204}
205
206proc fixedPoints(stack M)
207"USAGE:     fixedPoints(M); M stack
208RETURN:     list
209INPUT:      M is a moduli space of stable maps.
210OUTPUT:     a list of graphs corresponding the fixed point components of a torus
211            action on a moduli space of stable maps.
212KEYWORDS:   fixed points, moduli space of stable maps, graph
213EXAMPLE:    example fixedPoints; shows an example
214"
215{
216    int i,j,k,h,m,n,p,q;
217    list l;
218    int d = M.degreeCurve;
219    variety V = M.currentVariety;
220    int r = V.dimension;
221    for (i=0;i<=r;i++)
222    {
223        for (j=0;j<=r;j++)
224        {
225            if (i <> j)
226            {
227                l[size(l)+1] = list(graph1(d,i,j),2*d);
228            }
229        }
230    }
231    if (d == 2)
232    {
233        for (i=0;i<=r;i++)
234        {
235            for (j=0;j<=r;j++)
236            {
237                for (k=0;k<=r;k++)
238                {
239                    if (i <> j and j <> k)
240                    {
241                        l[size(l)+1] = list(graph2(list(1,1),i,j,k),2);
242                    }
243                }
244            }
245        }
246    }
247    if (d == 3)
248    {
249        for (i=0;i<=r;i++)
250        {
251            for (j=0;j<=r;j++)
252            {
253                for (k=0;k<=r;k++)
254                {
255                    if (i <> j and j <> k)
256                    {
257                        l[size(l)+1] = list(graph2(list(2,1),i,j,k),2);
258                        for (h=0;h<=r;h++)
259                        {
260                            if (h <> k)
261                            {
262                                l[size(l)+1] = list(graph31(list(1,1,1),i,j,k,h),2);
263                            }
264                            if (h <> j)
265                            {
266                                l[size(l)+1] = list(graph32(list(1,1,1),i,j,k,h),6);
267                            }
268                        }
269                    }
270                }
271            }
272        }
273    }
274    if (d == 4)
275    {
276        for (i=0;i<=r;i++)
277        {
278            for (j=0;j<=r;j++)
279            {
280                for (k=0;k<=r;k++)
281                {
282                    if (i <> j and j <> k)
283                    {
284                        l[size(l)+1] = list(graph2(list(3,1),i,j,k),3);
285                        l[size(l)+1] = list(graph2(list(2,2),i,j,k),8);
286                        for (h=0;h<=r;h++)
287                        {
288                            if (h <> k)
289                            {
290                                l[size(l)+1] = list(graph31(list(2,1,1),i,j,k,h),2);
291                                l[size(l)+1] = list(graph31(list(1,2,1),i,j,k,h),4);
292                            }
293                            if (h <> j)
294                            {
295                                l[size(l)+1] = list(graph32(list(2,1,1),i,j,k,h),4);
296                            }
297                            for (m=0;m<=r;m++)
298                            {
299                                if (k <> h and m <> h)
300                                {
301                                    l[size(l)+1] = list(graph41(list(1,1,1,1),i,j,k,h,m),2);
302                                }
303                                if (k <> h and m <> k)
304                                {
305                                    l[size(l)+1] = list(graph42(list(1,1,1,1),i,j,k,h,m),2);
306                                }
307                                if (h <> j and m <> j)
308                                {
309                                    l[size(l)+1] = list(graph43(list(1,1,1,1),i,j,k,h,m),24);
310                                }
311                            }
312                        }
313                    }
314                }
315            }
316        }
317    }
318    if (d == 5)
319    {
320        for (i=0;i<=r;i++)
321        {
322            for (j=0;j<=r;j++)
323            {
324                for (k=0;k<=r;k++)
325                {
326                    if (i <> j and j <> k)
327                    {
328                        l[size(l)+1] = list(graph2(list(4,1),i,j,k),4);
329                        l[size(l)+1] = list(graph2(list(3,2),i,j,k),6);
330                        for (h=0;h<=r;h++)
331                        {
332                            if (k <> h)
333                            {
334                                l[size(l)+1] = list(graph31(list(3,1,1),i,j,k,h),3);
335                                l[size(l)+1] = list(graph31(list(1,3,1),i,j,k,h),6);
336                                l[size(l)+1] = list(graph31(list(2,2,1),i,j,k,h),4);
337                                l[size(l)+1] = list(graph31(list(2,1,2),i,j,k,h),8);
338                            }
339                            if (j <> h)
340                            {
341                                l[size(l)+1] = list(graph32(list(3,1,1),i,j,k,h),6);
342                                l[size(l)+1] = list(graph32(list(2,2,1),i,j,k,h),8);
343                            }
344                            for (m=0;m<=r;m++)
345                            {
346                                if (k <> h and h <> m)
347                                {
348                                    l[size(l)+1] = list(graph41(list(2,1,1,1),i,j,k,h,m),2);
349                                    l[size(l)+1] = list(graph41(list(1,2,1,1),i,j,k,h,m),2);
350                                }
351                                if (k <> h and k <> m)
352                                {
353                                    l[size(l)+1] = list(graph42(list(2,1,1,1),i,j,k,h,m),4);
354                                    l[size(l)+1] = list(graph42(list(1,2,1,1),i,j,k,h,m),4);
355                                    l[size(l)+1] = list(graph42(list(1,1,2,1),i,j,k,h,m),2);
356                                }
357                                if (j <> h and j <> m)
358                                {
359                                    l[size(l)+1] = list(graph43(list(2,1,1,1),i,j,k,h,m),12);
360                                }
361                                for (n=0;n<=r;n++)
362                                {
363                                    if (k <> h and h <> m and m <> n)
364                                    {
365                                        l[size(l)+1] = list(graph51(list(1,1,1,1,1),i,j,k,h,m,n),2);
366                                    }
367                                    if (k <> h and h <> m and h <> n)
368                                    {
369                                        l[size(l)+1] = list(graph52(list(1,1,1,1,1),i,j,k,h,m,n),2);
370                                    }
371                                    if (k <> h and k <> m and k <> n)
372                                    {
373                                        l[size(l)+1] = list(graph53(list(1,1,1,1,1),i,j,k,h,m,n),6);
374                                    }
375                                    if (j <> h and h <> m and h <> n)
376                                    {
377                                        l[size(l)+1] = list(graph54(list(1,1,1,1,1),i,j,k,h,m,n),8);
378                                    }
379                                    if (k <> h and k <> m and h <> n)
380                                    {
381                                        l[size(l)+1] = list(graph55(list(1,1,1,1,1),i,j,k,h,m,n),2);
382                                    }
383                                    if (j <> h and j <> m and j <> n)
384                                    {
385                                        l[size(l)+1] = list(graph56(list(1,1,1,1,1),i,j,k,h,m,n),120);
386                                    }
387                                }
388                            }
389                        }
390                    }
391                }
392            }
393        }
394    }
395    if (d == 6)
396    {
397        for (i=0;i<=r;i++)
398        {
399            for (j=0;j<=r;j++)
400            {
401                for (k=0;k<=r;k++)
402                {
403                    if (i <> j and j <> k)
404                    {
405                        l[size(l)+1] = list(graph2(list(5,1),i,j,k),5);
406                        l[size(l)+1] = list(graph2(list(4,2),i,j,k),8);
407                        l[size(l)+1] = list(graph2(list(3,3),i,j,k),18);
408                        for (h=0;h<=r;h++)
409                        {
410                            if (k <> h)
411                            {
412                                l[size(l)+1] = list(graph31(list(4,1,1),i,j,k,h),4);
413                                l[size(l)+1] = list(graph31(list(1,4,1),i,j,k,h),8);
414                                l[size(l)+1] = list(graph31(list(3,2,1),i,j,k,h),6);
415                                l[size(l)+1] = list(graph31(list(3,1,2),i,j,k,h),6);
416                                l[size(l)+1] = list(graph31(list(1,3,2),i,j,k,h),6);
417                                l[size(l)+1] = list(graph31(list(2,2,2),i,j,k,h),16);
418                            }
419                            if (j <> h)
420                            {
421                                l[size(l)+1] = list(graph32(list(4,1,1),i,j,k,h),8);
422                                l[size(l)+1] = list(graph32(list(3,2,1),i,j,k,h),6);
423                                l[size(l)+1] = list(graph32(list(2,2,2),i,j,k,h),48);
424                            }
425                            for (m=0;m<=r;m++)
426                            {
427                                if (k <> h and h <> m)
428                                {
429                                    l[size(l)+1] = list(graph41(list(3,1,1,1),i,j,k,h,m),3);
430                                    l[size(l)+1] = list(graph41(list(1,3,1,1),i,j,k,h,m),3);
431                                    l[size(l)+1] = list(graph41(list(2,2,1,1),i,j,k,h,m),4);
432                                    l[size(l)+1] = list(graph41(list(2,1,2,1),i,j,k,h,m),4);
433                                    l[size(l)+1] = list(graph41(list(2,1,1,2),i,j,k,h,m),8);
434                                    l[size(l)+1] = list(graph41(list(1,2,2,1),i,j,k,h,m),8);
435                                }
436                                if (k <> h and k <> m)
437                                {
438                                    l[size(l)+1] = list(graph42(list(3,1,1,1),i,j,k,h,m),6);
439                                    l[size(l)+1] = list(graph42(list(1,3,1,1),i,j,k,h,m),6);
440                                    l[size(l)+1] = list(graph42(list(1,1,3,1),i,j,k,h,m),3);
441                                    l[size(l)+1] = list(graph42(list(2,2,1,1),i,j,k,h,m),8);
442                                    l[size(l)+1] = list(graph42(list(1,1,2,2),i,j,k,h,m),8);
443                                    l[size(l)+1] = list(graph42(list(2,1,2,1),i,j,k,h,m),4);
444                                    l[size(l)+1] = list(graph42(list(1,2,2,1),i,j,k,h,m),4);
445                                }
446                                if (j <> h and j <> m)
447                                {
448                                    l[size(l)+1] = list(graph43(list(3,1,1,1),i,j,k,h,m),18);
449                                    l[size(l)+1] = list(graph43(list(2,2,1,1),i,j,k,h,m),16);
450                                }
451                                for (n=0;n<=r;n++)
452                                {
453                                    if (k <> h and h <> m and m <> n)
454                                    {
455                                        l[size(l)+1] = list(graph51(list(2,1,1,1,1),i,j,k,h,m,n),2);
456                                        l[size(l)+1] = list(graph51(list(1,2,1,1,1),i,j,k,h,m,n),2);
457                                        l[size(l)+1] = list(graph51(list(1,1,2,1,1),i,j,k,h,m,n),4);
458                                    }
459                                    if (k <> h and h <> m and h <> n)
460                                    {
461                                        l[size(l)+1] = list(graph52(list(2,1,1,1,1),i,j,k,h,m,n),4);
462                                        l[size(l)+1] = list(graph52(list(1,2,1,1,1),i,j,k,h,m,n),4);
463                                        l[size(l)+1] = list(graph52(list(1,1,2,1,1),i,j,k,h,m,n),4);
464                                        l[size(l)+1] = list(graph52(list(1,1,1,2,1),i,j,k,h,m,n),2);
465                                    }
466                                    if (k <> h and k <> m and k <> n)
467                                    {
468                                        l[size(l)+1] = list(graph53(list(2,1,1,1,1),i,j,k,h,m,n),12);
469                                        l[size(l)+1] = list(graph53(list(1,2,1,1,1),i,j,k,h,m,n),12);
470                                        l[size(l)+1] = list(graph53(list(1,1,2,1,1),i,j,k,h,m,n),4);
471                                    }
472                                    if (j <> h and h <> m and h <> n)
473                                    {
474                                        l[size(l)+1] = list(graph54(list(2,1,1,1,1),i,j,k,h,m,n),4);
475                                        l[size(l)+1] = list(graph54(list(1,1,2,1,1),i,j,k,h,m,n),16);
476                                    }
477                                    if (k <> h and k <> m and h <> n)
478                                    {
479                                        l[size(l)+1] = list(graph55(list(2,1,1,1,1),i,j,k,h,m,n),2);
480                                        l[size(l)+1] = list(graph55(list(1,2,1,1,1),i,j,k,h,m,n),2);
481                                        l[size(l)+1] = list(graph55(list(1,1,1,2,1),i,j,k,h,m,n),4);
482                                    }
483                                    if (j <> h and j <> m and j <> n)
484                                    {
485                                        l[size(l)+1] = list(graph56(list(2,1,1,1,1),i,j,k,h,m,n),48);
486                                    }
487                                    for (p=0;p<=r;p++)
488                                    {
489                                        if (k <> h and h <> m and m <> n and n <> p)
490                                        {
491                                            l[size(l)+1] = list(graph61(list(1,1,1,1,1,1),i,j,k,h,m,n,p),2);
492                                        }
493                                        if (k <> h and h <> m and m <> n and m <> p)
494                                        {
495                                            l[size(l)+1] = list(graph62(list(1,1,1,1,1,1),i,j,k,h,m,n,p),2);
496                                        }
497                                        if (k <> h and h <> m and h <> n and n <> p)
498                                        {
499                                            l[size(l)+1] = list(graph63(list(1,1,1,1,1,1),i,j,k,h,m,n,p),1);
500                                        }
501                                        if (k <> h and h <> m and h <> n and h <> p)
502                                        {
503                                            l[size(l)+1] = list(graph64(list(1,1,1,1,1,1),i,j,k,h,m,n,p),6);
504                                        }
505                                        if (k <> h and k <> m and k <> n and n <> p)
506                                        {
507                                            l[size(l)+1] = list(graph65(list(1,1,1,1,1,1),i,j,k,h,m,n,p),4);
508                                        }
509                                        if (k <> h and k <> m and m <> p and h <> n)
510                                        {
511                                            l[size(l)+1] = list(graph66(list(1,1,1,1,1,1),i,j,k,h,m,n,p),6);
512                                        }
513                                        if (j <> h and h <> m and m <> n and m <> p)
514                                        {
515                                            l[size(l)+1] = list(graph67(list(1,1,1,1,1,1),i,j,k,h,m,n,p),8);
516                                        }
517                                        if (j <> h and h <> m and h <> n and h <> p)
518                                        {
519                                            l[size(l)+1] = list(graph68(list(1,1,1,1,1,1),i,j,k,h,m,n,p),12);
520                                        }
521                                        if (j <> h and h <> m and h <> n and n <> p)
522                                        {
523                                            l[size(l)+1] = list(graph69(list(1,1,1,1,1,1),i,j,k,h,m,n,p),2);
524                                        }
525                                        if (k <> h and k <> m and k <> n and k <> p)
526                                        {
527                                            l[size(l)+1] = list(graph610(list(1,1,1,1,1,1),i,j,k,h,m,n,p),24);
528                                        }
529                                        if (j <> h and j <> m and j <> n and j <> p)
530                                        {
531                                            l[size(l)+1] = list(graph611(list(1,1,1,1,1,1),i,j,k,h,m,n,p),720);
532                                        }
533                                    }
534                                }
535                            }
536                        }
537                    }
538                }
539            }
540        }
541    }
542    return (l);
543}
544example
545{
546    "EXAMPLE:"; echo=2;
547    ring r = 0,x,dp;
548    variety P = projectiveSpace(4);
549    stack M = moduliSpace(P,2);
550    def F = fixedPoints(M);
551    size(F);
552    typeof(F[1]) == "list";
553    typeof(F[1][1]) == "graph";
554    typeof(F[1][2]) == "int";
555}
556
557static proc torusList(variety P)
558"USAGE:     torusList(P); P variety
559RETURN:     list
560INPUT:      P is a projective space
561OUTPUT:     a list of numbers
562THEORY:     This is a procedure concerning the enumeration of rational curves.
563KEYWORDS:   torus action
564EXAMPLE:    example torusList; shows an example
565"
566{
567    int i;
568    int n = P.dimension;
569    list l;
570    for (i=0;i<=n;i++)
571    {
572        l = insert(l,number(10^i),size(l));
573    }
574    return (l);
575}
576example
577{
578    "EXAMPLE:"; echo=2;
579    ring r = 0,x,dp;
580    variety P = projectiveSpace(4);
581    def L = torusList(P);
582    L;
583}
584
585proc contributionBundle(stack M, graph G, list #)
586"USAGE:     contributionBundle(M,G,#); M stack, G graph, # list
587RETURN:     number
588INPUT:      M is a moduli space of stable maps, G is a graph, # is a list.
589OUTPUT:     a number corresponding to the contribution bundle on a moduli space
590            of stable maps at a fixed point component (graph)
591KEYWORDS:   contribution bundle, graph, multiple cover, rational curve,
592SEE ALSO:   normalBundle
593EXAMPLE:    example contributionBundle; shows an example
594"
595{
596    def R = basering;
597    setring R;
598    int i,j,a;
599    variety P = M.currentVariety;
600    def L = torusList(P);
601    int r = P.dimension;
602    int d;
603    if (size(#)==0) {d = 2*r - 3;}
604    else
605    {
606        if (typeof(#[1]) == "int") {d = #[1];}
607        else {Error("invalid optional argument");}
608    }
609    list e = G.edges;
610    list v = G.vertices;
611    number E = 1;
612    number V = 1;
613    if (r == 1)
614    {
615        for (i=1;i<=size(v);i++)
616        {
617            V = V*(-L[v[i][1]+1])^(v[i][2]-1);
618        }
619        for (j=1;j<=size(e);j++)
620        {
621            number f = 1;
622            if (e[j][3]<>1)
623            {
624                for (a=1;a<e[j][3];a++)
625                {
626                    f=f*(-a*L[e[j][1]+1]-(e[j][3]-a)*L[e[j][2]+1])/e[j][3];
627                }
628            }
629            E = E*f;
630            kill f;
631        }
632        return ((E*V)^2);
633    }
634    else
635    {
636        for (i=1;i<=size(v);i++)
637        {
638            V = V*((d*L[v[i][1]+1])^(v[i][2]-1));
639        }
640        for (j=1;j<=size(e);j++)
641        {
642            number f = 1;
643            for (a=0;a<=d*e[j][3];a++)
644            {
645                f = f*((a*L[e[j][1]+1]+(d*e[j][3]-a)*L[e[j][2]+1])/e[j][3]);
646            }
647            E = E*f;
648            kill f;
649        }
650        return (E/V);
651    }
652}
653example
654{
655    "EXAMPLE:"; echo=2;
656    ring r = 0,x,dp;
657    variety P = projectiveSpace(4);
658    stack M = moduliSpace(P,2);
659    def F = fixedPoints(M);
660    graph G = F[1][1];
661    number f = contributionBundle(M,G);
662    number g = contributionBundle(M,G,5);
663    f == g;
664}
665
666proc normalBundle(stack M, graph G)
667"USAGE:     normalBundle(M,G); M stack, G graph
668RETURN:     number
669INPUT:      M is a moduli space of stable maps, G is a graph
670OUTPUT:     a number corresponding to the normal bundle on a moduli space of
671            stable maps at a graph
672KEYWORDS:   normal bundle, graph, rational curves, multiple covers, lines on
673            hypersurfaces
674SEE ALSO:   contributionBundle
675EXAMPLE:    example normalBundle; shows an example
676{
677    def R = basering;
678    setring R;
679    variety P = M.currentVariety;
680    def L = torusList(P);
681    int n = P.dimension;
682    list e = G.edges;
683    list v = G.vertices;
684    int i,j,k,h,b,m,a;
685    number N = 1;
686    for (j=1;j<=size(e);j++)
687    {
688        int d = e[j][3];
689        number c = (-1)^d*factorial(d)^2;
690        number y = c*(L[e[j][1]+1]-L[e[j][2]+1])^(2*d)/(number(d)^(2*d));
691        for (k=0;k<=n;k++)
692        {
693            if (k <> e[j][1] and k <> e[j][2])
694            {
695                for (a=0;a<=d;a++)
696                {
697                    y=y*((a*L[e[j][1]+1]+(d-a)*L[e[j][2]+1])/d - L[k+1]);
698                }
699            }
700        }
701        N = N*y;
702        kill y,d,c;
703    }
704    for (i=1;i<=size(v);i++)
705    {
706        number F = 1;
707        for (h=3;h<=size(v[i]);h++)
708        {
709            F = F*(L[v[i][h][1]+1]-L[v[i][h][2]+1])/v[i][h][3];
710        }
711        if (v[i][2] == 1)
712        {
713            N = N/F;
714            kill F;
715        }
716        else
717        {
718            number z = 1;
719            for (m=0;m<=n;m++)
720            {
721                if (m<>v[i][1])
722                {
723                    z = z*(L[v[i][1]+1]-L[m+1]);
724                }
725            }
726            if (v[i][2] == 3)
727            {
728                N = N*F/z^2;
729                kill F,z;
730            }
731            else
732            {
733                number g = 0;
734                for (b=3;b<=size(v[i]);b++)
735                {
736                    g = g + v[i][b][3]/(L[v[i][b][1]+1]-L[v[i][b][2]+1]);
737                }
738                N = N*F*g^(3-v[i][2])/(z^(v[i][2]-1));
739                kill g,F,z;
740            }
741        }
742    }
743    return (N);
744}
745example
746{
747    "EXAMPLE:"; echo=2;
748    ring r = 0,x,dp;
749    variety P = projectiveSpace(4);
750    stack M = moduliSpace(P,2);
751    def F = fixedPoints(M);
752    graph G = F[1][1];
753    number f = normalBundle(M,G);
754    f <> 0;
755}
756
757proc multipleCover(int d)
758"USAGE:     multipleCover(d); d int
759RETURN:     number
760THEORY:     This is the contribution of degree d multiple covers of a smooth
761            rational curve as a Gromov-Witten invariant.
762KEYWORDS:   Gromov-Witten invariants, multiple covers
763SEE ALSO:   rationalCurve, linesHypersurface
764EXAMPLE:    example multipleCover; shows an example
765"
766{
767    def R = basering;
768    setring R;
769    variety P = projectiveSpace(1);
770    stack M = moduliSpace(P,d);
771    def F = fixedPoints(M);
772    int i;
773    number r = 0;
774    for (i=1;i<=size(F);i++)
775    {
776        graph G = F[i][1];
777        number s = contributionBundle(M,G);
778        number t = F[i][2]*normalBundle(M,G);
779        r = r + s/t;
780        kill s,t,G;
781    }
782    return (r);
783}
784example
785{
786    "EXAMPLE:"; echo=2;
787    ring r = 0,x,dp;
788    multipleCover(1);
789    multipleCover(2);
790    multipleCover(3);
791    multipleCover(4);
792    multipleCover(5);
793    multipleCover(6);
794}
795
796proc linesHypersurface(int n)
797"USAGE:     linesHypersurface(n); n int
798RETURN:     number
799THEORY:     This is the number of lines on a general hypersurface of degree
800            d = 2n-3 in an n-dimensional projective space.
801KEYWORDS:   Gromov-Witten invariants, lines on hypersurfaces
802SEE ALSO:   linesHypersurface, multipleCover
803EXAMPLE:    example linesHypersurface; shows an example
804"
805{
806    def R = basering;
807    setring R;
808    variety P = projectiveSpace(n);
809    stack M = moduliSpace(P,1);
810    def F = fixedPoints(M);
811    int i;
812    number r = 0;
813    for (i=1;i<=size(F);i++)
814    {
815        graph G = F[i][1];
816        number s = contributionBundle(M,G);
817        number t = F[i][2]*normalBundle(M,G);
818        r = r + s/t;
819        kill s,t,G;
820    }
821    return (r);
822}
823example
824{
825    "EXAMPLE:"; echo=2;
826    ring r = 0,x,dp;
827    linesHypersurface(2);
828    linesHypersurface(3);
829    linesHypersurface(4);
830    linesHypersurface(5);
831    linesHypersurface(6);
832    linesHypersurface(7);
833    linesHypersurface(8);
834    linesHypersurface(9);
835    linesHypersurface(10);
836}
837
838proc sumofquotients(stack M, list F, list #)
839"USAGE:     sumofquotient(M,F,#); M stack, F list, # list
840RETURN:     number
841THEORY:     This is useful for the parallel computation of rationalCurve.
842KEYWORDS:   Gromov-Witten invariants, rational curves on Calabi-Yau threefolds
843EXAMPLE:    example sumofquotients; shows an example
844"
845{
846    if (size(#) == 0) {list l = 5;}
847    else {list l = #;}
848    number sum = 0;
849    number s, t;
850    int i,j;
851    for (i = size(F); i > 0; i--)
852    {
853        s = 1;
854        for (j=1;j<=size(l);j++)
855        {
856            s = s*contributionBundle(M,F[i][1],list(l[j]));
857        }
858        t = F[i][2]*normalBundle(M,F[i][1]);
859        sum = sum + s/t;
860    }
861    return(sum);
862}
863example
864{
865    "EXAMPLE:"; echo=2;
866    ring r = 0,x,dp;
867    variety P = projectiveSpace(4);
868    stack M = moduliSpace(P,2);
869    list F = fixedPoints(M);
870    sumofquotients(M,F);
871    sumofquotients(M,F,list(5));
872}
873
874proc rationalCurve(int d, list #)
875"USAGE:     rationalCurve(d,#); d int, # list
876RETURN:     number
877THEORY:     This is the Gromov-Witten invariant corresponding the number of
878            rational curves on a general Calabi-Yau threefold.
879KEYWORDS:   Gromov-Witten invariants, rational curves on Calabi-Yau threefolds
880SEE ALSO:   linesHypersurface, multipleCover
881EXAMPLE:    example rationalCurve; shows an example
882"
883{
884    def R = basering;
885    setring R;
886    int n,i;
887    if (size(#) == 0) {n = 4; list l = 5;}
888    else {n = size(#)+3; list l = #;}
889    variety P = projectiveSpace(n);
890    stack M = moduliSpace(P,d);
891    def F = fixedPoints(M);
892    int ncpus = system("--cpus");
893    int sizeF = size(F);
894    list args;
895    int from = 1;
896    int to;
897    if (ncpus>sizeF) { ncpus=sizeF; }
898    for (i = 1; i <= ncpus; i++)
899    {
900        to = (sizeF*i) div ncpus;
901        args[i] = list(M, list(F[from..to]), l);
902        from = to+1;
903    }
904    list results = parallelWaitAll("sumofquotients", args);
905    number r = 0;
906    for (i = 1; i <= ncpus; i++)
907    {
908        r = r + results[i];
909    }
910    return (r);
911}
912example
913{
914    "EXAMPLE:"; echo=2;
915    ring r = 0,x,dp;
916    rationalCurve(1);
917    /*
918    rationalCurve(2);
919    rationalCurve(3);
920    rationalCurve(4);
921    rationalCurve(1,list(4,2));
922    rationalCurve(1,list(3,3));
923    rationalCurve(1,list(3,2,2));
924    rationalCurve(1,list(2,2,2,2));
925    rationalCurve(2,list(4,2));
926    rationalCurve(2,list(3,3));
927    rationalCurve(2,list(3,2,2));
928    rationalCurve(2,list(2,2,2,2));
929    rationalCurve(3,list(4,2));
930    rationalCurve(3,list(3,3));
931    rationalCurve(3,list(3,2,2));
932    rationalCurve(3,list(2,2,2,2));
933    rationalCurve(4,list(4,2));
934    rationalCurve(4,list(3,3));
935    rationalCurve(4,list(3,2,2));
936    rationalCurve(4,list(2,2,2,2));
937    */
938}
939
940////////////////////////////////////////////////////////////////////////////////
941/////////// Procedures concerned with graphs ///////////////////////////////////
942////////////////////////////////////////////////////////////////////////////////
943
944proc printGraphG(graph G)
945"USAGE:     printGraphG(G); G graph
946ASSUME:     G is a graph.
947THEORY:     This is the print function used by Singular to print a graph.
948KEYWORDS:   graph
949EXAMPLE:    example printGraphG; shows an example
950"
951{
952    "A graph with", size(G.vertices), "vertices and", size(G.edges), "edges";
953}
954example
955{
956    "EXAMPLE:"; echo=2;
957    ring r = 0,x,dp;
958    graph G = makeGraphVE(list(list(0,1,list(0,1,2)),list(1,1,list(1,0,2))),
959    list(list(0,1,2)));
960    G;
961}
962
963proc makeGraphVE(list v, list e)
964"USAGE:     makeGraphVE(v,e); v list, e list
965ASSUME:     v is a list of vertices, e is a list of edges.
966RETURN:     graph with vertices v and edges e.
967THEORY:     Creates a graph from a list of vertices and edges.
968KEYWORDS:   graph
969EXAMPLE:    example makeGraphVE; shows an example
970{
971    graph G;
972    G.vertices = v;
973    G.edges = e;
974    return(G);
975}
976example
977{
978    "EXAMPLE:"; echo=2;
979    ring r = 0,x,dp;
980    graph G = makeGraphVE(list(list(0,1,list(0,1,2)),list(1,1,list(1,0,2))),
981    list(list(0,1,2)));
982    G;
983}
984
985static proc graph1(int d, int i, int j)
986{
987    graph G;
988    list f1 = i,j,d;
989    list f2 = j,i,d;
990    list v1 = i,1,f1;
991    list v2 = j,1,f2;
992    G.vertices = v1,v2;
993    G.edges = list(f1);
994    return (G);
995}
996
997static proc graph2(list d, int i, int j, int k)
998{
999    graph G;
1000    list f1 = i,j,d[1];
1001    list f2 = j,i,d[1];
1002    list f3 = j,k,d[2];
1003    list f4 = k,j,d[2];
1004    list v1 = i,1,f1;
1005    list v2 = j,2,f2,f3;
1006    list v3 = k,1,f4;
1007    G.vertices = v1,v2,v3;
1008    G.edges = f1,f3;
1009    return (G);
1010}
1011
1012static proc graph31(list d, int i, int j, int k, int h)
1013{
1014    graph G;
1015    list f1 = i,j,d[1];
1016    list f2 = j,i,d[1];
1017    list f3 = j,k,d[2];
1018    list f4 = k,j,d[2];
1019    list f5 = k,h,d[3];
1020    list f6 = h,k,d[3];
1021    list v1 = i,1,f1;
1022    list v2 = j,2,f2,f3;
1023    list v3 = k,2,f4,f5;
1024    list v4 = h,1,f6;
1025    G.vertices = v1,v2,v3,v4;
1026    G.edges = f1,f3,f5;
1027    return (G);
1028}
1029
1030static proc graph32(list d, int i, int j, int k, int h)
1031{
1032    graph G;
1033    list f1 = i,j,d[1];
1034    list f2 = j,i,d[1];
1035    list f3 = j,k,d[2];
1036    list f4 = j,h,d[3];
1037    list f5 = k,j,d[2];
1038    list f6 = h,j,d[3];
1039    list v1 = i,1,f1;
1040    list v2 = j,3,f2,f3,f4;
1041    list v3 = k,1,f5;
1042    list v4 = h,1,f6;
1043    G.vertices = v1,v2,v3,v4;
1044    G.edges = f1,f3,f4;
1045    return (G);
1046}
1047
1048static proc graph41(list d, int i, int j, int k, int h, int l)
1049{
1050    graph G;
1051    list f1 = i,j,d[1];
1052    list f2 = j,i,d[1];
1053    list f3 = j,k,d[2];
1054    list f4 = k,j,d[2];
1055    list f5 = k,h,d[3];
1056    list f6 = h,k,d[3];
1057    list f7 = h,l,d[4];
1058    list f8 = l,h,d[4];
1059    list v1 = i,1,f1;
1060    list v2 = j,2,f2,f3;
1061    list v3 = k,2,f4,f5;
1062    list v4 = h,2,f6,f7;
1063    list v5 = l,1,f8;
1064    G.vertices = v1,v2,v3,v4,v5;
1065    G.edges = f1,f3,f5,f7;
1066    return (G);
1067}
1068
1069static proc graph42(list d, int i, int j, int k, int h, int l)
1070{
1071    graph G;
1072    list f1 = i,j,d[1];
1073    list f2 = j,i,d[1];
1074    list f3 = j,k,d[2];
1075    list f4 = k,j,d[2];
1076    list f5 = k,h,d[3];
1077    list f6 = k,l,d[4];
1078    list f7 = h,k,d[3];
1079    list f8 = l,k,d[4];
1080    list v1 = i,1,f1;
1081    list v2 = j,2,f2,f3;
1082    list v3 = k,3,f4,f5,f6;
1083    list v4 = h,1,f7;
1084    list v5 = l,1,f8;
1085    G.vertices = v1,v2,v3,v4,v5;
1086    G.edges = f1,f3,f5,f6;
1087    return (G);
1088}
1089
1090static proc graph43(list d, int i, int j, int k, int h, int l)
1091{
1092    graph G;
1093    list f1 = i,j,d[1];
1094    list f2 = j,i,d[1];
1095    list f3 = j,k,d[2];
1096    list f4 = j,h,d[3];
1097    list f5 = j,l,d[4];
1098    list f6 = k,j,d[2];
1099    list f7 = h,j,d[3];
1100    list f8 = l,j,d[4];
1101    list v1 = i,1,f1;
1102    list v2 = j,4,f2,f3,f4,f5;
1103    list v3 = k,1,f6;
1104    list v4 = h,1,f7;
1105    list v5 = l,1,f8;
1106    G.vertices = v1,v2,v3,v4,v5;
1107    G.edges = f1,f3,f4,f5;
1108    return (G);
1109}
1110
1111static proc graph51(list d, int i, int j, int k, int h, int m, int n)
1112{
1113    graph G;
1114    list f1 = i,j,d[1];
1115    list f2 = j,i,d[1];
1116    list f3 = j,k,d[2];
1117    list f4 = k,j,d[2];
1118    list f5 = k,h,d[3];
1119    list f6 = h,k,d[3];
1120    list f7 = h,m,d[4];
1121    list f8 = m,h,d[4];
1122    list f9 = m,n,d[5];
1123    list f10 = n,m,d[5];
1124    list v1 = i,1,f1;
1125    list v2 = j,2,f2,f3;
1126    list v3 = k,2,f4,f5;
1127    list v4 = h,2,f6,f7;
1128    list v5 = m,2,f8,f9;
1129    list v6 = n,1,f10;
1130    G.vertices = v1,v2,v3,v4,v5,v6;
1131    G.edges = f1,f3,f5,f7,f9;
1132    return (G);
1133}
1134
1135static proc graph52(list d, int i, int j, int k, int h, int m, int n)
1136{
1137    graph G;
1138    list f1 = i,j,d[1];
1139    list f2 = j,i,d[1];
1140    list f3 = j,k,d[2];
1141    list f4 = k,j,d[2];
1142    list f5 = k,h,d[3];
1143    list f6 = h,k,d[3];
1144    list f7 = h,m,d[4];
1145    list f8 = m,h,d[4];
1146    list f9 = h,n,d[5];
1147    list f10 = n,h,d[5];
1148    list v1 = i,1,f1;
1149    list v2 = j,2,f2,f3;
1150    list v3 = k,2,f4,f5;
1151    list v4 = h,3,f6,f7,f9;
1152    list v5 = m,1,f8;
1153    list v6 = n,1,f10;
1154    G.vertices = v1,v2,v3,v4,v5,v6;
1155    G.edges = f1,f3,f5,f7,f9;
1156    return (G);
1157}
1158
1159static proc graph53(list d, int i, int j, int k, int h, int m, int n)
1160{
1161    graph G;
1162    list f1 = i,j,d[1];
1163    list f2 = j,i,d[1];
1164    list f3 = j,k,d[2];
1165    list f4 = k,j,d[2];
1166    list f5 = k,h,d[3];
1167    list f6 = h,k,d[3];
1168    list f7 = k,m,d[4];
1169    list f8 = m,k,d[4];
1170    list f9 = k,n,d[5];
1171    list f10 = n,k,d[5];
1172    list v1 = i,1,f1;
1173    list v2 = j,2,f2,f3;
1174    list v3 = k,4,f4,f5,f7,f9;
1175    list v4 = h,1,f6;
1176    list v5 = m,1,f8;
1177    list v6 = n,1,f10;
1178    G.vertices = v1,v2,v3,v4,v5,v6;
1179    G.edges = f1,f3,f5,f7,f9;
1180    return (G);
1181}
1182
1183static proc graph54(list d, int i, int j, int k, int h, int m, int n)
1184{
1185    graph G;
1186    list f1 = i,j,d[1];
1187    list f2 = j,i,d[1];
1188    list f3 = j,k,d[2];
1189    list f4 = k,j,d[2];
1190    list f5 = j,h,d[3];
1191    list f6 = h,j,d[3];
1192    list f7 = h,m,d[4];
1193    list f8 = m,h,d[4];
1194    list f9 = h,n,d[5];
1195    list f10 = n,h,d[5];
1196    list v1 = i,1,f1;
1197    list v2 = j,3,f2,f3,f5;
1198    list v3 = k,1,f4;
1199    list v4 = h,3,f6,f7,f9;
1200    list v5 = m,1,f8;
1201    list v6 = n,1,f10;
1202    G.vertices = v1,v2,v3,v4,v5,v6;
1203    G.edges = f1,f3,f5,f7,f9;
1204    return (G);
1205}
1206
1207static proc graph55(list d, int i, int j, int k, int h, int m, int n)
1208{
1209    graph G;
1210    list f1 = i,j,d[1];
1211    list f2 = j,i,d[1];
1212    list f3 = j,k,d[2];
1213    list f4 = k,j,d[2];
1214    list f5 = k,h,d[3];
1215    list f6 = h,k,d[3];
1216    list f7 = k,m,d[4];
1217    list f8 = m,k,d[4];
1218    list f9 = h,n,d[5];
1219    list f10 = n,h,d[5];
1220    list v1 = i,1,f1;
1221    list v2 = j,2,f2,f3;
1222    list v3 = k,3,f4,f5,f7;
1223    list v4 = h,2,f6,f9;
1224    list v5 = m,1,f8;
1225    list v6 = n,1,f10;
1226    G.vertices = v1,v2,v3,v4,v5,v6;
1227    G.edges = f1,f3,f5,f7,f9;
1228    return (G);
1229}
1230
1231static proc graph56(list d, int i, int j, int k, int h, int m, int n)
1232{
1233    graph G;
1234    list f1 = i,j,d[1];
1235    list f2 = j,i,d[1];
1236    list f3 = j,k,d[2];
1237    list f4 = k,j,d[2];
1238    list f5 = j,h,d[3];
1239    list f6 = h,j,d[3];
1240    list f7 = j,m,d[4];
1241    list f8 = m,j,d[4];
1242    list f9 = j,n,d[5];
1243    list f10 = n,j,d[5];
1244    list v1 = i,1,f1;
1245    list v2 = j,5,f2,f3,f5,f7,f9;
1246    list v3 = k,1,f4;
1247    list v4 = h,1,f6;
1248    list v5 = m,1,f8;
1249    list v6 = n,1,f10;
1250    G.vertices = v1,v2,v3,v4,v5,v6;
1251    G.edges = f1,f3,f5,f7,f9;
1252    return (G);
1253}
1254
1255static proc graph61(list d, int i, int j, int k, int h, int m, int n, int p)
1256{
1257    graph G;
1258    list f1 = i,j,d[1];
1259    list f2 = j,i,d[1];
1260    list f3 = j,k,d[2];
1261    list f4 = k,j,d[2];
1262    list f5 = k,h,d[3];
1263    list f6 = h,k,d[3];
1264    list f7 = h,m,d[4];
1265    list f8 = m,h,d[4];
1266    list f9 = m,n,d[5];
1267    list f10 = n,m,d[5];
1268    list f11 = n,p,d[6];
1269    list f12 = p,n,d[6];
1270    list v1 = i,1,f1;
1271    list v2 = j,2,f2,f3;
1272    list v3 = k,2,f4,f5;
1273    list v4 = h,2,f6,f7;
1274    list v5 = m,2,f8,f9;
1275    list v6 = n,2,f10,f11;
1276    list v7 = p,1,f12;
1277    G.vertices = v1,v2,v3,v4,v5,v6,v7;
1278    G.edges = f1,f3,f5,f7,f9,f11;
1279    return (G);
1280}
1281
1282static proc graph62(list d, int i, int j, int k, int h, int m, int n, int p)
1283{
1284    graph G;
1285    list f1 = i,j,d[1];
1286    list f2 = j,i,d[1];
1287    list f3 = j,k,d[2];
1288    list f4 = k,j,d[2];
1289    list f5 = k,h,d[3];
1290    list f6 = h,k,d[3];
1291    list f7 = h,m,d[4];
1292    list f8 = m,h,d[4];
1293    list f9 = m,n,d[5];
1294    list f10 = n,m,d[5];
1295    list f11 = m,p,d[6];
1296    list f12 = p,m,d[6];
1297    list v1 = i,1,f1;
1298    list v2 = j,2,f2,f3;
1299    list v3 = k,2,f4,f5;
1300    list v4 = h,2,f6,f7;
1301    list v5 = m,3,f8,f9,f11;
1302    list v6 = n,1,f10;
1303    list v7 = p,1,f12;
1304    G.vertices = v1,v2,v3,v4,v5,v6,v7;
1305    G.edges = f1,f3,f5,f7,f9,f11;
1306    return (G);
1307}
1308
1309static proc graph63(list d, int i, int j, int k, int h, int m, int n, int p)
1310{
1311    graph G;
1312    list f1 = i,j,d[1];
1313    list f2 = j,i,d[1];
1314    list f3 = j,k,d[2];
1315    list f4 = k,j,d[2];
1316    list f5 = k,h,d[3];
1317    list f6 = h,k,d[3];
1318    list f7 = h,m,d[4];
1319    list f8 = m,h,d[4];
1320    list f9 = h,n,d[5];
1321    list f10 = n,h,d[5];
1322    list f11 = n,p,d[6];
1323    list f12 = p,n,d[6];
1324    list v1 = i,1,f1;
1325    list v2 = j,2,f2,f3;
1326    list v3 = k,2,f4,f5;
1327    list v4 = h,3,f6,f7,f9;
1328    list v5 = m,1,f8;
1329    list v6 = n,2,f10,f11;
1330    list v7 = p,1,f12;
1331    G.vertices = v1,v2,v3,v4,v5,v6,v7;
1332    G.edges = f1,f3,f5,f7,f9,f11;
1333    return (G);
1334}
1335
1336static proc graph64(list d, int i, int j, int k, int h, int m, int n, int p)
1337{
1338    graph G;
1339    list f1 = i,j,d[1];
1340    list f2 = j,i,d[1];
1341    list f3 = j,k,d[2];
1342    list f4 = k,j,d[2];
1343    list f5 = k,h,d[3];
1344    list f6 = h,k,d[3];
1345    list f7 = h,m,d[4];
1346    list f8 = m,h,d[4];
1347    list f9 = h,n,d[5];
1348    list f10 = n,h,d[5];
1349    list f11 = h,p,d[6];
1350    list f12 = p,h,d[6];
1351    list v1 = i,1,f1;
1352    list v2 = j,2,f2,f3;
1353    list v3 = k,2,f4,f5;
1354    list v4 = h,4,f6,f7,f9,f11;
1355    list v5 = m,1,f8;
1356    list v6 = n,1,f10;
1357    list v7 = p,1,f12;
1358    G.vertices = v1,v2,v3,v4,v5,v6,v7;
1359    G.edges = f1,f3,f5,f7,f9,f11;
1360    return (G);
1361}
1362
1363static proc graph65(list d, int i, int j, int k, int h, int m, int n, int p)
1364{
1365    graph G;
1366    list f1 = i,j,d[1];
1367    list f2 = j,i,d[1];
1368    list f3 = j,k,d[2];
1369    list f4 = k,j,d[2];
1370    list f5 = k,h,d[3];
1371    list f6 = h,k,d[3];
1372    list f7 = k,m,d[4];
1373    list f8 = m,k,d[4];
1374    list f9 = k,n,d[5];
1375    list f10 = n,k,d[5];
1376    list f11 = n,p,d[6];
1377    list f12 = p,n,d[6];
1378    list v1 = i,1,f1;
1379    list v2 = j,2,f2,f3;
1380    list v3 = k,4,f4,f5,f7,f9;
1381    list v4 = h,1,f6;
1382    list v5 = m,1,f8;
1383    list v6 = n,2,f10,f11;
1384    list v7 = p,1,f12;
1385    G.vertices = v1,v2,v3,v4,v5,v6,v7;
1386    G.edges = f1,f3,f5,f7,f9,f11;
1387    return (G);
1388}
1389
1390static proc graph66(list d, int i, int j, int k, int h, int m, int n, int p)
1391{
1392    graph G;
1393    list f1 = i,j,d[1];
1394    list f2 = j,i,d[1];
1395    list f3 = j,k,d[2];
1396    list f4 = k,j,d[2];
1397    list f5 = k,h,d[3];
1398    list f6 = h,k,d[3];
1399    list f7 = k,m,d[4];
1400    list f8 = m,k,d[4];
1401    list f9 = h,n,d[5];
1402    list f10 = n,h,d[5];
1403    list f11 = m,p,d[6];
1404    list f12 = p,m,d[6];
1405    list v1 = i,1,f1;
1406    list v2 = j,2,f2,f3;
1407    list v3 = k,3,f4,f5,f7;
1408    list v4 = h,2,f6,f9;
1409    list v5 = m,2,f8,f11;
1410    list v6 = n,1,f10;
1411    list v7 = p,1,f12;
1412    G.vertices = v1,v2,v3,v4,v5,v6,v7;
1413    G.edges = f1,f3,f5,f7,f9,f11;
1414    return (G);
1415}
1416
1417static proc graph67(list d, int i, int j, int k, int h, int m, int n, int p)
1418{
1419    graph G;
1420    list f1 = i,j,d[1];
1421    list f2 = j,i,d[1];
1422    list f3 = j,k,d[2];
1423    list f4 = k,j,d[2];
1424    list f5 = j,h,d[3];
1425    list f6 = h,j,d[3];
1426    list f7 = h,m,d[4];
1427    list f8 = m,h,d[4];
1428    list f9 = m,n,d[5];
1429    list f10 = n,m,d[5];
1430    list f11 = m,p,d[6];
1431    list f12 = p,m,d[6];
1432    list v1 = i,1,f1;
1433    list v2 = j,3,f2,f3,f5;
1434    list v3 = k,1,f4;
1435    list v4 = h,2,f6,f7;
1436    list v5 = m,3,f8,f9,f11;
1437    list v6 = n,1,f10;
1438    list v7 = p,1,f12;
1439    G.vertices = v1,v2,v3,v4,v5,v6,v7;
1440    G.edges = f1,f3,f5,f7,f9,f11;
1441    return (G);
1442}
1443
1444static proc graph68(list d, int i, int j, int k, int h, int m, int n, int p)
1445{
1446    graph G;
1447    list f1 = i,j,d[1];
1448    list f2 = j,i,d[1];
1449    list f3 = j,k,d[2];
1450    list f4 = k,j,d[2];
1451    list f5 = j,h,d[3];
1452    list f6 = h,j,d[3];
1453    list f7 = h,m,d[4];
1454    list f8 = m,h,d[4];
1455    list f9 = h,n,d[5];
1456    list f10 = n,h,d[5];
1457    list f11 = h,p,d[6];
1458    list f12 = p,h,d[6];
1459    list v1 = i,1,f1;
1460    list v2 = j,3,f2,f3,f5;
1461    list v3 = k,1,f4;
1462    list v4 = h,4,f6,f7,f9,f11;
1463    list v5 = m,1,f8;
1464    list v6 = n,1,f10;
1465    list v7 = p,1,f12;
1466    G.vertices = v1,v2,v3,v4,v5,v6,v7;
1467    G.edges = f1,f3,f5,f7,f9,f11;
1468    return (G);
1469}
1470
1471static proc graph69(list d, int i, int j, int k, int h, int m, int n, int p)
1472{
1473    graph G;
1474    list f1 = i,j,d[1];
1475    list f2 = j,i,d[1];
1476    list f3 = j,k,d[2];
1477    list f4 = k,j,d[2];
1478    list f5 = j,h,d[3];
1479    list f6 = h,j,d[3];
1480    list f7 = h,m,d[4];
1481    list f8 = m,h,d[4];
1482    list f9 = h,n,d[5];
1483    list f10 = n,h,d[5];
1484    list f11 = n,p,d[6];
1485    list f12 = p,n,d[6];
1486    list v1 = i,1,f1;
1487    list v2 = j,3,f2,f3,f5;
1488    list v3 = k,1,f4;
1489    list v4 = h,3,f6,f7,f9;
1490    list v5 = m,1,f8;
1491    list v6 = n,2,f10,f11;
1492    list v7 = p,1,f12;
1493    G.vertices = v1,v2,v3,v4,v5,v6,v7;
1494    G.edges = f1,f3,f5,f7,f9,f11;
1495    return (G);
1496}
1497
1498static proc graph610(list d, int i, int j, int k, int h, int m, int n, int p)
1499{
1500    graph G;
1501    list f1 = i,j,d[1];
1502    list f2 = j,i,d[1];
1503    list f3 = j,k,d[2];
1504    list f4 = k,j,d[2];
1505    list f5 = k,h,d[3];
1506    list f6 = h,k,d[3];
1507    list f7 = k,m,d[4];
1508    list f8 = m,k,d[4];
1509    list f9 = k,n,d[5];
1510    list f10 = n,k,d[5];
1511    list f11 = k,p,d[6];
1512    list f12 = p,k,d[6];
1513    list v1 = i,1,f1;
1514    list v2 = j,2,f2,f3;
1515    list v3 = k,5,f4,f5,f7,f9,f11;
1516    list v4 = h,1,f6;
1517    list v5 = m,1,f8;
1518    list v6 = n,1,f10;
1519    list v7 = p,1,f12;
1520    G.vertices = v1,v2,v3,v4,v5,v6,v7;
1521    G.edges = f1,f3,f5,f7,f9,f11;
1522    return (G);
1523}
1524
1525static proc graph611(list d, int i, int j, int k, int h, int m, int n, int p)
1526{
1527    graph G;
1528    list f1 = i,j,d[1];
1529    list f2 = j,i,d[1];
1530    list f3 = j,k,d[2];
1531    list f4 = k,j,d[2];
1532    list f5 = j,h,d[3];
1533    list f6 = h,j,d[3];
1534    list f7 = j,m,d[4];
1535    list f8 = m,j,d[4];
1536    list f9 = j,n,d[5];
1537    list f10 = n,j,d[5];
1538    list f11 = j,p,d[6];
1539    list f12 = p,j,d[6];
1540    list v1 = i,1,f1;
1541    list v2 = j,6,f2,f3,f5,f7,f9,f11;
1542    list v3 = k,1,f4;
1543    list v4 = h,1,f6;
1544    list v5 = m,1,f8;
1545    list v6 = n,1,f10;
1546    list v7 = p,1,f12;
1547    G.vertices = v1,v2,v3,v4,v5,v6,v7;
1548    G.edges = f1,f3,f5,f7,f9,f11;
1549    return (G);
1550}
1551
1552proc homog_part(poly f, int n)
1553"USAGE:     homog_part(f,n); f poly, n int
1554RETURN:     poly
1555PURPOSE:    computing the homogeneous component of a polynomial.
1556EXAMPLE:    example homog_part; shows examples
1557"
1558{
1559    int i;
1560    poly p;
1561    for (i=1;i<=size(f);i++)
1562    {
1563        if (deg(f[i])==n) {p=p+f[i];}
1564    }
1565    return (p);
1566}
1567example
1568{
1569    "EXAMPLE:"; echo=2;
1570    ring r = 0,(x,y,z),wp(1,2,3);
1571    poly f = 1+x+x2+x3+x4+y+y2+y3+z+z2+xy+xz+yz+xyz;
1572    homog_part(f,0);
1573    homog_part(f,1);
1574    homog_part(f,2);
1575    homog_part(f,3);
1576    homog_part(f,4);
1577    homog_part(f,5);
1578    homog_part(f,6);
1579}
1580
1581proc homog_parts(poly f, int i, int j)
1582"USAGE:     homog_parts(f,i,j); f poly, i int, j int
1583RETURN:     poly
1584THEORY:     computing a polynomial which is the sum of the homogeneous
1585            components of a polynomial.
1586EXAMPLE:    example homog_parts; shows examples
1587"
1588{
1589    int k;
1590    poly p;
1591    for (k=i;k<=j;k++)
1592    {
1593        p=p+homog_part(f,k);
1594    }
1595    return (p);
1596}
1597example
1598{
1599    "EXAMPLE:"; echo=2;
1600    ring r = 0,(x,y,z),wp(1,2,3);
1601    poly f = 1+x+x2+x3+x4+y+y2+y3+z+z2+xy+xz+yz+xyz;
1602    homog_parts(f,2,4);
1603}
1604
1605proc logg(poly f, int n)
1606"USAGE:     logg(f,n); f poly, n int
1607RETURN:     poly
1608THEORY:     computing Chern characters from total Chern classes.
1609EXAMPLE:    example logg; shows examples
1610"
1611{
1612    poly p;
1613    int i,j,k,m;
1614    if (n==0) {p=0;}
1615    if (n==1) {p=homog_part(f,1);}
1616    else
1617    {
1618        list l=-homog_part(f,1);
1619        for (j=2;j<=n;j++)
1620        {
1621            poly q;
1622            for (k=1;k<j;k++)
1623            {
1624                q=q+homog_part(f,k)*l[j-k];
1625            }
1626            q=-j*homog_part(f,j)-q;
1627            l=insert(l,q,size(l));
1628            kill q;
1629        }
1630        for (m=1;m<=n;m++)
1631        {
1632            p=p+1/factorial(m)*(-1)^m*l[m];
1633        }
1634    }
1635    return (p);
1636}
1637example
1638{
1639    "EXAMPLE:"; echo=2;
1640    ring r = 0,(x,y),wp(1,2);
1641    poly f = 1+x+y;
1642    logg(f,4);
1643}
1644
1645proc expp(poly f, int n)
1646"USAGE:     expp(f,n); f poly, n int
1647RETURN:     poly
1648PURPOSE:    computing total Chern classes from Chern characters.
1649EXAMPLE:    example expp; shows examples
1650"
1651{
1652    poly p;
1653    int i,j,k;
1654    if (deg(f)==0) {p=1;}
1655    else
1656    {
1657        list l=1;
1658        for (i=1;i<=n;i++)
1659        {
1660            poly q;
1661            for (j=1;j<=i;j++)
1662            {
1663                q=q+factorial(j)*(-1)^(j-1)*l[i-j+1]*homog_part(f,j)/i;
1664            }
1665            l=insert(l,q,size(l));
1666            kill q;
1667        }
1668        for (k=1;k<=size(l);k++)
1669        {
1670            p=p+l[k];
1671        }
1672    }
1673    return (p);
1674}
1675example
1676{
1677    "EXAMPLE:"; echo=2;
1678    ring r = 0,x,dp;
1679    poly f = 3+x;
1680    expp(f,3);
1681}
1682
1683static proc adams(poly f, int n)
1684{
1685    poly p;
1686    int i;
1687    for (i=0;i<=deg(f);i++)
1688    {
1689        p=p+n^i*homog_part(f,i);
1690    }
1691    return (p);
1692}
1693
1694static proc wedges(int n, poly f, int d)
1695{
1696    int i,j;
1697    list l;
1698    if (n==0) {l=1;}
1699    if (n==1) {l=1,f;}
1700    else
1701    {
1702        l=1,f;
1703        for (i=2;i<=n;i++)
1704        {
1705            poly q;
1706            for (j=1;j<=i;j++)
1707            {
1708                q=q+((-1)^(i-j))*homog_parts(l[j]*adams(f,i-j+1),0,d)/i;
1709            }
1710            l=insert(l,q,size(l));
1711            kill q;
1712        }
1713    }
1714    return (l);
1715}
1716
1717static proc schur(list p, poly f)
1718{
1719    int i,j;
1720    int n = size(p);
1721    matrix M[n][n];
1722    for (i=1;i<=n;i++)
1723    {
1724        for (j=1;j<=n;j++)
1725        {
1726            M[i,j] = homog_part(f,p[i]+j-i);
1727        }
1728    }
1729    return (det(M));
1730}
1731
1732////////////////////////////////////////////////////////////////////////////////
1733//////// Procedures concerned with abstract varieties //////////////////////////
1734////////////////////////////////////////////////////////////////////////////////
1735
1736proc printVariety(variety V)
1737"USAGE:     printVariety(V); V variety
1738ASSUME:     V is an abstract variety
1739THEORY:     This is the print function used by Singular to print an abstract
1740            variety.
1741KEYWORDS:   abstract variety, projective space, Grassmannian
1742EXAMPLE:    example printVariety; shows an example
1743"
1744{
1745    "A variety of dimension", V.dimension;
1746}
1747example
1748{
1749    "EXAMPLE:"; echo=2;
1750    ring r = 0,(h,e),wp(1,1);
1751    ideal rels = he,h2+e2;
1752    variety V = makeVariety(2,rels);
1753    V;
1754}
1755
1756proc makeVariety(int d, ideal i)
1757"USAGE:     makeVariety(d,i); d int, i ideal
1758ASSUME:     d is a nonnegative integer, i is an ideal
1759RETURN:     variety
1760THEORY:     create an abstract variety which has dimension d, and its Chow ring
1761            should be a quotient ring
1762KEYWORDS:   abstract variety, projective space, Grassmannian
1763EXAMPLE:    example makeVariety; shows an example
1764"
1765{
1766    def R = basering;
1767    variety V;
1768    V.dimension = d;
1769    V.baseRing = R;
1770    V.relations = i;
1771    return(V);
1772}
1773example
1774{
1775    "EXAMPLE:"; echo=2;
1776    ring r = 0,(h,e),wp(1,1);
1777    ideal rels = he,h2+e2;
1778    variety V = makeVariety(2,rels);
1779    V;
1780    V.dimension;
1781    V.relations;
1782}
1783
1784proc ChowRing(variety V)
1785"USAGE:     ChowRing(V); V variety
1786ASSUME:     V is an abstract variety
1787RETURN:     qring
1788KEYWORDS:   Chow ring, abstract variety, projective space, Grassmannian
1789EXAMPLE:    example makeVariety; shows an example
1790"
1791{
1792    def R = V.baseRing;
1793    setring R;
1794    ideal rels = V.relations;
1795    qring CR = std(rels);
1796    return (CR);
1797}
1798example
1799{
1800    "EXAMPLE:"; echo=2;
1801    ring r = 0,(h,e),wp(1,1);
1802    ideal rels = he,h2+e2;
1803    int d = 2;
1804    variety V = makeVariety(2,rels);
1805    ChowRing(V);
1806}
1807
1808////////////////////////////////////////////////////////////////////////////////
1809
1810proc Grassmannian(int k, int n, list #)
1811"USAGE:     Grassmannian(k,n); k int, n int
1812RETURN:     variety
1813THEORY:     create a Grassmannian G(k,n) as an abstract variety. This abstract
1814            variety has diemnsion k(n-k) and its Chow ring is the quotient ring
1815            of a polynomial ring in n-k variables q(1),...,q(n-k), which are the
1816            Chern classes of tautological quotient bundle on G(k,n), modulo some
1817            ideal generated by n-k polynomials which come from the Giambelli
1818            formula. The monomial ordering of this Chow ring is 'wp' with vector
1819            (1..k,1..n-k). Moreover, we export the Chern characters of
1820            tautological subbundle and quotient bundle on G(k,n)
1821            (say 'subBundle' and 'quotientBundle').
1822KEYWORDS:   Grassmannian, abstract variety, Schubert calculus
1823SEE ALSO:   projectiveSpace, projectiveBundle
1824EXAMPLE:    example Grassmannian; shows examples
1825"
1826{
1827    string q;
1828    if (size(#)==0) {q = "q";}
1829    else
1830    {
1831        if (typeof(#[1]) == "string") {q = #[1];}
1832        else {Error("invalid optional argument");}
1833    }
1834    variety G;
1835    G.dimension = k*(n-k);
1836    execute("ring r = 0,("+q+"(1..n-k)),wp(1..n-k);");
1837    setring r;
1838    G.baseRing = r;
1839    int i,j;
1840    poly v = 1;
1841    poly u = 1;
1842    for (j=1;j<=n-k;j++) {v=v+q(j);}
1843    list l;
1844    for (i=1;i<=k;i++)
1845    {
1846        l=insert(l,1,size(l));
1847        u=u+(-1)^i*schur(l,v);
1848    }
1849    l=insert(l,1,size(l));
1850    ideal rels = schur(l,v);
1851    int h = k+2;
1852    while (h<=n)
1853    {
1854        l=insert(l,1,size(l));
1855        rels = rels,schur(l,v);
1856        h++;
1857    }
1858    G.relations = rels;
1859    int d = k*(n-k);
1860    poly subBundle = reduce(logg(u,d)+k,std(rels));
1861    poly quotientBundle = reduce(logg(v,d)+n-k,std(rels));
1862    export (subBundle,quotientBundle);
1863    kill u,v,d,l,rels;
1864    return (G);
1865}
1866example
1867{
1868    "EXAMPLE:"; echo=2;
1869    variety G24 = Grassmannian(2,4);
1870    G24;
1871    def r = G24.baseRing;
1872    setring r;
1873    subBundle;
1874    quotientBundle;
1875    G24.dimension;
1876    G24.relations;
1877    ChowRing(G24);
1878}
1879
1880proc projectiveSpace(int n, list #)
1881"USAGE:     projectiveSpace(n); n int
1882RETURN:     variety
1883THEORY:     create a projective space of dimension n as an abstract variety. Its
1884            Chow ring is a quotient ring in one variable h modulo the ideal
1885            generated by h^(n+1).
1886KEYWORDS:   projective space, abstract variety
1887SEE ALSO:   Grassmannian, projectiveBundle
1888EXAMPLE:    example projectiveSpace; shows examples
1889"
1890{
1891    string h;
1892    if (size(#)==0) {h = "h";}
1893    else
1894    {
1895        if (typeof(#[1]) == "string") {h = #[1];}
1896        else {Error("invalid optional argument");}
1897    }
1898    variety P;
1899    P.dimension = n;
1900    ring r = create_ring(0, "("+h+")", "wp(1)");
1901    setring r;
1902    P.baseRing = r;
1903    ideal rels = var(1)^(n+1);
1904    P.relations = rels;
1905    poly u = 1;
1906    poly v = 1 + var(1);
1907    list l;
1908    int i;
1909    for (i=1;i<=n;i++)
1910    {
1911        l=insert(l,1,size(l));
1912        u=u+(-1)^i*schur(l,v);
1913    }
1914    poly subBundle = reduce(logg(u,n)+n,std(rels));
1915    poly quotientBundle = reduce(logg(v,n)+1,std(rels));
1916    export(subBundle,quotientBundle);
1917    kill rels,u,v,l;
1918    return (P);
1919}
1920example
1921{
1922    "EXAMPLE:"; echo=2;
1923    variety P = projectiveSpace(3);
1924    P;
1925    P.dimension;
1926    def r = P.baseRing;
1927    setring r;
1928    P.relations;
1929    ChowRing(P);
1930}
1931
1932proc projectiveBundle(sheaf S, list #)
1933"USAGE:     projectiveBundle(S); S sheaf
1934INPUT:      a sheaf on an abstract variety
1935RETURN:     variety
1936THEORY:     create a projective bundle as an abstract variety. This is related
1937            to the enumeration of conics.
1938KEYWORDS:   projective bundle, abstract variety, sheaf, enumeration of conics
1939SEE ALSO:   projectiveSpace, Grassmannian
1940EXAMPLE:    example projectiveBundle; shows examples
1941"
1942{
1943    string z;
1944    if (size(#)==0) {z = "z";}
1945    else
1946    {
1947        if (typeof(#[1]) == "string") {z = #[1];}
1948        else {Error("invalid optional argument");}
1949    }
1950    variety A;
1951    def B = S.currentVariety;
1952    def R = B.baseRing;
1953    setring R;
1954    ideal rels = B.relations;
1955    int r = rankSheaf(S);
1956    A.dimension = r - 1 + B.dimension;
1957    poly c = totalChernClass(S);
1958    ring P = create_ring(0, "("+z+")", "wp(1)");
1959    def CR = P + R;
1960    setring CR;
1961    A.baseRing = CR;
1962    poly c = imap(R,c);
1963    ideal rels = imap(R,rels);
1964    poly g = var(1)^r;
1965    int i;
1966    for (i=1;i<=r;i++) {g=g+var(1)^(r-i)*homog_part(c,i);}
1967    A.relations = rels,g;
1968    poly u = 1 + var(1);
1969    poly f = logg(u,A.dimension)+1;
1970    poly QuotientBundle = reduce(f,std(A.relations));
1971    export (QuotientBundle);
1972    kill f,rels;
1973    return (A);
1974}
1975example
1976{
1977    "EXAMPLE:"; echo=2;
1978    variety G = Grassmannian(3,5);
1979    def r = G.baseRing;
1980    setring r;
1981    sheaf S = makeSheaf(G,subBundle);
1982    sheaf B = dualSheaf(S)^2;
1983    variety PB = projectiveBundle(B);
1984    PB;
1985    def R = PB.baseRing;
1986    setring R;
1987    QuotientBundle;
1988    ChowRing(PB);
1989}
1990
1991proc productVariety(variety U, variety V)
1992"USAGE:     productVariety(U,V); U variety, V variety
1993INPUT:      two abstract varieties
1994OUTPUT:     a product variety as an abstract variety
1995RETURN:     variety
1996KEYWORDS:   product variety, abstract variety
1997SEE ALSO:   projectiveSpace, Grassmannian, projectiveBundle
1998EXAMPLE:    example productVariety; shows examples
1999"
2000{
2001    //def br = basering;
2002    def ur = U.baseRing; setring ur;
2003    ideal ii1 = U.relations;
2004    def vr = V.baseRing; setring vr;
2005    ideal ii2 = V.relations;
2006    variety W;
2007    W.dimension = U.dimension + V.dimension;
2008    def temp = ringtensor(ur,vr);
2009    setring temp;
2010    W.baseRing = temp;
2011    ideal i1 = imap(ur,ii1);
2012    ideal i2 = imap(vr,ii2);
2013    W.relations = i1 + i2;
2014    setring ur;
2015    kill ii1;
2016    setring vr;
2017    kill ii2;
2018    //setring br;
2019    return (W);
2020}
2021example
2022{
2023    "EXAMPLE:"; echo=2;
2024    variety P = projectiveSpace(3);
2025    variety G = Grassmannian(2,4);
2026    variety W = productVariety(P,G);
2027    W;
2028    W.dimension == P.dimension + G.dimension;
2029    def r = W.baseRing;
2030    setring r;
2031    W.relations;
2032}
2033
2034////////////////////////////////////////////////////////////////////////////////
2035
2036proc integral(variety V, poly f)
2037"USAGE:     integral(V,f); V variety, f poly
2038INPUT:      a abstract variety and a polynomial
2039RETURN:     int
2040PURPOSE:    computing intersection numbers.
2041EXAMPLE:    example integral; shows an example
2042"
2043{
2044    def R = V.baseRing;
2045    setring R;
2046    ideal rels = V.relations;
2047    return (leadcoef(reduce(f,std(rels))));
2048}
2049example
2050{
2051    "EXAMPLE:"; echo=2;
2052    variety G = Grassmannian(2,4);
2053    def r = G.baseRing;
2054    setring r;
2055    integral(G,q(1)^4);
2056}
2057
2058proc SchubertClass(list p)
2059"USAGE:     SchubertClass(p); p list
2060INPUT:      a list of integers which is a partition
2061RETURN:     poly
2062PURPOSE:    compute the Schubert classes on a Grassmannian.
2063EXAMPLE:    example SchubertClass; shows an example
2064"
2065{
2066    def R = basering;
2067    setring R;
2068    poly f = 1;
2069    if (size(p) == 0) {return (f);}
2070    int i;
2071    for (i=1;i<=nvars(R);i++)
2072    {
2073        f = f + var(i);
2074    }
2075    return (schur(p,f));
2076}
2077example
2078{
2079    "EXAMPLE:"; echo=2;
2080    variety G = Grassmannian(2,4);
2081    def r = G.baseRing;
2082    setring r;
2083    list p = 1,1;
2084    SchubertClass(p);
2085}
2086
2087////////////////////////////////////////////////////////////////////////////////
2088
2089proc dualPartition(int k, int n, list p)
2090"USAGE:     dualPartition(k,n,p); k int, n int, p list
2091INPUT:      two integers and a partition
2092RETURN:     list
2093PURPOSE:    compute the dual of a partition.
2094SEE ALSO:   SchubertClass
2095EXAMPLE:    example dualPartition; shows an example
2096"
2097{
2098    while (size(p) < k)
2099    {
2100        p = insert(p,0,size(p));
2101    }
2102    int i;
2103    list l;
2104    for (i=1;i<=size(p);i++)
2105    {
2106        l[i] = n-k-p[size(p)-i+1];
2107    }
2108    return (l);
2109}
2110example
2111{
2112    "EXAMPLE:"; echo=2;
2113    ring r = 0,(x),dp;
2114    dualPartition(2,4,list(2,1));
2115}
2116
2117////////////////////////////////////////////////////////////////////////////////
2118////////// Procedures concerned with abstract sheaves ///////////////////////////////////
2119////////////////////////////////////////////////////////////////////////////////
2120
2121proc printSheaf(sheaf S)
2122"USAGE:     printSheaf(S); S sheaf
2123RETURN:     string
2124INPUT:      a sheaf
2125THEORY:     This is the print function used by Singular to print a sheaf.
2126SEE ALSO:   makeSheaf, rankSheaf
2127EXAMPLE:    example printSheaf; shows an example
2128"
2129{
2130    "A sheaf of rank ", rankSheaf(S);
2131}
2132example
2133{
2134    "EXAMPLE:"; echo=2;
2135    variety X;
2136    X.dimension = 4;
2137    ring r = 0,(c(1..2),d(1..3)),wp(1..2,1..3);
2138    setring r;
2139    X.baseRing = r;
2140    poly c = 1 + c(1) + c(2);
2141    poly ch = 2 + logg(c,4);
2142    sheaf S = makeSheaf(X,ch);
2143    S;
2144}
2145
2146proc makeSheaf(variety V, poly ch)
2147"USAGE:     makeSheaf(V,ch); V variety, ch poly
2148RETURN:     sheaf
2149THEORY:     create a sheaf on an abstract variety, and its Chern character is
2150            the polynomial ch.
2151SEE ALSO:   printSheaf, rankSheaf
2152EXAMPLE:    example makeSheaf; shows an example
2153"
2154{
2155    def R = basering;
2156    sheaf S;
2157    S.currentVariety = V;
2158    S.ChernCharacter = ch;
2159    return(S);
2160}
2161example
2162{
2163    "EXAMPLE:"; echo=2;
2164    variety X;
2165    X.dimension = 4;
2166    ring r = 0,(c(1..2),d(1..3)),wp(1..2,1..3);
2167    setring r;
2168    X.baseRing = r;
2169    poly c = 1 + c(1) + c(2);
2170    poly ch = 2 + logg(c,4);
2171    sheaf S = makeSheaf(X,ch);
2172    S;
2173}
2174
2175proc rankSheaf(sheaf S)
2176"USAGE:     rankSheaf(S); S sheaf
2177RETURN:     int
2178INPUT:      S is a sheaf
2179OUTPUT:     a positive integer which is the rank of a sheaf.
2180SEE ALSO:   makeSheaf, printSheaf
2181EXAMPLE:    example rankSheaf; shows an example
2182"
2183{
2184    variety V = S.currentVariety;
2185    def R = V.baseRing;
2186    setring R;
2187    poly f = S.ChernCharacter;
2188    return (int(homog_part(f,0)));
2189}
2190example
2191{
2192    "EXAMPLE:"; echo=2;
2193    variety G = Grassmannian(2,4);
2194    def R = G.baseRing;
2195    setring R;
2196    sheaf S = makeSheaf(G,subBundle);
2197    rankSheaf(S);
2198}
2199
2200proc totalChernClass(sheaf S)
2201"USAGE:     totalChernClass(S); S sheaf
2202RETURN:     poly
2203INPUT:      S is a sheaf
2204OUTPUT:     a polynomial which is the total Chern class of a sheaf
2205SEE ALSO:   totalSegreClass, topChernClass, ChernClass
2206EXAMPLE:    example totalChernClass; shows an example
2207"
2208{
2209    variety V = S.currentVariety;
2210    int d = V.dimension;
2211    def R = V.baseRing;
2212    setring R;
2213    poly ch = S.ChernCharacter;
2214    poly f = expp(ch,d);
2215    ideal rels = std(V.relations);
2216    return (reduce(f,rels));
2217}
2218example
2219{
2220    "EXAMPLE:"; echo=2;
2221    variety X;
2222    X.dimension = 4;
2223    ring r = 0,(c(1..2),d(1..3)),wp(1..2,1..3);
2224    setring r;
2225    X.baseRing = r;
2226    poly c = 1 + c(1) + c(2);
2227    poly ch = 2 + logg(c,4);
2228    sheaf E = makeSheaf(X,ch);
2229    sheaf S = E^3;
2230    totalChernClass(S);
2231}
2232
2233proc ChernClass(sheaf S, int i)
2234"USAGE:     ChernClass(S,i); S sheaf, i int
2235INPUT:      S is a sheaf, i is a nonnegative integer
2236RETURN:     poly
2237THEORY:     This is the i-th Chern class of a sheaf
2238SEE ALSO:   topChernClass, totalChernClass
2239EXAMPLE:    example ChernClass; shows an example
2240"
2241{
2242    return (homog_part(totalChernClass(S),i));
2243}
2244example
2245{
2246    "EXAMPLE:"; echo=2;
2247    variety X;
2248    X.dimension = 4;
2249    ring r = 0,(c(1..2),d(1..3)),wp(1..2,1..3);
2250    setring r;
2251    X.baseRing = r;
2252    poly c = 1 + c(1) + c(2);
2253    poly ch = 2 + logg(c,4);
2254    sheaf E = makeSheaf(X,ch);
2255    sheaf S = E^3;
2256    ChernClass(S,1);
2257    ChernClass(S,2);
2258    ChernClass(S,3);
2259    ChernClass(S,4);
2260}
2261
2262proc topChernClass(sheaf S)
2263"USAGE:     topChernClass(S); S sheaf
2264RETURN:     poly
2265INPUT:      S is a sheaf
2266THEORY:     This is the top Chern class of a sheaf
2267SEE ALSO:   ChernClass, totalChernClass
2268EXAMPLE:    example topChernClass; shows an example
2269"
2270{
2271    return (ChernClass(S,rankSheaf(S)));
2272}
2273example
2274{
2275    "EXAMPLE:"; echo=2;
2276    variety G = Grassmannian(2,4);
2277    def R = G.baseRing;
2278    setring R;
2279    sheaf S = makeSheaf(G,quotientBundle);
2280    sheaf B = S^3;
2281    topChernClass(B);
2282}
2283
2284proc totalSegreClass(sheaf S)
2285"USAGE:     totalSegreClass(S); S sheaf
2286RETURN:     poly
2287INPUT:      S is a sheaf
2288THEORY:     This is the total Segre class of a sheaf.
2289SEE AlSO:   totalChernClass
2290EXAMPLE:    example totalSegreClass; shows an example
2291"
2292{
2293    //def D = dualSheaf(S);
2294    variety V = S.currentVariety;
2295    def R = V.baseRing;
2296    setring R;
2297    poly f = totalChernClass(S);
2298    poly g;
2299    int d = V.dimension;
2300    ideal rels = std(V.relations);
2301    if (f == 1) {return (1);}
2302    else
2303    {
2304        poly t,h;
2305        int i,j;
2306        for (i=0;i<=d;i++) {t = t + (1-f)^i;}
2307        for (j=0;j<=d;j++) {h = h + homog_part(t,j);}
2308        return (reduce(h,rels));
2309    }
2310}
2311example
2312{
2313    "EXAMPLE:"; echo=2;
2314    variety G = Grassmannian(2,4);
2315    def R = G.baseRing;
2316    setring R;
2317    sheaf S = makeSheaf(G,subBundle);
2318    totalSegreClass(S);
2319}
2320
2321proc dualSheaf(sheaf S)
2322"USAGE:     dualSheaf(S); S sheaf
2323RETURN:     sheaf
2324THEORY:     This is the dual of a sheaf
2325SEE ALSO:   addSheaf, symmetricPowerSheaf, tensorSheaf, quotSheaf
2326EXAMPLE:    example dualSheaf; shows examples
2327"
2328{
2329    variety V = S.currentVariety;
2330    int d = V.dimension;
2331    def R = V.baseRing;
2332    setring R;
2333    poly ch = S.ChernCharacter;
2334    poly f = adams(ch,-1);
2335    sheaf D;
2336    D.currentVariety = V;
2337    D.ChernCharacter = f;
2338    return (D);
2339}
2340example
2341{
2342    "EXAMPLE:"; echo=2;
2343    variety G = Grassmannian(2,4);
2344    def R = G.baseRing;
2345    setring R;
2346    sheaf S = makeSheaf(G,subBundle);
2347    sheaf D = dualSheaf(S);
2348    D;
2349}
2350
2351proc tensorSheaf(sheaf A, sheaf B)
2352"USAGE:     tensorSheaf(A,B); A sheaf, B sheaf
2353RETURN:     sheaf
2354THEORY:     This is the tensor product of two sheaves
2355SEE ALSO:   addSheaf, symmetricPowerSheaf, quotSheaf, dualSheaf
2356EXAMPLE:    example tensorSheaf; shows examples
2357"
2358{
2359    sheaf S;
2360    variety V1 = A.currentVariety;
2361    variety V2 = B.currentVariety;
2362    def R1 = V1.baseRing;
2363    setring R1;
2364    poly c1 = A.ChernCharacter;
2365    def R2 = V2.baseRing;
2366    setring R2;
2367    poly c2 = B.ChernCharacter;
2368    if (nvars(R1) < nvars(R2))
2369    {
2370        S.currentVariety = V2;
2371        poly c = imap(R1,c1);
2372        poly f = homog_parts(c*c2,0,V2.dimension);
2373        S.ChernCharacter = f;
2374        return (S);
2375    }
2376    else
2377    {
2378        setring R1;
2379        S.currentVariety = V1;
2380        poly c = imap(R2,c2);
2381        poly f = homog_parts(c1*c,0,V1.dimension);
2382        S.ChernCharacter = f;
2383        return (S);
2384    }
2385}
2386example
2387{
2388    "EXAMPLE:"; echo=2;
2389    variety G = Grassmannian(3,4);
2390    def R = G.baseRing;
2391    setring R;
2392    sheaf S = makeSheaf(G,subBundle);
2393    sheaf Q = makeSheaf(G,quotientBundle);
2394    sheaf T = S*Q;
2395    T;
2396}
2397
2398proc symmetricPowerSheaf(sheaf S, int n)
2399"USAGE:     symmetricPowerSheaf(S,n); S sheaf, n int
2400RETURN:     sheaf
2401THEORY:     This is the n-th symmetric power of a sheaf
2402SEE ALSO:   quotSheaf, addSheaf, tensorSheaf, dualSheaf
2403EXAMPLE:    example symmetricPowerSheaf; shows examples
2404"
2405{
2406    variety V = S.currentVariety;
2407    def R = V.baseRing;
2408    setring R;
2409    int r = rankSheaf(S);
2410    int d = V.dimension;
2411    int i,j,m;
2412    poly f = S.ChernCharacter;
2413    poly result;
2414    list s,w;
2415    if (n==0) {result=1;}
2416    if (n==1) {result=f;}
2417    else
2418    {
2419        s = 1,f;
2420        w = wedges(n,f,d);
2421        for (i=2;i<=n;i++)
2422        {
2423            if (i<=r) {m=i;}
2424            else {m=r;}
2425            poly q;
2426            for (j=1;j<=m;j++)
2427            {
2428                q = q + ((-1)^(j+1))*homog_parts(w[j+1]*s[i-j+1],0,d);
2429            }
2430            s = insert(s,q,size(s));
2431            kill q;
2432        }
2433        result = s[n+1];
2434    }
2435    sheaf A;
2436    A.currentVariety = V;
2437    A.ChernCharacter = result;
2438    return (A);
2439}
2440example
2441{
2442    "EXAMPLE:"; echo=2;
2443    variety G = Grassmannian(2,4);
2444    def R = G.baseRing;
2445    setring R;
2446    sheaf S = makeSheaf(G,quotientBundle);
2447    sheaf B = symmetricPowerSheaf(S,3);
2448    B;
2449    sheaf A = S^3;
2450    A;
2451    A.ChernCharacter == B.ChernCharacter;
2452}
2453
2454proc quotSheaf(sheaf A, sheaf B)
2455"USAGE:     quotSheaf(A,B); A sheaf, B sheaf
2456RETURN:     sheaf
2457THEORY:     This is the quotient of two sheaves
2458SEE ALSO:   addSheaf, symmetricPowerSheaf, tensorSheaf, dualSheaf
2459EXAMPLE:    example quotSheaf; shows an example
2460"
2461{
2462    sheaf S;
2463    variety V1 = A.currentVariety;
2464    variety V2 = B.currentVariety;
2465    def R1 = V1.baseRing;
2466    setring R1;
2467    poly c1 = A.ChernCharacter;
2468    def R2 = V2.baseRing;
2469    setring R2;
2470    poly c2 = B.ChernCharacter;
2471    if (nvars(R1) < nvars(R2))
2472    {
2473        S.currentVariety = V2;
2474        poly c = imap(R1,c1);
2475        S.ChernCharacter = c - c2;
2476        return (S);
2477    }
2478    else
2479    {
2480        setring R1;
2481        S.currentVariety = V1;
2482        poly c = imap(R2,c2);
2483        S.ChernCharacter = c1 - c;
2484        return (S);
2485    }
2486}
2487example
2488{
2489    "EXAMPLE:"; echo=2;
2490    variety G = Grassmannian(3,5);
2491    def r = G.baseRing;
2492    setring r;
2493    sheaf S = makeSheaf(G,subBundle);
2494    sheaf B = dualSheaf(S)^2;
2495    sheaf B3 = dualSheaf(S)^3;
2496    sheaf B5 = dualSheaf(S)^5;
2497    variety PB = projectiveBundle(B);
2498    def R = PB.baseRing;
2499    setring R;
2500    sheaf Q = makeSheaf(PB,QuotientBundle);
2501    sheaf V = dualSheaf(Q)*B3;
2502    sheaf A = B5 - V;
2503    A;
2504}
2505
2506proc addSheaf(sheaf A, sheaf B)
2507"USAGE:     addSheaf(A,B); A sheaf, B sheaf
2508RETURN:     sheaf
2509THEORY:     This is the direct sum of two sheaves.
2510SEE ALSO:   quotSheaf, symmetricPowerSheaf, tensorSheaf, dualSheaf
2511EXAMPLE:    example addSheaf; shows an example
2512"
2513{
2514    sheaf S;
2515    variety V1 = A.currentVariety;
2516    variety V2 = B.currentVariety;
2517    def R1 = V1.baseRing;
2518    setring R1;
2519    poly c1 = A.ChernCharacter;
2520    def R2 = V2.baseRing;
2521    setring R2;
2522    poly c2 = B.ChernCharacter;
2523    if (nvars(R1) < nvars(R2))
2524    {
2525        S.currentVariety = V2;
2526        poly c = imap(R1,c1);
2527        S.ChernCharacter = c + c2;
2528        return (S);
2529    }
2530    else
2531    {
2532        setring R1;
2533        S.currentVariety = V1;
2534        poly c = imap(R2,c2);
2535        S.ChernCharacter = c1 + c;
2536        return (S);
2537    }
2538}
2539example
2540{
2541    "EXAMPLE:"; echo=2;
2542    variety G = Grassmannian(3,5);
2543    def r = G.baseRing;
2544    setring r;
2545    sheaf S = makeSheaf(G,subBundle);
2546    sheaf Q = makeSheaf(G,quotientBundle);
2547    sheaf D = S + Q;
2548    D;
2549    D.ChernCharacter == rankSheaf(D);
2550    totalChernClass(D) == 1;
2551}
Note: See TracBrowser for help on using the repository browser.