# source:git/Singular/LIB/schubert.lib@3686937

spielwiese
Last change on this file since 3686937 was 3686937, checked in by Oleksandr Motsak <motsak@…>, 10 years ago
Added '\$Id\$' as a comment to all libs (LIB/*.lib)
• Property mode set to `100644`
File size: 23.2 KB
Line
1//////////////////////////////////////////////////////////////////////////
2version="version schubert.lib 4.0.0.0 Jun_2013 "; // \$Id\$
3
4category="Algebraic Geometry";
5info="
6LIBRARY:    Schubert.lib   Proceduces for Intersection Theory
7
8AUTHOR:     Hiep Dang,  email: hiep@mathematik.uni-kl.de
9
10OVERVIEW:
11
12    We implement two new classes (variety and sheaf) and methods for computing
13    with them. Here a variety is represented by the dimension and the Chow ring.
14    A sheaf on a variety is represented by the Chern character.
15
16    In particular, we implement the concrete varieties such as projective spaces
17    , Grassmannians, and projective bundles. Finally, the most important thing
18    is a method for computing the intersection numbers (degrees of 0-cycles).
19
20PROCEDURES:
21    makeVariety(int,ideal)            create a variety
22    productVariety(variety,variety)   product of two varieties
23    ChowRing(variety)                 create the Chow ring of a variety
24    dimension(variety)                dimension of a variety
25    relations(variety)                relations of a variety
26    Grassmannian(int,int)             create a Grassmannian as a variety
27    projectiveSpace(int)              create a projective space as a variety
28    projectiveBundle(sheaf)           create a projective bundle as a variety
29    integral(variety,poly)            degree of a 0-cycle on a variety
30    makeSheaf(variety,poly)           create a sheaf
31    ChernCharacter(sheaf)             the Chern character of a sheaf
32    totalChernClass(sheaf)            the total Chern class of a sheaf
33    ChernClass(sheaf,int)             the k-th Chern class of a sheaf
34    topChernClass(sheaf)              the top Chern class of a sheaf
35    totalSegreClass(sheaf)            the total Segre class of a sheaf
36    dualSheaf(sheaf)                  the dual of a sheaf
37    tensorSheaf(sheaf,sheaf)          the tensor of two sheaves
38    symmetricPowerSheaf(sheaf,int)    the k-th symmetric power of a sheaf
39    minusSheaf(sheaf,sheaf)           the quotient of two sheaves
40    plusSheaf(sheaf,sheaf)            the direct sum of two sheaves
41
42REFERENCES:
43
44    Hiep Dang,  Intersection theory with applications to the computation of
45                Gromov-Witten invariants, Ph.D thesis, TU Kaiserslautern, 2013.
46
47    Sheldon Katz and Stein A. Stromme, Schubert-A Maple package for intersection
48                theory and enumerative geometry, 1992.
49
50    Daniel R. Grayson, Michael E. Stillman, Stein A. Stromme, David Eisenbud and
51    Charley Crissman, Schubert2-A Macaulay2 package for computation in
52                intersection theory, 2010.
53
54KEYWORDS:        Intersection Theory, Enumerative Geometry, Schubert Calculus
55";
56
57////////////////////////////////////////////////////////////////////////////////
58
59LIB "general.lib";
60LIB "homolog.lib";
61
62////////////////////////////////////////////////////////////////////////////////
63/// create new classes: varieties and sheaves //////////////////////////////////
64////////////////////////////////////////////////////////////////////////////////
65
66proc mod_init()
67{
68    newstruct("variety","int dimension, ring baseRing, ideal relations");
69    newstruct("sheaf","variety currentVariety, poly ChernCharacter");
70
71    system("install","variety","print",variety_print,1);
72    system("install","variety","*",productVariety,2);
73    system("install","sheaf","print",sheaf_print,1);
74    system("install","sheaf","*",tensorSheaf,2);
75    system("install","sheaf","+",plusSheaf,2);
76    system("install","sheaf","-",minusSheaf,2);
77}
78
79////////////////////////////////////////////////////////////////////////////////
80/// Auxilary Static Procedures in this Library /////////////////////////////////
81////////////////////////////////////////////////////////////////////////////////
82//////// - part     ////////////////////////////////////////////////////////////
83//////// - parts    ////////////////////////////////////////////////////////////
84//////// - logg     ////////////////////////////////////////////////////////////
85//////// - expp     ////////////////////////////////////////////////////////////
86//////// - adams    ////////////////////////////////////////////////////////////
87//////// - wedges   ////////////////////////////////////////////////////////////
88//////// - schur    ////////////////////////////////////////////////////////////
89////////////////////////////////////////////////////////////////////////////////
90
91proc part(poly f, int n)
92"USAGE:     part(f,n); f poly, n int
93RETURN:     poly
94PURPOSE:    return the homogeneous component of degree n of the polynomial f.
95EXAMPLE:    example part; shows examples
96"
97{
98    int i;
99    poly p;
100    for (i=1;i<=size(f);i++)
101    {
102        if (deg(f[i])==n) {p=p+f[i];}
103    }
104    return (p);
105}
106example
107{
108    "EXAMPLE:"; echo=2;
109    ring r = 0,(x,y,z),wp(1,2,3);
110    poly f = 1+x+x2+x3+x4+y+y2+y3+z+z2+xy+xz+yz+xyz;
111    part(f,0);
112    part(f,1);
113    part(f,2);
114    part(f,3);
115    part(f,4);
116    part(f,5);
117    part(f,6);
118}
119
120proc parts(poly f, int i, int j)
121"USAGE:     parts(f,i,j); f poly, i int, j int
122RETURN:     poly
123PURPOSE:    return a polynomial which is the sum of the homogeneous components
124            of degree from i to j of the polynomial f.
125EXAMPLE:    example parts; shows examples
126"
127{
128    int k;
129    poly p;
130    for (k=i;k<=j;k++)
131    {
132        p=p+part(f,k);
133    }
134    return (p);
135}
136example
137{
138    "EXAMPLE:"; echo=2;
139    ring r = 0,(x,y,z),wp(1,2,3);
140    poly f = 1+x+x2+x3+x4+y+y2+y3+z+z2+xy+xz+yz+xyz;
141    parts(f,2,4);
142}
143proc logg(poly f, int n)
144"USAGE:     logg(f,n); f poly, n int
145RETURN:     poly
146PURPOSE:    computing the Chern character from the total Chern class.
147EXAMPLE:    example logg; shows examples
148"
149{
150    poly p;
151    int i,j,k,m;
152    if (n==0) {p=0;}
153    if (n==1) {p=part(f,1);}
154    else
155    {
156        list l=-part(f,1);
157        for (j=2;j<=n;j++)
158        {
159            poly q;
160            for (k=1;k<j;k++)
161            {
162                q=q+part(f,k)*l[j-k];
163            }
164            q=-j*part(f,j)-q;
165            l=insert(l,q,size(l));
166            kill q;
167        }
168        for (m=1;m<=n;m++)
169        {
170            p=p+1/factorial(m)*(-1)^m*l[m];
171        }
172    }
173    return (p);
174}
175example
176{
177    "EXAMPLE:"; echo=2;
178    ring r = 0,(x,y),wp(1,2);
179    poly f = 1+x+y;
180    logg(f,4);
181}
182
183proc expp(poly f, int n)
184"USAGE:     expp(f,n); f poly, n int
185RETURN:     poly
186PURPOSE:    computing the total Chern class from the Chern character.
187EXAMPLE:    example expp; shows examples
188"
189{
190    poly p;
191    int i,j,k;
192    if (deg(f)==0) {p=1;}
193    else
194    {
195        list l=1;
196        for (i=1;i<=n;i++)
197        {
198            poly q;
199            for (j=1;j<=i;j++)
200            {
201                q=q+factorial(j)*(-1)^(j-1)*l[i-j+1]*part(f,j)/i;
202            }
203            l=insert(l,q,size(l));
204            kill q;
205        }
206        for (k=1;k<=size(l);k++)
207        {
208            p=p+l[k];
209        }
210    }
211    return (p);
212}
213example
214{
215    "EXAMPLE:"; echo=2;
216    ring r = 0,(x),dp;
217    poly f = 3+x;
218    expp(f,3);
219}
220
221static proc adams(poly f, int n)
222{
223    poly p;
224    int i;
225    for (i=0;i<=deg(f);i++)
226    {
227        p=p+n^i*part(f,i);
228    }
229    return (p);
230}
231
232static proc wedges(int n, poly f, int d)
233{
234    int i,j;
235    list l;
236    if (n==0) {l=1;}
237    if (n==1) {l=1,f;}
238    else
239    {
240        l=1,f;
241        for (i=2;i<=n;i++)
242        {
243            poly q;
244            for (j=1;j<=i;j++)
245            {
247            }
248            l=insert(l,q,size(l));
249            kill q;
250        }
251    }
252    return (l);
253}
254
255static proc schur(list p, poly f)
256{
257    int i,j;
258    int n = size(p);
259    matrix M[n][n];
260    for (i=1;i<=n;i++)
261    {
262        for (j=1;j<=n;j++)
263        {
264            M[i,j] = part(f,p[i]+j-i);
265        }
266    }
267    return (det(M));
268}
269
270////////////////////////////////////////////////////////////////////////////////
271//////// Procedures concerned with varieties ///////////////////////////////////
272////////////////////////////////////////////////////////////////////////////////
273
274proc variety_print(variety V)
275{
276    "A variety of dimension", V.dimension;
277}
278
279proc makeVariety(int d, ideal i)
280{
281    def R = basering;
282    variety V;
283    V.dimension = d;
284    V.baseRing = R;
285    V.relations = i;
286    return(V);
287}
288
289proc dimension(variety V)
290{
291    return (V.dimension);
292}
293
294proc ChowRing(variety V)
295{
296    def R = V.baseRing;
297    setring R;
298    ideal rels = V.relations;
299    qring CR = std(rels);
300    return (CR);
301}
302
303proc relations(variety V)
304{
305    def R = V.baseRing;
306    setring R;
307    ideal i = V.relations;
308    return (i);
309}
310
311////////////////////////////////////////////////////////////////////////////////
312
313proc Grassmannian(int k, int n, list #)
314"USAGE:     Grassmannian(k,n); k int, n int
315RETURN:     variety
316PURPOSE:    create a variety as a Grassmannian G(k,n). This variety has
317            diemnsion k(n-k) and its Chow ring is the quotient ring of a
318            polynomial ring in n-k variables q(1),...,q(n-k) which are the
319            Chern classes of the tautological quotient bundle on the
320            Grassmannian G(k,n), modulo the ideal generated by n-k polynomials
321            which come from the Giambelli formula. The monomial ordering of this
322            ring is 'wp' with vector (1..k,1..n-k). Moreover, we export the
323            Chern characters of the tautological subbundle and quotient bundle
324            on G(k,n) (say 'subBundle' and 'quotientBundle').
325EXAMPLE:    example Grassmannian; shows examples
326"
327{
328    string q;
329    if (size(#)==0) {q = "q";}
330    else
331    {
332        if (typeof(#[1]) == "string") {q = #[1];}
333        else {Error("invalid optional argument");}
334    }
335    variety G;
336    G.dimension = k*(n-k);
337    execute("ring r = 0,("+q+"(1..n-k)),wp(1..n-k);");
338    setring r;
339    G.baseRing = r;
340    int i,j;
341    poly v = 1;
342    poly u = 1;
343    for (j=1;j<=n-k;j++) {v=v+q(j);}
344    list l;
345    for (i=1;i<=k;i++)
346    {
347        l=insert(l,1,size(l));
348        u=u+(-1)^i*schur(l,v);
349    }
350    l=insert(l,1,size(l));
351    ideal rels = schur(l,v);
352    int h = k+2;
353    while (h<=n)
354    {
355        l=insert(l,1,size(l));
356        rels = rels,schur(l,v);
357        h++;
358    }
359    G.relations = rels;
360    int d = k*(n-k);
361    poly subBundle = reduce(logg(u,d)+k,std(rels));
362    poly quotientBundle = reduce(logg(v,d)+n-k,std(rels));
363    export (subBundle,quotientBundle);
364    kill u,v,d,l,rels;
365    return (G);
366}
367example
368{
369    "EXAMPLE:"; echo=2;
370    def G24 = Grassmannian(2,4);
371    G24;
372    def r = G24.baseRing;
373    subBundle;
374    quotientBundle;
375    G24.dimension;
376    G24.relations;
377    ChowRing(G24);
378}
379
380proc projectiveSpace(int n, list #)
381"USAGE:     projectiveSpace(n); n int
382RETURN:     variety
383PURPOSE:    create a variety as a projective space of dimension n. The Chow ring
384            is the quotient ring in one variable h modulo the ideal generated by
385            h^(n+1).
386EXAMPLE:    example projectiveSpace; shows examples
387"
388{
389    string h;
390    if (size(#)==0) {h = "h";}
391    else
392    {
393        if (typeof(#[1]) == "string") {h = #[1];}
394        else {Error("invalid optional argument");}
395    }
396    variety P;
397    P.dimension = n;
398    execute("ring r = 0, ("+h+"), wp(1);");
399    setring r;
400    P.baseRing = r;
401    ideal rels = var(1)^(n+1);
402    P.relations = rels;
403    poly u = 1;
404    poly v = 1 + var(1);
405    list l;
406    int i;
407    for (i=1;i<=n;i++)
408    {
409        l=insert(l,1,size(l));
410        u=u+(-1)^i*schur(l,v);
411    }
412    poly subBundle = reduce(logg(u,n)+n,std(rels));
413    poly quotientBundle = reduce(logg(v,n)+1,std(rels));
414    export(subBundle,quotientBundle);
415    kill rels,u,v,l;
416    return (P);
417}
418example
419{
420    "EXAMPLE:"; echo=2;
421    def P = projectiveSpace(3);
422    P;
423    P.dimension;
424    def r = P.baseRing;
425    setring r;
426    P.relations;
427    ChowRing(P);
428}
429
430proc projectiveBundle(sheaf S, list #)
431"USAGE:     projectiveBundle(S); S sheaf
432RETURN:     variety
433PURPOSE:    create a variety which we work on.
434EXAMPLE:    example projectiveBundle; shows examples
435"
436{
437    string z;
438    if (size(#)==0) {z = "z";}
439    else
440    {
441        if (typeof(#[1]) == "string") {z = #[1];}
442        else {Error("invalid optional argument");}
443    }
444    variety A;
445    def B = S.currentVariety;
446    def R = B.baseRing;
447    setring R;
448    ideal rels = B.relations;
449    int r = rankSheaf(S);
450    A.dimension = r - 1 + B.dimension;
451    poly c = totalChernClass(S);
452    execute("ring P = 0, ("+z+"), wp(1);");
453    def CR = P + R;
454    setring CR;
455    A.baseRing = CR;
456    poly c = imap(R,c);
457    ideal rels = imap(R,rels);
458    poly g = var(1)^r;
459    int i;
460    for (i=1;i<=r;i++) {g=g+var(1)^(r-i)*part(c,i);}
461    A.relations = rels,g;
462    poly u = 1 + var(1);
463    poly f = logg(u,A.dimension)+1;
464    poly QuotientBundle = reduce(f,std(A.relations));
465    export (QuotientBundle);
466    kill f,rels;
467    return (A);
468}
469example
470{
471    "EXAMPLE:"; echo=2;
472    def G35 = Grassmannian(3,5);
473    def R = G35.baseRing;
474    setring R;
475    def S = makeSheaf(G35, subBundle);
476    def B = symmetricPowerSheaf(dualSheaf(S),2);
477    def PB = projectiveBundle(B);
478    PB;
479    def P = PB.baseRing;
480    setring P;
481    QuotientBundle;
482    ChowRing(PB);
483}
484
485proc productVariety(variety U, variety V)
486{
487    //def br = basering;
488    def ur = U.baseRing; setring ur;
489    ideal ii1 = U.relations;
490    def vr = V.baseRing; setring vr;
491    ideal ii2 = V.relations;
492    variety W;
493    W.dimension = U.dimension + V.dimension;
494    def temp = ringtensor(ur,vr);
495    setring temp;
496    W.baseRing = temp;
497    ideal i1 = imap(ur,ii1);
498    ideal i2 = imap(vr,ii2);
499    W.relations = i1 + i2;
500    //setring br;
501    return (W);
502}
503
504////////////////////////////////////////////////////////////////////////////////
505
506proc integral(variety V, poly f)
507"USAGE:     integral(V,f); V variety, f poly
508RETURN:     int
509PURPOSE:    compute the intersection numbers.
510EXAMPLE:    example integral; shows examples
511"
512{
513    def R = V.baseRing;
514    setring R;
515    ideal rels = V.relations;
517}
518example
519{
520    "EXAMPLE:"; echo=2;
521    def G24 = Grassmannian(2,4);
522    def R = G24.baseRing;
523    setring R;
524    integral(G24,q(1)^4);
525}
526
527proc SchubertClass(list p)
528"USAGE:     SchubertClass(p); p list
529RETURN:     poly
530PURPOSE:    compute the Schubert class on a Grassmannian.
531EXAMPLE:    example SchubertClass; shows examples
532"
533{
534    def R = basering;
535    setring R;
536    poly f = 1;
537    if (size(p) == 0) {return (f);}
538    int i;
539    for (i=1;i<=nvars(R);i++)
540    {
541        f = f + var(i);
542    }
543    return (schur(p,f));
544}
545example
546{
547    "EXAMPLE:"; echo=2;
548    def G = Grassmannian(2,4);
549    def r = G.baseRing;
550    setring r;
551    list p = 1,1;
552    SchubertClass(p);
553}
554
555////////////////////////////////////////////////////////////////////////////////
556
557proc dualPartition(int k, int n, list p)
558{
559    while (size(p) < k)
560    {
561        p = insert(p,0,size(p));
562    }
563    int i;
564    list l;
565    for (i=1;i<=size(p);i++)
566    {
567        l[i] = n-k-p[size(p)-i+1];
568    }
569    return (l);
570}
571
572////////////////////////////////////////////////////////////////////////////////
573
574////////////////////////////////////////////////////////////////////////////////
575////////// Procedures concerned with sheaves ///////////////////////////////////
576////////////////////////////////////////////////////////////////////////////////
577
578////////////////////////////////////////////////////////////////////////////////
579
580proc sheaf_print(sheaf S)
581{
582    def V = S.currentVariety;
583    def R = V.baseRing;
584    setring R;
585    poly f = S.ChernCharacter;
586    "A sheaf of rank ", int(part(f,0));
587}
588
589proc makeSheaf(variety V, poly ch)
590{
591    def R = basering;
592    sheaf S;
593    S.currentVariety = V;
594    S.ChernCharacter = ch;
595    return(S);
596}
597
598proc currentVariety(sheaf S)
599{
600    return (S.currentVariety);
601}
602
603proc ChernCharacter(sheaf S)
604{
605    return (S.ChernCharacter)
606}
607
608proc rankSheaf(sheaf S)
609"USAGE:     rankSheaf(S); S sheaf
610RETURN:     int
611INPUT:      S -- a sheaf
612OUTPUT:     an integer which is the rank of the sheaf S.
613EXAMPLE:    example rankSheaf(S); shows examples
614"
615{
616    def V = S.currentVariety;
617    def R = V.baseRing;
618    setring R;
619    poly f = S.ChernCharacter;
620    return (int(part(f,0)));
621}
622example
623{
624    "EXAMPLE:"; echo=2;
625    def G24 = Grassmannian(2,4);
626    def R = G24.baseRing;
627    setring R;
628    def S = makeSheaf(G24,subBundle);
629    rankSheaf(S);
630}
631
632proc totalChernClass(sheaf S)
633"USAGE:     totalChernClass(S); f sheaf
634RETURN:     poly
635INPUT:      S -- a sheaf
636OUTPUT:     a polynomial which is the total Chern class of the sheaf S
637EXAMPLE:    example totalChernClass(S); shows examples
638"
639{
640    def V = S.currentVariety;
641    int d = V.dimension;
642    def R = V.baseRing;
643    setring R;
644    poly ch = S.ChernCharacter;
645    poly f = expp(ch,d);
646    ideal rels = std(V.relations);
647    return (reduce(f,rels));
648}
649
650proc ChernClass(sheaf S, int i)
651{
652    return (part(totalChernClass(S),i));
653}
654
655proc topChernClass(sheaf S)
656"USAGE:     topChernClass(S); S sheaf
657RETURN:     poly
658INPUT:      S -- a sheaf
659OUTPUT:     the top Chern class of the sheaf S
660EXAMPLE:    example topChernClass(S); shows examples
661"
662{
663    return (ChernClass(S,rankSheaf(S)));
664}
665example
666{
667    "EXAMPLE:"; echo=2;
668    def G24 = Grassmannian(2,4);
669    def R = G24.baseRing;
670    setring R;
671    def S = makeSheaf(G24,quotientBundle);
672    def B = symmetricPowerSheaf(S,3);
673    topChernClass(B);
674}
675
676proc totalSegreClass(sheaf S)
677"USAGE:     totalSegreClass(S); S sheaf
678RETURN:     poly
679INPUT:      S -- a sheaf
680OUTPUT:     a polynomial which is the total Segre class of the sheaf S.
681EXAMPLE:    example totalSegreClass(S); shows examples
682"
683{
684    //def D = dualSheaf(S);
685    def V = S.currentVariety;
686    def R = V.baseRing;
687    setring R;
688    poly f = totalChernClass(S);
689    poly g;
690    int d = V.dimension;
691    ideal rels = std(V.relations);
692    if (f == 1) {return (1);}
693    else
694    {
695        poly t,h;
696        int i,j;
697        for (i=0;i<=d;i++) {t = t + (1-f)^i;}
698        for (j=0;j<=d;j++) {h = h + part(t,j);}
699        return (reduce(h,rels));
700    }
701}
702example
703{
704    "EXAMPLE:"; echo=2;
705    def G24 = Grassmannian(2,4);
706    def R = G24.baseRing;
707    setring R;
708    def S = makeSheaf(G24,subBundle);
709    totalSegreClass(S);
710}
711
712proc dualSheaf(sheaf S)
713"USAGE:     dualSheaf(S); S sheaf
714RETURN:     sheaf
715INPUT:      S -- a sheaf
716OUTPUT:     the dual of the sheaf S
717EXAMPLE:    example dualSheaf(S); shows examples
718"
719{
720    def V = S.currentVariety;
721    int d = V.dimension;
722    def R = V.baseRing;
723    setring R;
724    poly ch = S.ChernCharacter;
725    poly f = adams(ch,-1);
726    sheaf D;
727    D.currentVariety = V;
728    D.ChernCharacter = f;
729    return (D);
730}
731example
732{
733    "EXAMPLE:"; echo=2;
734    def G24 = Grassmannian(2,4);
735    def R = G24.baseRing;
736    setring R;
737    def S = makeSheaf(G24,subBundle);
738    dualSheaf(S);
739}
740
741proc tensorSheaf(sheaf A, sheaf B)
742"USAGE:     tensorSheaf(A,B); A sheaf, B sheaf
743RETURN:     sheaf
744INPUT:      A, B -- two sheaves
745OUTPUT:     the tensor of two sheaves A and B
746EXAMPLE:    example tensorSheaf(A,B); shows examples
747"
748{
749    sheaf S;
750    def V1 = A.currentVariety;
751    def V2 = B.currentVariety;
752    def R1 = V1.baseRing;
753    setring R1;
754    poly c1 = A.ChernCharacter;
755    def R2 = V2.baseRing;
756    setring R2;
757    poly c2 = B.ChernCharacter;
758    if (nvars(R1) < nvars(R2))
759    {
760        S.currentVariety = V2;
761        poly c = imap(R1,c1);
762        poly f = parts(c*c2,0,V2.dimension);
763        S.ChernCharacter = f;
764        return (S);
765    }
766    else
767    {
768        setring R1;
769        S.currentVariety = V1;
770        poly c = imap(R2,c2);
771        poly f = parts(c1*c,0,V1.dimension);
772        S.ChernCharacter = f;
773        return (S);
774    }
775}
776example
777{
778    "EXAMPLE:"; echo=2;
779    def G34 = Grassmannian(3,4);
780    def R = G34.baseRing;
781    setring R;
782    def S = makeSheaf(G34,subBundle);
783    def Q = makeSheaf(G34, quotientBundle);
784    S*Q;
785}
786
787proc symmetricPowerSheaf(sheaf S, int n)
788"USAGE:     symmetricPowerSheaf(S,n); S sheaf, n int
789RETURN:     sheaf
790INPUT:      S -- a sheaf
791            n -- an integer
792OUTPUT:     the n-th symmetric power of the sheaf S
793EXAMPLE:    example symmetricPowerSheaf(S,n); shows examples
794"
795{
796    def V = S.currentVariety;
797    def R = V.baseRing;
798    setring R;
799    int r = rankSheaf(S);
800    int d = V.dimension;
801    int i,j,m;
802    poly f = S.ChernCharacter;
803    poly result;
804    list s,w;
805    if (n==0) {result=1;}
806    if (n==1) {result=f;}
807    else
808    {
809        s = 1,f;
810        w = wedges(n,f,d);
811        for (i=2;i<=n;i++)
812        {
813            if (i<=r) {m=i;}
814            else {m=r;}
815            poly q;
816            for (j=1;j<=m;j++)
817            {
818                q = q + ((-1)^(j+1))*parts(w[j+1]*s[i-j+1],0,d);
819            }
820            s = insert(s,q,size(s));
821            kill q;
822        }
823        result = s[n+1];
824    }
825    sheaf A;
826    A.currentVariety = V;
827    A.ChernCharacter = result;
828    return (A);
829}
830example
831{
832    "EXAMPLE:"; echo=2;
833    def G24 = Grassmannian(2,4);
834    def R = G24.baseRing;
835    setring R;
836    def S = makeSheaf(G24,quotientBundle);
837    def B = symmetricPowerSheaf(S,3);
838    B;
839}
840
841proc minusSheaf(sheaf A, sheaf B)
842{
843    sheaf S;
844    def V1 = A.currentVariety;
845    def V2 = B.currentVariety;
846    def R1 = V1.baseRing;
847    setring R1;
848    poly c1 = A.ChernCharacter;
849    def R2 = V2.baseRing;
850    setring R2;
851    poly c2 = B.ChernCharacter;
852    if (nvars(R1) < nvars(R2))
853    {
854        S.currentVariety = V2;
855        poly c = imap(R1,c1);
856        S.ChernCharacter = c - c2;
857        return (S);
858    }
859    else
860    {
861        setring R1;
862        S.currentVariety = V1;
863        poly c = imap(R2,c2);
864        S.ChernCharacter = c1 - c;
865        return (S);
866    }
867}
868
869proc plusSheaf(sheaf A, sheaf B)
870{
871    sheaf S;
872    def V1 = A.currentVariety;
873    def V2 = B.currentVariety;
874    def R1 = V1.baseRing;
875    setring R1;
876    poly c1 = A.ChernCharacter;
877    def R2 = V2.baseRing;
878    setring R2;
879    poly c2 = B.ChernCharacter;
880    if (nvars(R1) < nvars(R2))
881    {
882        S.currentVariety = V2;
883        poly c = imap(R1,c1);
884        S.ChernCharacter = c + c2;
885        return (S);
886    }
887    else
888    {
889        setring R1;
890        S.currentVariety = V1;
891        poly c = imap(R2,c2);
892        S.ChernCharacter = c1 + c;
893        return (S);
894    }
895}
896
897////////////////////////////////////////////////////////////////////////////////
898
899proc geometricMultiplicity(ideal I, ideal J)
900"USAGE:     geometricMultiplicity(I,J); I,J = ideals
901RETURN:     int
902INPUT:      I, J -- two ideals
903OTPUT:      an integer which is the intersection multiplicity of two subvarieties
904            defined by the ideals I, J at the origin.
905EXAMPLE:    example geometricMultiplicity(I,J); shows examples
906"
907{
908    def R = basering;
909    setring R;
910    ideal K = I + J;
911    int v = vdim(std(K));
912    return (v);
913}
914example
915{
916    "EXAMPLE:"; echo=2;
917    ring r = 0, (x,y,z,w), ds;
918    ideal I = xz,xw,yz,yw;
919    ideal J = x-z,y-w;
920    geometricMultiplicity(I,J);
921}
922
923////////////////////////////////////////////////////////////////////////////////
924
925proc serreMultiplicity(ideal I, ideal J)
926"USAGE:     serreMultiplicity(I,J); I,J = ideals
927RETURN:     int
928INPUT:      I, J -- two ideals
929OUTPUT:     the intersection multiplicity (defined by J. P. Serre)
930            of two subvarieties defined by the ideals I, J at the origin.
931EXAMPLE:    example serreMultiplicity(I,J); shows examples
932"
933{
934    def R = basering;
935    setring R;
936    int i = 0;
937    int s = 0;
938    module m = std(Tor(i,I,J));
939    int t = sum(hilb(m,2));
940    kill m;
941    while (t != 0)
942    {
943        s = s + ((-1)^i)*t;
944        i++;
945        module m = std(Tor(i,I,J));
946        t = sum(hilb(m,2));
947        kill m;
948    }
949    return (s);
950}
951example
952{
953    "EXAMPLE:"; echo=2;
954    ring r = 0, (x,y,z,w), ds;
955    ideal I = xz,xw,yz,yw;
956    ideal J = x-z,y-w;
957    serreMultiplicity(I,J);
958}
Note: See TracBrowser for help on using the repository browser.