Changeset ac7280 in git


Ignore:
Timestamp:
Sep 12, 1997, 3:33:29 PM (27 years ago)
Author:
Hans Schönemann <hannes@…>
Branches:
(u'spielwiese', 'fe61d9c35bf7c61f2b6cbf1b56e25e2f08d536cc')
Children:
8c38a0e3c9888fd679d68714485e7ebc514f933b
Parents:
2a99baf62f13066b86adaabc31f813ac7023eacf
Message:
* hannes: removed the first codim from  sing.lib


git-svn-id: file:///usr/local/Singular/svn/trunk@723 2c84dea3-7e68-4137-9b89-c4e89433aadc
File:
1 edited

Legend:

Unmodified
Added
Removed
  • Singular/LIB/sing.lib

    r2a99ba rac7280  
    1 // $Id: sing.lib,v 1.5 1997-09-12 10:29:48 pohl Exp $
     1// $Id: sing.lib,v 1.6 1997-09-12 13:33:29 Singular Exp $
    22//system("random",787422842);
    33//(GMG/BM, last modified 26.06.96)
     
    2626LIB "inout.lib";
    2727LIB "random.lib";
    28 ///////////////////////////////////////////////////////////////////////////////
    29 
    30 proc codim (id1, id2)
    31 USAGE:   codim(id1,id2); id1,id2 ideal or module
    32 ASSUME:  both must be standard bases w.r.t. ordering ds or Ds or homogeneous
    33          and standardbases w.r.t. ordering dp or Dp
    34 RETURN:  int, which is:
    35          1. the codimension of id2 in id1, i.e. the vectorspace dimension of
    36             id1/id2 if id2 is contained in id1 and if this number is finite
    37          2. -1 if the dimension of id1/id2 is infinite
    38          3. -2 if id2 is not contained in id1,
    39 COMPUTE: consider the two hilberseries iv1(t) and iv2(t), then, in case 1.,
    40          q(t)=(iv2(t)-iv1(t))/(1-t)^n must be rational, and the result is the
    41          sum of the coefficients of q(t) (n number of variables)
    42 NOTE:    As always, id1 and id2 must be consider as ideals in the localization
    43          of the polynomial ring w.r.t. the monomial ordering
    44 EXAMPLE: example codim; shows an example
    45 {
    46    ideal le1, le2;
    47    intvec iv1, iv2, iv;
    48    int i, d1, d2, dd, i1, i2, ia, ie;
    49   //--------------------------- check id2 < id1 -------------------------------
    50    le1 = lead(id1);
    51    if (attrib(id1,"isSB") != 0)
    52    {
    53      attrib(le1,"isSB",1);
    54    }
    55    le2 = lead(id2);
    56    if (attrib(id2,"isSB") != 0)
    57    {
    58      attrib(le2,"isSB",1);
    59    }
    60    i = size(NF(le2,le1));
    61    if ( i > 0 )
    62    {
    63      return(-2);
    64    }
    65   //--------------------------- 1. check finiteness ---------------------------
    66    i1 = dim(le1);
    67    i2 = dim(le2);
    68    if (i1 <= 0)
    69    {
    70      if (i2 <= 0)
    71      {
    72        return(vdim(le2)-vdim(le1));
    73      }
    74      else
    75      {
    76        return(-1);
    77      }
    78    }
    79    if (i2 != i1)
    80    {
    81      return(-1);
    82    }
    83    if (mult(le2) != mult(le1))
    84    {
    85      return(-1);
    86    }
    87   //--------------------------- module ---------------------------------------
    88    d1 = nrows(le1);
    89    d2 = nrows(le2);
    90    dd = 0;
    91    if (d1 > d2)
    92    {
    93      le2=le2,maxideal(1)*gen(d1);
    94      dd = -1;
    95    }
    96    if (d2 > d1)
    97    {
    98      le1=le1,maxideal(1)*gen(d2);
    99      dd = 1;
    100    }
    101   //--------------------------- compute first hilbertseries ------------------
    102    iv1 = hilb(id1,1);
    103    i1 = size(iv1);
    104    iv2 = hilb(id2,1);
    105    i2 = size(iv2);
    106    kill le1,le2;
    107   //--------------------------- difference of hilbertseries ------------------
    108    if (i2 > i1)
    109    {
    110      for ( i=1; i<=i1; i=i+1)
    111      {
    112        iv2[i] = iv2[i]-iv1[i];
    113      }
    114      ie = i2;
    115      iv = iv2;
    116    }
    117    else
    118    {
    119      for ( i=1; i<=i2; i=i+1)
    120      {
    121        iv1[i] = iv2[i]-iv1[i];
    122      }
    123      iv = iv1;
    124      for (ie=i1;ie>=0;ie=ie-1)
    125      {
    126        if (ie == 0)
    127        {
    128          return(0);
    129        }
    130        if (iv[ie] != 0)
    131        {
    132          break;
    133        }
    134      }
    135    }
    136    ia = 1;
    137    while (iv[ia] == 0) { ia=ia+1; }
    138   //--------------------------- ia <= nonzeros <= ie -------------------------
    139    iv1 = iv[ia];
    140    for(i=ia+1;i<=ie;i=i+1)
    141    {
    142      iv1=iv1,iv[i];
    143    }
    144   //--------------------------- compute second hilbertseries -----------------
    145    iv2 = hilb(iv1);
    146   //--------------------------- check finitenes ------------------------------
    147    i2 = size(iv2);
    148    i1 = ie - ia + 1 - i2;
    149    if (i1 != nvars(basering))
    150    {
    151      return(-1);
    152    }
    153   //--------------------------- compute result -------------------------------
    154    i1 = 0;
    155    for ( i=1; i<=i2; i=i+1)
    156    {
    157      i1 = i1 + iv2[i];
    158    }
    159    return(i1+dd);
    160 }
    161 example
    162 { "EXAMPLE:"; echo = 2;
    163    ring r  = 0,(x,y,z),dp;
    164    ideal j = y6,x4;
    165    ideal m = x,y;
    166    attrib(m,"isSB",1);  //let Singular know that ideals are a standard basis
    167    attrib(j,"isSB",1); 
    168    codim(m,j);          // should be 23 (Milnor number -1 of y7-x5)
    169 }
    17028///////////////////////////////////////////////////////////////////////////////
    17129
Note: See TracChangeset for help on using the changeset viewer.