source: git/Singular/LIB/schubert.lib @ 823679

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