Changeset 31e974 in git for Singular


Ignore:
Timestamp:
May 10, 2013, 10:20:08 AM (11 years ago)
Author:
Hans Schoenemann <hannes@…>
Branches:
(u'spielwiese', 'fe61d9c35bf7c61f2b6cbf1b56e25e2f08d536cc')
Children:
e5ecb5d7da3a3a0cdf0adcafcac47e81f1901433
Parents:
9b3ad3d7d7e4664e8d3edba66cf01c3625bda816
git-author:
Hans Schoenemann <hannes@mathematik.uni-kl.de>2013-05-10 10:20:08+02:00
git-committer:
Hans Schoenemann <hannes@mathematik.uni-kl.de>2013-05-10 10:24:55+02:00
Message:
chg: new version of schubert.lib
File:
1 edited

Legend:

Unmodified
Added
Removed
  • Singular/LIB/schubert.lib

    r9b3ad3 r31e974  
    11////////////////////////////////////////////////////////////////////////////////
    2 version="1.0";
     2version="Id";
    33
    44category="Algebraic Geometry";
    55info="
    6 LIBRARY:    schubert.lib   Proceduces for Intersection Theory
     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).
    719
    820PROCEDURES:
    9     projectiveSpace(n)     Chow ring of projective space of dimension n
    10     grassmannian(k,n)      Chow ring of Grassmannian of k-planes on an n-space
    11     projectiveBundle(f,d)  Chow ring of projective bundles
    12     grassmannBundle(k,f,d) Chow ring of Grassmann bundles
    13     integral(f)            compute intersection number
    14     dual(f)                dual of a vector bundle
    15     tensorBundle(f,g,d)    tensor of two vector bundles
    16     symmPower(n,f,d)       n-th symmetric power of a vector bundle
    17     chern(f,d)             total Chern class of a vector bundle
    18     segre(f,d)             total Segre class of a vector bundle
    19     rankBundle(f)          rank of a vector bundle
     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.
    2053
    2154KEYWORDS:        Intersection Theory, Enumerative Geometry, Schubert Calculus
     
    2558
    2659LIB "general.lib";
    27 
    28 ////////////////////////////////////////////////////////////////////////////////
    29 
    30 ////////////////////////////////////////////////////////////////////////////////
    31 /// Procedures concerned with abstract varieties ///////////////////////////////
    32 ////////////////////////////////////////////////////////////////////////////////
    33 
    34 ////////////////////////////////////////////////////////////////////////////////
    35 
    36 proc projectiveSpace(int n)
    37 "USAGE: projectiveSpace(n); n int
    38 RETURN:     ring
    39 PURPOSE:    create a polynomial ring in one variable h, where h is the hyperplane
    40             class of this projective space. The monomial ordering of this ring is
    41             'wp' (weighted reverse lexicographical ordering) with vector (1).
    42             Moreover, we export an ideal (say 'rels') generated by h^{n+1} and
    43             the quotient ring modulo this ideal should be its Chow ring.
    44 EXAMPLE: example projectiveSpace; shows examples
    45 "
    46 {
    47     ring CR = 0, (h), wp(1);
    48     int d = n;
    49     poly u = 1;
    50     poly v = 1 + h;
    51     list l;
    52     int i;
    53     for (i=1;i<=n;i++)
    54     {
    55         l=insert(l,1,size(l));
    56         u=u+(-1)^i*schur(l,v);
    57     }
    58     ideal rels = h^(n+1);
    59     rels = std(rels);
    60     poly s = reduce(logg(u,d)+n,rels);
    61     poly q = reduce(logg(v,d)+1,rels);
    62     export (s,q,rels);
    63     return (CR);
    64 }
    65 example
    66 {
    67     "EXAMPLE:"; echo=2;
    68     def P3 = projectiveSpace(3);
    69     setring P3;
    70     s; q; rels;
    71 }
    72 
    73 proc grassmannian(int k, int n)
    74 "USAGE: grassmannian(k,n); k int, n int
    75 RETURN:     ring
    76 PURPOSE:    create a polynomial ring in n variables, in which the first k
    77             variables s(1),...,s(k) will be the Chern classes of the
    78             tautological subbundle on Grassmannian G(k,n) and the next n-k
    79             variables q(1),...,q(n-k) will be the Chern classes of the
    80             tautological quotient bundle on G(k,n). The monomial ordering
    81             of this ring is 'wp' (weighted reverse lexicographical ordering)
    82             with vector (1..k,1..n-k).
    83             Moreover, we export the Chern characters of the tautological
    84             subbundle and quotient bundle on G(k,n) (say 's' and 'q'). They
    85             are the polynomials. One more thing, we export an ideal
    86             (say 'rels') generated by the relations between the Chern
    87             variables and the quotient ring modulo this ideal should be Chow
    88             ring of G(k,n).
    89 EXAMPLE: example grassmannian; shows examples
    90 "
    91 {
    92     ring CR = 0, (q(1..n-k)), wp(1..n-k);
    93     int d = k*(n-k);
    94     int i,j,h;
    95     poly v = 1;
    96     poly u = 1;
    97     for (j=1;j<=n-k;j++) {v=v+q(j);}
    98     list l;
    99     for (i=1;i<=k;i++)
    100     {
    101         l=insert(l,1,size(l));
    102         u=u+(-1)^i*schur(l,v);
    103     }
    104     ideal rels;
    105     for (h=k+1;h<=n;h++)
    106     {
    107         l=insert(l,1,size(l));
    108         rels=rels,schur(l,v);
    109     }
    110     rels = std(rels);
    111     poly s = reduce(logg(u,d)+k,rels);
    112     poly q = reduce(logg(v,d)+n-k,rels);
    113     export (s,q,rels);
    114     return (CR);
    115 }
    116 example
    117 {
    118     "EXAMPLE:"; echo=2;
    119     def G24 = grassmannian(2,4);
    120     setring G24;
    121     s; q; rels;
    122 }
    123 
    124 ////////////////////////////////////////////////////////////////////////////////
    125 
    126 proc projectiveBundle(poly f, int d)
    127 "USAGE: projectiveBundle(f,d); f poly, d int
    128 RETURN:     ring
    129 PURPOSE:    create a polynomial ring which we work on.
    130             we export an ideal (say 'rels') generated by the relations between
    131             the Chern variables and the quotient ring modulo this ideal should
    132             be its Chow ring.
    133 EXAMPLE: example projectiveBundle; shows examples
    134 "
    135 {
    136     def R = basering;
    137     setring R;
    138     int r = rankBundle(f);
    139     poly c = chern(f,d);
    140     ring P = 0, (z), wp(1);
    141     def CR = P + R;
    142     setring CR;
    143     int dd = r-1 + d;
    144     poly c = imap(R,c);
    145     ideal rels = imap(R,rels);
    146     poly g = z^r;
    147     int i;
    148     for (i=1;i<=r;i++) {g=g+z^(r-i)*part(c,i);}
    149     rels=std(rels,g);
    150     poly u = 1 + z;
    151     poly Q = reduce(logg(u,dd)+1,rels);
    152     export (rels,Q);
    153     return (CR);
    154 }
    155 example
    156 {
    157     "EXAMPLE:"; echo=2;
    158     def G35 = grassmannian(3,5);
    159     setring G35;
    160     int d = 6;
    161     poly f = symmPower(2,dual(s),6);
    162     def PB = projectiveBundle(f,6);
    163     setring PB;
    164     int d = 14;
    165     Q; rels;
    166 }
    167 ////////////////////////////////////////////////////////////////////////////////
    168 
    169 proc grassmannBundle(int k, poly f, int d)
    170 "USAGE: grassmannBundle(k,f,d); k int, f poly, d int
    171 RETURN:     ring
    172 PURPOSE:    create a polynomial ring which we work on.
    173             we export the Chern characters of the tautological subbundle and
    174             quotient bundle on this Grassmann bundle (say 'S' and 'Q').
    175             They are the polynomials. One more thing, we also export an ideal
    176             (say 'rels') generated by the relations between the Chern variables
    177             and the quotient ring modulo this ideal should be its Chow ring.
    178 EXAMPLE: example grassmannBundle; shows examples
    179 "
    180 {
    181     def R = basering;
    182     setring R;
    183     int r = rankBundle(f);
    184     ring G = 0, (S(1..k),Q(1..r-k)), wp(1..k,1..r-k);
    185     def CR = G + R;
    186     setring CR;
    187     int dd = k*(r-k)+d;
    188     poly f = imap(R,f);
    189     ideal rels = imap(R,rels);
    190     poly u = 1;
    191     poly v = 1;
    192     int i,j,h;
    193     for (i=1;i<=k;i++) {u=u+S(i);} 
    194     for (j=1;j<=r-k;j++) {v=v+Q(j);}
    195     poly g = u*v;
    196     ideal I = part(g,1)-part(expp(f,r),1);
    197     for (h=2;h<=r;h++) {I = I,part(g,h)-part(expp(f,r),h);}
    198     def J = I + rels;
    199     ideal rels = std(J);
    200     poly S = reduce(logg(u,dd)+k,rels);
    201     poly Q = reduce(logg(v,dd)+r-k,rels);
    202     export (rels,S,Q);
    203     return (CR);
    204 }
    205 example
    206 {
    207     "EXAMPLE:"; echo=2;
    208     def G25 = grassmannian(2,5);
    209     setring G25;
    210     int d = 6;
    211     poly f = dual(symmPower(2,q,6));
    212     def GB = grassmannBundle(5,f,6);
    213     setring GB;
    214     int d = 14;
    215     S; Q; rels;
    216 }
    217 
    218 ////////////////////////////////////////////////////////////////////////////////
     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}
    21978
    22079////////////////////////////////////////////////////////////////////////////////
    22180/// Auxilary Static Procedures in this Library /////////////////////////////////
    22281////////////////////////////////////////////////////////////////////////////////
    223 /// - part
    224 /// - parts
    225 /// - logg
    226 /// - expp
    227 /// - adams
    228 /// - wedges
    229 /// - integral
    230 ////////////////////////////////////////////////////////////////////////////////
    231 
    232 ////////////////////////////////////////////////////////////////////////////////
    233 
    234 static proc part(poly f, int n)
     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"
    23597{
    23698    int i;
     
    238100    for (i=1;i<=size(f);i++)
    239101    {
    240         if (deg(f[i])==n)
    241         {
    242             p=p+f[i];
    243         }
     102        if (deg(f[i])==n) {p=p+f[i];}
    244103    }
    245104    return (p);
    246105}
    247 
    248 ////////////////////////////////////////////////////////////////////////////////
    249 
    250 static proc parts(poly f, int i, int j)
     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"
    251127{
    252128    int k;
     
    258134    return (p);
    259135}
    260 
    261 ////////////////////////////////////////////////////////////////////////////////
    262 
    263 static proc logg(poly f, int n)
     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"
    264149{
    265150    poly p;
     
    288173    return (p);
    289174}
    290 
    291 ////////////////////////////////////////////////////////////////////////////////
    292 
    293 static proc expp(poly f, int n)
     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"
    294189{
    295190    poly p;
     
    316211    return (p);
    317212}
    318 
    319 ////////////////////////////////////////////////////////////////////////////////
     213example
     214{
     215    "EXAMPLE:"; echo=2;
     216    ring r = 0,(x),dp;
     217    poly f = 3+x;
     218    expp(f,3);
     219}
    320220
    321221static proc adams(poly f, int n)
     
    329229    return (p);
    330230}
    331 
    332 ////////////////////////////////////////////////////////////////////////////////
    333231
    334232static proc wedges(int n, poly f, int d)
     
    355253}
    356254
    357 ////////////////////////////////////////////////////////////////////////////////
    358 
    359255static proc schur(list p, poly f)
    360256{
     
    373269
    374270////////////////////////////////////////////////////////////////////////////////
    375 
    376 proc integral(poly f)
    377 "USAGE: integral(f); f poly
     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
    378508RETURN:     int
    379 PURPOSE:    compute the intersection number.
    380             That is the degree of top Chern class.
    381 EXAMPLE: example integral; shows examples
    382 "
    383 {
    384     return (leadcoef(reduce(f,rels)));
    385 }
    386 example
    387 {
    388     "EXAMPLE:"; echo=2;
    389     def G25 = grassmannian(2,5);
    390     setring G25;
    391     integral(q(2)^3);
    392 }
    393 
    394 ////////////////////////////////////////////////////////////////////////////////
    395 
    396 ////////////////////////////////////////////////////////////////////////////////
    397 /// Procedures concerned with vector bundles ///////////////////////////////////
    398 ////////////////////////////////////////////////////////////////////////////////
    399 
    400 ////////////////////////////////////////////////////////////////////////////////
    401 
    402 proc symmPower(int n, poly f, int d)
    403 "USAGE: symmPower(n,f,d); n int, f poly, d 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;
     516    return (leadcoef(reduce(f,std(rels))));
     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
    404529RETURN:     poly
    405 INPUT:      n -- integer
    406             f -- Chern character of a given vector bundle
    407             d -- dimension of current variety.
    408 OUTPUT:     a polynomial which is the Chern character of the n-th symmetric
    409             power of the vector bundle defined by 'f'
    410 EXAMPLE: example symmPower(n,f,d); shows examples
    411 "
    412 {
     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;
    413801    int i,j,m;
    414     int r = rankBundle(f);
     802    poly f = S.ChernCharacter;
    415803    poly result;
    416804    list s,w;
     
    435823        result = s[n+1];
    436824    }
    437     return (result);
    438 }
    439 example
    440 {
    441     "EXAMPLE:"; echo=2;
    442     def G24 = grassmannian(2,4);
    443     setring G24;
    444     int d = 4;
    445     symmPower(3,q,d);
    446 }
    447 ////////////////////////////////////////////////////////////////////////////////
    448 
    449 proc dual(poly f)
    450 "USAGE: dual(f); f poly
    451 RETURN:     poly
    452 INPUT:      f -- Chern character of a vector bundle
    453 OUTPUT:     a polynomial which is the Chern character of the dual of the vector
    454             bundle defined by 'f'.
    455 EXAMPLE: example dual(f); shows examples
    456 "
    457 {
    458     return (adams(f,-1));
    459 }
    460 example
    461 {
    462     "EXAMPLE:"; echo=2;
    463     def G24 = grassmannian();
    464     setring G24;
    465     dual(s);
    466 }
    467 
    468 ////////////////////////////////////////////////////////////////////////////////
    469 
    470 proc tensorBundle(poly f, poly g, int d)
    471 "USAGE: tensorBundle(f,g,d); f poly, g poly, d int
    472 RETURN:     poly
    473 INPUT:      f, g -- Chern characters of two vector bundles
    474             d -- dimension of current variety.
    475 OUTPUT:     a polynomial which is the Chern character of the tensor of two
    476             vector bundles defined by 'f' and 'g' respectively.
    477 EXAMPLE: example tensorBundle(f,g,d); shows examples
    478 "
    479 {
    480     return (parts(f*g,0,d));
    481 }
    482 example
    483 {
    484     "EXAMPLE:"; echo=2;
    485     def G34 = grassmannian(3,4);
    486     setring G34;
    487     int d = 3;
    488     tensorBundle(s,q,d);
    489 }
    490 
    491 ////////////////////////////////////////////////////////////////////////////////
    492 
    493 proc chern(poly f, int d)
    494 "USAGE: chern(f,d); f poly, d int
    495 RETURN:     poly
    496 INPUT:      f -- Chern character of a given vector bundle
    497             d -- dimension of current variety
    498 OUTPUT:     a polynomial which is the total Chern class of the vector bundle
    499             defined by 'f'.
    500 EXAMPLE: example chern(f,d); shows examples
    501 "
    502 {
    503     poly c = reduce(expp(f,d),rels);
    504     return (c);
    505 }
    506 example
    507 {
    508     "EXAMPLE:"; echo=2;
    509     def G24 = grassmannian(2,4);
    510     setring G24;
    511     int d = 4;
    512     chern(q,d);
    513 }
    514 
    515 ////////////////////////////////////////////////////////////////////////////////
    516 
    517 proc segre(poly f, int d)
    518 "USAGE: segre(f,d); f poly, d int
    519 RETURN:     poly
    520 INPUT:      f -- Chern character of a given vector bundle
    521             d -- dimension of current variety
    522 OUTPUT:     a polynomial which is the total Segre class of the vector bundle
    523             defined by 'f'.
    524 EXAMPLE: example segre(f,d); shows examples
    525 "
    526 {
    527     poly g = dual(chern(f,d));
    528     if (g==1) {return (1);}
    529     else
    530     {
    531         poly t,h;
    532         int i,j;
    533         for (i=0;i<=d;i++) {t = t + (1-g)^i;}
    534         for (j=0;j<=d;j++) {h = h + part(t,j);}
    535         return (reduce(h,rels));
    536     }
    537 }
    538 example
    539 {
    540     "EXAMPLE:"; echo=2;
    541     def G24 = grassmannian(2,4);
    542     setring G24;
    543     int d = 4;
    544     segre(q,d);
    545 }
    546 
    547 ////////////////////////////////////////////////////////////////////////////////
    548 
    549 proc rankBundle(poly f)
    550 "USAGE: rankBundle(f); f poly
    551 RETURN:     poly
    552 INPUT:      f -- Chern character of a given vector bundle
    553 OUTPUT:     an integer which is the rank of the vector bundle defined by 'f'.
    554 EXAMPLE: example rankBundle(f); shows examples
    555 "
    556 {
    557     return (int(part(f,0)));
    558 }
    559 example
    560 {
    561     "EXAMPLE:"; echo=2;
    562     def G24 = grassmannian(2,4);
    563     setring G24;
    564     int d = 4;
    565     rankBundle(q);
    566 }
     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 TracChangeset for help on using the changeset viewer.