Changeset 6f2edc in git for Singular/LIB/elim.lib


Ignore:
Timestamp:
Apr 28, 1997, 9:27:25 PM (27 years ago)
Author:
Olaf Bachmann <obachman@…>
Branches:
(u'spielwiese', 'e7cc1ebecb61be8b9ca6c18016352af89940b21a')
Children:
8c5a578cc8481c8a133a58030c4c4c8227d82bb1
Parents:
6d09c564c80f079b501f7187cf6984d040603849
Message:
Mon Apr 28 21:00:07 1997  Olaf Bachmann
<obachman@ratchwum.mathematik.uni-kl.de (Olaf Bachmann)>

     * dunno why I am committing these libs -- have not modified any
       of them


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

Legend:

Unmodified
Added
Removed
  • Singular/LIB/elim.lib

    r6d09c56 r6f2edc  
    1 // $Id: elim.lib,v 1.1.1.1 1997-04-25 15:13:25 obachman Exp $
    2 //system("random",787422842);
    3 //(GMG)
     1// $Id: elim.lib,v 1.2 1997-04-28 19:27:16 obachman Exp $
     2// system("random",787422842);
     3// (GMG, last modified 22.06.96)
    44///////////////////////////////////////////////////////////////////////////////
    55
    66LIBRARY:  elim.lib      PROCEDURES FOR ELIMINATIOM, SATURATION AND BLOWING UP
    77
    8  blowup0(j[,s1,s2]);    create presentation of blownup ring of ideal j 
     8 blowup0(j[,s1,s2]);    create presentation of blownup ring of ideal j
    99 elim(id,n,m);          variable n..m eliminated from id (ideal/module)
    10  elim1(id,p);           p=product of vars to be eliminated from id 
     10 elim1(id,p);           p=product of vars to be eliminated from id
    1111 nselect(id,n[,m]);     select generators not containing nth [..mth] variable
    12  sat(id,j);             saturated quotient of ideal/module id by ideal j 
     12 sat(id,j);             saturated quotient of ideal/module id by ideal j
    1313 select(id,n[,m]);      select generators containing nth [..mth] variable
    1414           (parameters in square brackets [] are optional)
     
    2020
    2121proc blowup0 (ideal j,list #)
    22 USAGE:   blowup0(j[,s1,s2]); j ideal, s1,s2 nonempty strings 
    23 CREATE:  Create a presentation of the blowup ring of j 
     22USAGE:   blowup0(j[,s1,s2]); j ideal, s1,s2 nonempty strings
     23CREATE:  Create a presentation of the blowup ring of j
    2424RETURN:  no return value
    2525NOTE:    s1 and s2 are used to give names to the blownup ring and the blownup
    2626         ideal (default: s1="j", s2="A")
    2727         Assume R = char,x(1..n),ord is the basering of j, and s1="j", s2="A"
    28          then the procedure creates a new basering with name Bl_jR
     28         then the procedure creates a new ring with name Bl_jR
    2929         (equal to R[A,B,...])
    30                Bl_jR = char,(A,B,...,x(1..n)),(dp(k),ord) 
    31          with k=ncols(j) new variables A,B,... and ordering wp(d1..dk) if j is 
     30               Bl_jR = char,(A,B,...,x(1..n)),(dp(k),ord)
     31         with k=ncols(j) new variables A,B,... and ordering wp(d1..dk) if j is
    3232         homogeneous with deg(j[i])=di resp. dp otherwise for these vars.
    33          If k>26 or size(s2)>1, say s2="A()", the new vars are A(1),...,A(k). 
     33         If k>26 or size(s2)>1, say s2="A()", the new vars are A(1),...,A(k).
    3434         Let j_ be the kernel of the ring map Bl_jR -> R defined by A(i)->j[i],
    3535         x(i)->x(i), then the quotient ring Bl_jR/j_ is the blowup ring of j
    3636         in R (being isomorphic to R+j+j^2+...). Moreover the procedure creates
    37          a std basis of j_ with name j_ and Bl_jR as basering.
    38 EXAMPLE: example blowup0; shows an example
     37         a std basis of j_ with name j_ in Bl_jR.
     38         This proc uses 'execute' or calls a procedure using 'execute'.
     39DISPLAY: printlevel >=0: explain created objects (default)
     40EXAMPLE: example blowup0; shows examples
    3941{
    4042   string bsr = nameof(basering);
    4143   def br = basering;
    42    string cr, vr, o = charstr(br), varstr(br), ordstr(br);
    43    int n, k = nvars(br), ncols(j);
    44    int i;
     44   string cr,vr,o = charstr(br),varstr(br),ordstr(br);
     45   int n,k,i = nvars(br),ncols(j),0;
     46   int p = printlevel-voice+3;  // p=printlevel+1 (default: p=1)
    4547//---------------- create coordinate ring of blown up space -------------------
    4648   if( size(#)==0 ) { #[1] = "j"; #[2] = "A"; }
     
    4850   if( k<=26 and size(#[2])==1 ) { string nv = A_Z(#[2],k)+","; }
    4951   else { string nv = (#[2])[1]+"(1.."+string(k)+"),"; }
    50    if( ishomog(j) )
    51    { 
     52   if( is_homog(j) )
     53   {
    5254      intvec v=1;
    53       for( i=1; i<=k; i++) { v[i+1]=deg(j[i]); }
     55      for( i=1; i<=k; i=i+1) { v[i+1]=deg(j[i]); }
    5456      string nor = "),(wp(v),";
    5557   }
     
    5860//---------- map to new ring, eliminate and create blown up ideal -------------
    5961   ideal j=imap(br,j);
    60    for( i=1; i<=k; i++) { j[i]=var(1+i)-t*j[i]; }
     62   for( i=1; i<=k; i=i+1) { j[i]=var(1+i)-t*j[i]; }
    6163   j=eliminate(j,t);
    6264   v=v[2..size(v)];
     
    6567   export basering;
    6668   export `#[1]+"_"`;
    67    keepring basering;
     69   //keepring basering;
     70   setring br;
    6871//------------------- some comments about usage and names  --------------------
    69    if( voice ==2 )
    70    {
    71 "// NOTE:";
    72 "// basering is now Bl_"+#[1]+bsr+" (equal to "+bsr+"["+nv[1,size(nv)-1]+"])";
    73 "// it contains the ideal "+#[1]+"_ , such that";
    74 "//             Bl_"+#[1]+bsr+"/"+#[1]+"_ is the blowup ring";
    75 "// For blowing-up another ideal in "+bsr+" type first:";
    76 "//             setring "+bsr+";";
    77    }
     72dbprint(p,"",
     73"// The proc created the ring Bl_"+#[1]+bsr+" (equal to "+bsr+"["+nv[1,size(nv)-1]+"])",
     74"// it contains the ideal "+#[1]+"_ , such that",
     75"//             Bl_"+#[1]+bsr+"/"+#[1]+"_ is the blowup ring",
     76"// show(Bl_"+#[1]+bsr+"); shows this ring.",
     77"// Make Bl_"+#[1]+bsr+" the basering and see "+#[1]+"_ by typing:",
     78"   setring Bl_"+#[1]+bsr+";","   "+#[1]+"_;");
    7879   return();
    7980}
    80 example 
     81example
    8182{ "EXAMPLE:"; echo = 2;
    8283   ring R=0,(x,y),dp;
    83    poly f=y2+x3; ideal j=jacob(f); 
     84   poly f=y2+x3; ideal j=jacob(f);
    8485   blowup0(j);
    85    type basering; "";
    86 // NOTE:
    87 // basering is now Bl_jR (equal to R[A,B])
    88 // it contains the ideal j_ , such that
    89 //             Bl_jR/j_ is the blowup ring
    90 // For blowing-up another ideal in R type first:
    91 //             setring R;
    92    type j_; "";
     86   show(Bl_jR);
     87   setring Bl_jR;
     88   j_;"";
    9389   ring r=32003,(x,y,z),ds;
    9490   blowup0(maxideal(1),"m","T()");
    95    type basering; "";
    96 // NOTE:
    97 // basering is now Bl_mr (equal to r[T(1..3)])
    98 // it contains the ideal m_ , such that
    99 //             Bl_mr/m_ is the blowup ring
    100 // For blowing-up another ideal in r type first:
    101 //             setring r;
     91   show(Bl_mr);
     92   setring Bl_mr;
    10293   m_;
    103    kill Bl_jR, Bl_mr; 
     94   kill Bl_jR, Bl_mr;
    10495}
    10596///////////////////////////////////////////////////////////////////////////////
    10697
    10798proc elim (id, int n, int m)
    108 USAGE:   elim(id,n,m);  id ideal/module, n,m integers
    109 RETURNS: ideal/module obtained from id by eliminating variables n..m
    110 NOTE:    no special monomial ordering is required, result is a SB with
    111          respect to ordering dp (resp. ls) if the first var not to be
    112          eliminated belongs to a -p (resp. -s) blockordering
    113 EXAMPLE: example elim; shows an example
     99USAGE:   elim(id,n,m);  id ideal/module, n,m integers
     100RETURNS: ideal/module obtained from id by eliminating variables n..m
     101NOTE:    no special monomial ordering is required, result is a SB with
     102         respect to ordering dp (resp. ls) if the first var not to be
     103         eliminated belongs to a -p (resp. -s) blockordering
     104         This proc uses 'execute' or calls a procedure using 'execute'.
     105EXAMPLE: example elim; shows examples
    114106{
    115107//---- get variables to be eliminated and create string for new ordering ------
    116108   int ii; poly vars=1;
    117    for( ii=n; ii<=m; ii=ii+1 ) { vars=vars*var(ii); }   
     109   for( ii=n; ii<=m; ii=ii+1 ) { vars=vars*var(ii); }
    118110   if( n>1 ) { poly p = 1+var(1); }
    119111   else { poly p = 1+var(m+1); }
     
    122114//-------------- create new ring and map objects to new ring ------------------
    123115   def br = basering;
    124    string str = "ring newr = ("+charstr(br)+"),("+varstr(br)+ordering;
     116   string str = "ring @newr = ("+charstr(br)+"),("+varstr(br)+ordering;
    125117   execute(str);
    126118   def i = imap(br,id);
     
    129121   i = eliminate(i,vars);
    130122   setring br;
    131    return(imap(newr,i));
    132 }
    133 example 
     123   return(imap(@newr,i));
     124}
     125example
    134126{ "EXAMPLE:"; echo = 2;
    135127   ring r=0,(x,y,u,v,w),dp;
    136128   ideal i=x-u,y-u2,w-u3,v-x+y3;
    137    elim(i,3,4); 
     129   elim(i,3,4);
    138130   module m=i*gen(1)+i*gen(2);
    139    m=elim(m,3,4);show(m); 
    140 }
    141 /////////////////////////////////////////////////////////////////////////////// 
     131   m=elim(m,3,4);show(m);
     132}
     133///////////////////////////////////////////////////////////////////////////////
    142134
    143135proc elim1 (id, poly vars)
     
    147139         respect to ordering dp (resp. ls) if the first var not to be
    148140         eliminated belongs to a -p (resp. -s) blockordering
    149 EXAMPLE: example elim1; shows an example
     141         This proc uses 'execute' or calls a procedure using 'execute'.
     142EXAMPLE: example elim1; shows examples
    150143{
    151144//---- get variables to be eliminated and create string for new ordering ------
    152    int ii;                       
    153    for( ii=1; ii<=nvars(basering); ii++ )
    154    {   
    155       if( vars/var(ii)==0 ) { poly p = 1+var(ii); }
    156       break;
     145   int ii;
     146   for( ii=1; ii<=nvars(basering); ii=ii+1 )
     147   {
     148      if( vars/var(ii)==0 ) { poly p = 1+var(ii); break;}
    157149   }
    158150   if( ord(p)==0 ) { string ordering = "),ls;"; }
     
    160152//-------------- create new ring and map objects to new ring ------------------
    161153   def br = basering;
    162    string str = "ring newr = "+charstr(br)+",("+varstr(br)+ordering;
     154   string str = "ring @newr = ("+charstr(br)+"),("+varstr(br)+ordering;
    163155   execute(str);
    164156   def id = fetch(br,id);
     
    167159   id = eliminate(id,vars);
    168160   setring br;
    169    return(imap(newr,id));
    170 }
    171 example 
     161   return(imap(@newr,id));
     162}
     163example
    172164{ "EXAMPLE:"; echo = 2;
    173165   ring r=0,(x,y,t,s,z),dp;
    174166   ideal i=x-t,y-t2,z-t3,s-x+y3;
    175    elim1(i,ts); 
     167   elim1(i,ts);
    176168   module m=i*gen(1)+i*gen(2);
    177    m=elim1(m,st); show(m); 
    178 }
    179 /////////////////////////////////////////////////////////////////////////////// 
     169   m=elim1(m,st); show(m);
     170}
     171///////////////////////////////////////////////////////////////////////////////
    180172
    181173proc nselect (id, int n, list#)
    182174USAGE:   nselect(id,n[,m]); id a module or ideal, n, m integers
    183175RETURN:  generators of id not containing the variable n [up to m]
    184 EXAMPLE: example nselect; shows an example
    185 {
     176EXAMPLE: example nselect; shows examples
     177{
     178   int j,k;
    186179   if( size(#)==0 ) { #[1]=n; }
    187    int j,k;
    188    for( k=1; k<=ncols(id); k++ )
    189    { 
    190       for( j=n; j<=#[1]; j++ )
    191       {
    192          if( size(id[k]/var(j))!=0) { id[k]=0; break; }
     180   for( k=1; k<=ncols(id); k=k+1 )
     181   {  for( j=n; j<=#[1]; j=j+1 )
     182      {  if( size(id[k]/var(j))!=0) { id[k]=0; break; }
    193183      }
    194184   }
    195185   return(simplify(id,2));
    196186}
    197 example 
     187example
    198188{ "EXAMPLE:"; echo = 2;
    199189   ring r=0,(x,y,t,s,z),(c,dp);
    200190   ideal i=x-y,y-z2,z-t3,s-x+y3;
    201191   nselect(i,3);
    202    module m=i*(gen(1)+gen(2)); 
     192   module m=i*(gen(1)+gen(2));
    203193   show(m);
    204194   show(nselect(m,3,4));
     
    207197
    208198proc sat (id, ideal j)
    209 USAGE:   sat(id,j);  id ideal or module, j ideal
    210 RETURN:  saturation of id with respect to j (= union_(k=1...) of id:j^k)
    211 NOTE:    result is a std basis in the basering
     199USAGE:   sat(id,j);  id=ideal/module, j=ideal
     200RETURN:  list of an ideal/module [1] and an integer [2]:
     201         [1] = saturation of id with respect to j (= union_(k=1...) of id:j^k)
     202         [2] = saturation exponent (= min( k | id:j^k = id:j^(k+1) ))
     203NOTE:    [1] is a standard basis in the basering
     204DISPLAY: saturation exponent during computation if printlevel >=1
    212205EXAMPLE: example sat; shows an example
    213206{
    214207   int ii,kk;
    215    def i=id; id=std(id);
     208   def i=id;
     209   id=std(id);
     210   int p = printlevel-voice+3;  // p=printlevel+1 (default: p=1)
    216211   while( ii<=size(i) )
    217    {   
    218       if( voice==2 )
    219       {"// start quotient:",kk+1;}
     212   {
     213      dbprint(p-1,"// compute quotient "+string(kk+1));
    220214      i=quotient(id,j);
    221       for( ii=1; ii<=size(i); ii++ )
     215      for( ii=1; ii<=size(i); ii=ii+1 )
    222216      {
    223217         if( reduce(i[ii],id)!=0 ) break;
     
    225219      id=std(i); kk=kk+1;
    226220   }
    227    if( voice==2 )
    228    {"//  saturation becomes stable after",kk-1,"iteration(s)";"";}
    229    return (id);
    230 }
    231 example
    232 { "EXAMPLE:"; echo = 2;
    233    ring r=2,(x,y,z),dp;
    234    poly F=x5+y5+(x-y)^2*xyz;
    235    ideal j= jacob(F);
    236    sat(j,maxideal(1));
     221   dbprint(p-1,"// saturation becomes stable after "+string(kk-1)+" iteration(s)","");
     222   list L = id,kk-1;
     223   return (L);
     224}
     225example
     226{ "EXAMPLE:"; echo = 2;
     227   int p      = printlevel;
     228   ring r     = 2,(x,y,z),dp;
     229   poly F     = x5+y5+(x-y)^2*xyz;
     230   ideal j    = jacob(F);
     231   sat(j,maxideal(1));
     232   printlevel = 2;
     233   sat(j,maxideal(2));
     234   printlevel = p;
    237235}
    238236///////////////////////////////////////////////////////////////////////////////
     
    241239USAGE:   select(id,n[,m]); id ideal/module, n, m integers
    242240RETURN:  generators of id containing the variable n [up to m]
    243 EXAMPLE: example select; shows an example
     241EXAMPLE: example select; shows examples
    244242{
    245243   if( size(#)==0 ) { #[1]=n; }
    246244   int j,k;
    247    for( k=1; k<=ncols(id); k++ )
    248    { 
    249       for( j=n; j<=#[1]; j++ )
    250       {
    251          if( size(id[k]/var(j))==0) { id[k]=0; break; }
     245   for( k=1; k<=ncols(id); k=k+1 )
     246   {  for( j=n; j<=#[1]; j=j+1 )
     247      {   if( size(id[k]/var(j))==0) { id[k]=0; break; }
    252248      }
    253249   }
    254    return(id+id);
    255 }
    256 example 
     250   return(simplify(id,2));
     251}
     252example
    257253{ "EXAMPLE:"; echo = 2;
    258254   ring r=0,(x,y,t,s,z),(c,dp);
    259255   ideal i=x-y,y-z2,z-t3,s-x+y3;
    260256   ideal j=select(i,1);
    261    module m=i*(gen(1)+gen(2)); show(m);
    262    show(select(m,1,2));
    263 }
    264 ///////////////////////////////////////////////////////////////////////////////
    265 
     257   j;
     258   module m=i*(gen(1)+gen(2));
     259   m;
     260   select(m,1,2);
     261}
     262///////////////////////////////////////////////////////////////////////////////
Note: See TracChangeset for help on using the changeset viewer.