Changeset 4644812 in git


Ignore:
Timestamp:
Oct 2, 2008, 10:14:35 AM (16 years ago)
Author:
Hans Schönemann <hannes@…>
Branches:
(u'spielwiese', 'fe61d9c35bf7c61f2b6cbf1b56e25e2f08d536cc')
Children:
227d1ec79ffb8506afb0ebaf6d26672e4dcdd560
Parents:
e40f77ae12c0d4b4f8155bd7ecbcfb7139652262
Message:
*hannes: format


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

Legend:

Unmodified
Added
Removed
  • Singular/LIB/freegb.lib

    re40f77 r4644812  
    11//////////////////////////////////////////////////////////////////////////////
    2 version="$Id: freegb.lib,v 1.10 2008-08-07 18:08:37 levandov Exp $";
     2version="$Id: freegb.lib,v 1.11 2008-10-02 08:14:35 Singular Exp $";
    33category="Noncommutative";
    44info="
     
    5656      for (k=2; k<=sv; k++)
    5757      {
    58         sp = sp + string(v[k])+"("+string(k-1+s)+")*";
     58        sp = sp + string(v[k])+"("+string(k-1+s)+")*";
    5959      }
    6060      sp = sp + string(v[1])+";"; // coef;
     
    242242      if (q==0)
    243243      {
    244         q = find(vv,string(p));
    245         if (q==0)
    246         {
    247           err = "error in find for string "+vv;
    248           dbprint(ppl,err);
    249           return("_");
    250         }
     244        q = find(vv,string(p));
     245        if (q==0)
     246        {
     247          err = "error in find for string "+vv;
     248          dbprint(ppl,err);
     249          return("_");
     250        }
    251251      }
    252252      // q>0
     
    357357      {
    358358         q = leadmonom(p);
    359          
    360359      }
    361360    }
     
    373372
    374373proc mono2word(poly p, int d)
    375 { 
     374{
    376375}
    377376
     
    469468      for (j=1; j<=nb; j++)
    470469      {
    471         LR[3][i*nb+j] = LR[3][j];
     470        LR[3][i*nb+j] = LR[3][j];
    472471      }
    473472    }
     
    505504      v  = M[j];
    506505      sv = size(v);
    507       //        "sv:";sv;
     506      //        "sv:";sv;
    508507      sp = "@@p = @@p + ";
    509508      for (k=2; k<=sv; k++)
    510509      {
    511         sp = sp + string(v[k])+"("+string(k-1)+")*";
     510        sp = sp + string(v[k])+"("+string(k-1)+")*";
    512511      }
    513512      sp = sp + string(v[1])+";"; // coef;
     
    527526  dbprint(ppl,"computing GB");
    528527  ideal J = system("freegb",I,d,nvars(save));
    529   //  ideal J = slimgb(I); 
     528  //  ideal J = slimgb(I);
    530529  dbprint(ppl,J);
    531530  // 4. skip shifted elts
     
    564563      for(k=1; k<=sx; k++)
    565564      {
    566         if ( x[k] >= 2 )
    567         {
    568           err = "skip: the value x[k] is " + string(x[k]);
    569           dbprint(ppl,err);
    570           //        return(0);
    571           K[i] = 0;
    572           p    = 0;
    573           q    = 0;
    574           break;
    575         }
     565        if ( x[k] >= 2 )
     566        {
     567          err = "skip: the value x[k] is " + string(x[k]);
     568          dbprint(ppl,err);
     569          //            return(0);
     570          K[i] = 0;
     571          p    = 0;
     572          q    = 0;
     573          break;
     574        }
    576575      }
    577576      p  = p - q;
     
    599598      for(k=1; k<=sx; k++)
    600599      {
    601         if (x[k] ==1)
    602         {
    603           a = k / s; // block number=a+1, a!=0
    604           b = k % s; // remainder
    605           //      printf("a: %s, b: %s",a,b);
    606           if (b == 0)
    607           {
    608             // that is it's the last var in the block
    609             b = s;
    610             a = a-1;
    611           }
    612           V = V + var(b)*gen(a+2);
    613         }
    614 //      else
    615 //      {
    616 //        printf("error: the value x[k] is %s", x[k]);
    617 //        return(0);
    618 //      }
     600        if (x[k] ==1)
     601        {
     602          a = k / s; // block number=a+1, a!=0
     603          b = k % s; // remainder
     604          //          printf("a: %s, b: %s",a,b);
     605          if (b == 0)
     606          {
     607            // that is it's the last var in the block
     608            b = s;
     609            a = a-1;
     610          }
     611          V = V + var(b)*gen(a+2);
     612        }
     613//         else
     614//         {
     615//           printf("error: the value x[k] is %s", x[k]);
     616//           return(0);
     617//         }
    619618      }
    620619      err = "V: " + string(V);
     
    722721      for (j=1; j<=nb; j++)
    723722      {
    724         LR[3][i*nb+j] = LR[3][j];
     723        LR[3][i*nb+j] = LR[3][j];
    725724      }
    726725    }
     
    757756      for (j=1; j<=sm; j++)
    758757      {
    759         //vectors, e.g. free monomials
    760         v  = M[j];
    761         sv = size(v);
    762         //      "sv:";sv;
    763         sp = "@@p = @@p + ";
    764         for (k=2; k<=sv; k++)
    765         {
    766           sp = sp + string(v[k])+"("+string(k-2+i)+")*";
    767         }
    768         sp = sp + string(v[1])+";"; // coef;
    769         setring @R;
    770         execute(sp);
    771         setring save;
     758        //vectors, e.g. free monomials
     759        v  = M[j];
     760        sv = size(v);
     761        //        "sv:";sv;
     762        sp = "@@p = @@p + ";
     763        for (k=2; k<=sv; k++)
     764        {
     765          sp = sp + string(v[k])+"("+string(k-2+i)+")*";
     766        }
     767        sp = sp + string(v[1])+";"; // coef;
     768        setring @R;
     769        execute(sp);
     770        setring save;
    772771      }
    773772      setring @R;
     
    869868      for (j=1; j<=nb; j++)
    870869      {
    871         LR[3][i*nb+j] = LR[3][j];
     870        LR[3][i*nb+j] = LR[3][j];
    872871      }
    873872    }
     
    11251124      for (j=1; j<=nb; j++)
    11261125      {
    1127         LR[3][i*nb+j] = LR[3][j];
     1126        LR[3][i*nb+j] = LR[3][j];
    11281127      }
    11291128    }
     
    11601159      for (j=1; j<=sm; j++)
    11611160      {
    1162         //vectors, e.g. free monomials
    1163         v  = M[j];
    1164         sv = size(v);
    1165         //      "sv:";sv;
    1166         sp = "@@p = @@p + ";
    1167         for (k=2; k<=sv; k++)
    1168         {
    1169           sp = sp + string(v[k])+"("+string(k-1+i)+")*";
    1170         }
    1171         sp = sp + string(v[1])+";"; // coef;
    1172         setring @R;
    1173         execute(sp);
    1174         setring save;
     1161        //vectors, e.g. free monomials
     1162        v  = M[j];
     1163        sv = size(v);
     1164        //        "sv:";sv;
     1165        sp = "@@p = @@p + ";
     1166        for (k=2; k<=sv; k++)
     1167        {
     1168          sp = sp + string(v[k])+"("+string(k-1+i)+")*";
     1169        }
     1170        sp = sp + string(v[1])+";"; // coef;
     1171        setring @R;
     1172        execute(sp);
     1173        setring save;
    11751174      }
    11761175      setring @R;
     
    12231222      for(k=1; k<=sx; k++)
    12241223      {
    1225         if ( x[k] >= 2 )
    1226         {
    1227           err = "skip: the value x[k] is " + string(x[k]);
    1228           dbprint(ppl,err);
    1229           //        return(0);
    1230           K[i] = 0;
    1231           p    = 0;
    1232           q    = 0;
    1233           break;
    1234         }
     1224        if ( x[k] >= 2 )
     1225        {
     1226          err = "skip: the value x[k] is " + string(x[k]);
     1227          dbprint(ppl,err);
     1228          //            return(0);
     1229          K[i] = 0;
     1230          p    = 0;
     1231          q    = 0;
     1232          break;
     1233        }
    12351234      }
    12361235      p  = p - q;
     
    12581257      for(k=1; k<=sx; k++)
    12591258      {
    1260         if (x[k] ==1)
    1261         {
    1262           a = k / s; // block number=a+1, a!=0
    1263           b = k % s; // remainder
    1264           //      printf("a: %s, b: %s",a,b);
    1265           if (b == 0)
    1266           {
    1267             // that is it's the last var in the block
    1268             b = s;
    1269             a = a-1;
    1270           }
    1271           V = V + var(b)*gen(a+2);
    1272         }
    1273 //      else
    1274 //      {
    1275 //        printf("error: the value x[k] is %s", x[k]);
    1276 //        return(0);
    1277 //      }
     1259        if (x[k] ==1)
     1260        {
     1261          a = k / s; // block number=a+1, a!=0
     1262          b = k % s; // remainder
     1263          //          printf("a: %s, b: %s",a,b);
     1264          if (b == 0)
     1265          {
     1266            // that is it's the last var in the block
     1267            b = s;
     1268            a = a-1;
     1269          }
     1270          V = V + var(b)*gen(a+2);
     1271        }
     1272//         else
     1273//         {
     1274//           printf("error: the value x[k] is %s", x[k]);
     1275//           return(0);
     1276//         }
    12781277      }
    12791278      err = "V: " + string(V);
     
    13621361  def U = crs(L,4);
    13631362  setring U;
    1364   I = I, 
    1365     y(2)*h(3)+z(2)*x(3),     y(3)*h(4)+z(3)*x(4), 
     1363  I = I,
     1364    y(2)*h(3)+z(2)*x(3),     y(3)*h(4)+z(3)*x(4),
    13661365    y(2)*x(3)-z(2)*h(3),     y(3)*x(4)-z(3)*h(4);
    13671366  I = simplify(I,2);
     
    14861485*/
    14871486
    1488 /* s1,s2: 
     1487/* s1,s2:
    14891488s1*s1 =0, s2*s2 = s1*s2*s1
    14901489*/
     
    14921491/*
    14931492try char 0:
    1494 s1,s2: 
     1493s1,s2:
    14951494s1*s1 =0, s2*s2 = s1*s2*s1, s(1)*s(3)== s(1)*s(1)*s(3) == 0 = 2*s(4) ->def for s(4)
    14961495hence 2==0! only in char 2
     
    14991498proc adem2mod(int n)
    15001499{
    1501   // Adem rels modulo 2 
     1500  // Adem rels modulo 2
    15021501}
    15031502
     
    15181517    return(LS);
    15191518  }
    1520   i = find(s,"-",2); 
     1519  i = find(s,"-",2);
    15211520  // i==1 might happen if the 1st symbol coeff is negative
    15221521  j = find(s,"+");
     
    15401539      j = find(s,"+");
    15411540      cnt++;
    1542       if (j==0) 
     1541      if (j==0)
    15431542      {
    15441543        LS[cnt] = string(s);
     
    15641563      i = find(s,"-",2);
    15651564      cnt++;
    1566       if (i==0) 
     1565      if (i==0)
    15671566      {
    15681567        LS[cnt] = string(s);
     
    16041603    {
    16051604      // i==1->  minus at leadcoef
    1606       ie = find(s,"-",i+1); 
     1605      ie = find(s,"-",i+1);
    16071606      je = find(s,"+",i+1);
    16081607      if (je == ie)
     
    16711670{
    16721671  "EXAMPLE:"; echo = 2;
    1673   string a = "f1";   string b = "f2"; 
     1672  string a = "f1";   string b = "f2";
    16741673  list L = a,b,a;
    1675   addplaces(L); 
     1674  addplaces(L);
    16761675}
    16771676
     
    16921691  ring r = 0,(f2,f1),dp;
    16931692  string s = "f2*f1*f1 - 2*f1*f2*f1+ f1*f1*f2";
    1694   sent2lplace(s); 
     1693  sent2lplace(s);
    16951694}
    16961695
     
    17031702    t = s[2..size(s)];
    17041703    if (testnumber(t))
    1705     { 
     1704    {
    17061705      //a negative number
    17071706    }
     
    17401739  ring r = (0,a),x,dp;
    17411740  string s = "a^2+7*a-2";
    1742   testnumber(s); 
     1741  testnumber(s);
    17431742  s = "b+a";
    1744   testnumber(s); 
     1743  testnumber(s);
    17451744}
    17461745
     
    17541753  string a,b,c,d,t;
    17551754  // 1. get coeff
    1756   i = find(s,"*"); 
    1757   if (i==0) { return(s); } 
     1755  i = find(s,"*");
     1756  if (i==0) { return(s); }
    17581757  list VN;
    17591758  c = s[1..i-1]; // incl. the case like (-a^2+1)
     
    17671766      t = c[2..size(c)];
    17681767      if (testnumber(t))
    1769       { 
    1770          //a negative number       
     1768      {
     1769         //a negative number
    17711770        // nop here
    17721771      }
     
    18171816  "EXAMPLE:"; echo = 2;
    18181817  ring r = (0,a),(f2,f1),dp;
    1819   str2lplace("-2*f2^2*f1^2*f2"); 
     1818  str2lplace("-2*f2^2*f1^2*f2");
    18201819  str2lplace("-f1*f2");
    18211820  str2lplace("(-a^2+7a)*f1*f2");
     
    18251824{
    18261825  // makes x*x*x*x out of x^4 ., rep statys for repetitions
    1827   // looks for "-" problem 
     1826  // looks for "-" problem
    18281827  // exception: "-" as coeff
    18291828  string ex,t;
     
    18771876  i = find(s,"^"); // first ^
    18781877  j = find(s,"*",i+1); // next * == end of ^
    1879   if (j==0) 
    1880   { 
    1881     ex = s[i+1..size(s)]; 
    1882   }
    1883   else 
    1884   { 
    1885     ex = s[i+1..j-1]; 
     1878  if (j==0)
     1879  {
     1880    ex = s[i+1..size(s)];
     1881  }
     1882  else
     1883  {
     1884    ex = s[i+1..j-1];
    18861885  }
    18871886  execute("int @exp = " + ex + ";"); //@exp = exponent
     
    18941893  //  "varn:";  varn;
    18951894  string pref;
    1896   if (k>0) 
    1897   { 
    1898     pref = s[1..k]; // with * on the k-th place 
     1895  if (k>0)
     1896  {
     1897    pref = s[1..k]; // with * on the k-th place
    18991898  }
    19001899  //  "pref:";  pref;
    1901   string suf; 
     1900  string suf;
    19021901  if ( (j>0) && (j+1 <= size(s)) )
    19031902  {
     
    19271926  "EXAMPLE:"; echo = 2;
    19281927  ring r = (0,a),(x,y,z,t),dp;
    1929   strpower2rep("-x^4"); 
    1930   strpower2rep("-2*x^4*y^3*z*t^2"); 
    1931   strpower2rep("-a^2*x^4"); 
     1928  strpower2rep("-x^4");
     1929  strpower2rep("-2*x^4*y^3*z*t^2");
     1930  strpower2rep("-a^2*x^4");
    19321931}
    19331932
    19341933proc Liebr(poly a, poly b, list #)
    19351934{
    1936   // alias ppLiebr; 
     1935  // alias ppLiebr;
    19371936  //if int N is given compute [a,[...[a,b]]]] left normed bracket
    19381937  poly q;
     
    19971996  a = lead(a);
    19981997  b = lead(b);
    1999   int sa = deg(a); 
    2000   int sb = deg(b); 
     1998  int sa = deg(a);
     1999  int sb = deg(b);
    20012000  poly v = a*pshift(b,sa) - b*pshift(a,sb);
    20022001  return(v);
     
    20212020  // suppose that A is cartan matrix
    20222021  // then Serre's relations are
    2023   // (ad f_j)^{1-A_{ij}} ( f_i) 
     2022  // (ad f_j)^{1-A_{ij}} ( f_i)
    20242023  int ppl = printlevel-voice+2;
    20252024  int n = ncols(A); // hence n variables
    20262025  int i,j,k,l;
    2027   poly p,q; 
     2026  poly p,q;
    20282027  ideal I;
    20292028  for (i=1; i<=n; i++)
     
    20392038      {
    20402039        q = Liebr(var(j),var(i));
    2041         //        printf("first bracket: %s",q);
     2040        //        printf("first bracket: %s",q);
    20422041        dbprint(ppl,"first bracket: ",q);
    2043         //        if (l >=2)
    2044         //        {
     2042        //        if (l >=2)
     2043        //        {
    20452044          for (k=1; k<=l-1; k++)
    20462045          {
    20472046            q = Liebr(var(j),q);
    2048             //            printf("further bracket: %s",q);
     2047            //            printf("further bracket: %s",q);
    20492048            dbprint(ppl,"further bracket:",q);
    20502049          }
    2051           //        }
     2050          //        }
    20522051      }
    20532052      if (q!=0) { I = I,q; q=0;}
     
    21082107      for(k=1; k<=sx; k++)
    21092108      {
    2110         if ( x[k] >= 2 )
    2111         {
    2112           err = "skip: the value x[k] is " + string(x[k]);
    2113           dbprint(ppl,err);
    2114           //        return(0);
    2115           K[i] = 0;
    2116           p    = 0;
    2117           q    = 0;
    2118           break;
    2119         }
     2109        if ( x[k] >= 2 )
     2110        {
     2111          err = "skip: the value x[k] is " + string(x[k]);
     2112          dbprint(ppl,err);
     2113          //            return(0);
     2114          K[i] = 0;
     2115          p    = 0;
     2116          q    = 0;
     2117          break;
     2118        }
    21202119      }
    21212120      p  = p - q;
     
    21432142      for(k=1; k<=sx; k++)
    21442143      {
    2145         if (x[k] ==1)
    2146         {
    2147           a = k / s; // block number=a+1, a!=0
    2148           b = k % s; // remainder
    2149           //      printf("a: %s, b: %s",a,b);
    2150           if (b == 0)
    2151           {
    2152             // that is it's the last var in the block
    2153             b = s;
    2154             a = a-1;
    2155           }
    2156           V = V + var(b)*gen(a+2);
    2157         }
     2144        if (x[k] ==1)
     2145        {
     2146          a = k / s; // block number=a+1, a!=0
     2147          b = k % s; // remainder
     2148          //          printf("a: %s, b: %s",a,b);
     2149          if (b == 0)
     2150          {
     2151            // that is it's the last var in the block
     2152            b = s;
     2153            a = a-1;
     2154          }
     2155          V = V + var(b)*gen(a+2);
     2156        }
    21582157      }
    21592158      err = "V: " + string(V);
     
    22442243    i = find(s,",");
    22452244    "i"; i;
    2246     if (i==0) 
    2247     { 
     2245    if (i==0)
     2246    {
    22482247      i = find(s,";");
    22492248      if (i==0)
     
    22792278  setring A;
    22802279  string fn = "myfile";
    2281   string s1 = "z*y*y*y - 3*y*z*x*y  + 3*y*y*z*y - y*x*y*z,"; 
     2280  string s1 = "z*y*y*y - 3*y*z*x*y  + 3*y*y*z*y - y*x*y*z,";
    22822281  string s2 = "-2*y*x*y*z + y*y*z*z - z*z*y*y + 2*z*y*z*y,";
    22832282  string s3 = "z*y*x*t - 2*y*z*y*t + y*y*z*t - t*z*y*y + 2*t*y*z*y - t*x*y*z;";
     
    23212320
    23222321
    2323 // TODO: 
     2322// TODO:
    23242323// multiply two letterplace polynomials, lpMult
    23252324// reduction/ Normalform? needs kernel stuff
Note: See TracChangeset for help on using the changeset viewer.