Changeset eaf8f8 in git


Ignore:
Timestamp:
Mar 9, 2009, 7:34:52 PM (15 years ago)
Author:
Viktor Levandovskyy <levandov@…>
Branches:
(u'spielwiese', 'fe61d9c35bf7c61f2b6cbf1b56e25e2f08d536cc')
Children:
b22a72d3cf5f625b056ece9285f0442601763cf0
Parents:
e6d283f58657a6d67f7a592a1e62a50f9464d936
Message:
*levandov: further bugfixes, finer work with varnames, doc enhancements, assume procs etc


git-svn-id: file:///usr/local/Singular/svn/trunk@11529 2c84dea3-7e68-4137-9b89-c4e89433aadc
Location:
Singular/LIB
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • Singular/LIB/bfun.lib

    re6d283f reaf8f8  
    11//////////////////////////////////////////////////////////////////////////////
    2 version="$Id: bfun.lib,v 1.3 2009-03-06 20:32:28 levandov Exp $";
     2version="$Id: bfun.lib,v 1.4 2009-03-09 18:34:51 levandov Exp $";
    33category="Noncommutative";
    44info="
     
    5656LIB "dmod.lib";     // for SannfsBFCT etc
    5757LIB "dmodapp.lib";  // for initialIdealW etc
    58 LIB "nctools.lib"; // for isWeyl etc
     58LIB "nctools.lib";  // for isWeyl etc
    5959
    6060///////////////////////////////////////////////////////////////////////////////
     
    149149static proc safeVarName (string s)
    150150{
    151   string cv = "," + charstr(basering) + "," + varstr(basering) + ",";
     151  string S = "," + charstr(basering) + "," + varstr(basering) + ",";
    152152  s = "," + s + ",";
    153   while (find(cv,s) <> 0)
     153  while (find(S,s) <> 0)
    154154  {
    155155    s[1] = "@";
     
    903903}
    904904
    905 proc pIntersectSyz (poly s, ideal II, list #)
     905proc pIntersectSyz (poly s, ideal I, list #)
    906906"USAGE:  pIntersectSyz(f, I [,p,s,t]);  f poly, I ideal, p,t optial ints, p prime
    907907RETURN:  vector, coefficient vector of the monic polynomial
    908908PURPOSE: compute the intersection of an ideal I with the subalgebra K[f]
    909 ASSUME:  I is given as Groebner basis, basering is free of parameters.
     909ASSUME:  I is given as Groebner basis.
    910910NOTE:    If the intersection is zero, this procedure might not terminate.
    911911@*       If p>0 is given, this proc computes the generator of the intersection in
    912912@*       char p first and then only searches for a generator of the obtained
    913913@*       degree in the basering. Otherwise, it searched for all degrees by
    914 @*       computing syzygies.
     914@*       computing syzygies. Note that the basering must be free of parameters to
     915@*       use this modular method.
    915916@*       If s<>0, @code{std} is used for Groebner basis computations in char 0,
    916917@*       otherwise, and by default, @code{slimgb} is used.
     
    923924{
    924925  // assume I is given in Groebner basis
    925   ideal I = II;
    926926  if (attrib(I,"isSB") <> 1)
    927927  {
     
    962962  newNF = NF(s,I);
    963963  NI[2] = newNF;
     964  list l = ringlist(save);
     965  if (typeof(l[1]) == "int") { l[1] = solveincharp; }
     966  else // parameters in basering: problems with mappings from Q(a_i)->Z/p(a_i)
     967  {
     968    if (solveincharp <> 0)
     969    {
     970      print("// basering must be free of parameters to use modular method");
     971      print("// solving in characteristic of basering only...");
     972      solveincharp = 0;
     973    }
     974  }
    964975  if (solveincharp<>0)
    965976  {
    966     list l = ringlist(save);
    967     l[1] = solveincharp;
    968     matrix l5 = l[5];
    969     matrix l6 = l[6];
     977    if (size(l)>4)
     978    {
     979      matrix l5 = l[5];
     980      matrix l6 = l[6];
     981    }
    970982    def @Rp = ring(l);
    971983    setring @Rp;
    972984    list l = ringlist(@Rp);
    973     l[5] = fetch(save,l5);
    974     l[6] = fetch(save,l6);
     985    setring save;
     986    if (size(l)>4)
     987    {
     988      setring @Rp;
     989      l[5] = fetch(save,l5);
     990      l[6] = fetch(save,l6);
     991    }
     992    setring @Rp;
    975993    def Rp = ring(l);
    976994    setring Rp;
    977995    kill @Rp;
    978     dbprint(ppl+1,"// solving in ring ", Rp);
     996    dbprint(ppl-1,"// solving in ring ", Rp);
    979997    vector v;
    980998    map phi = save,maxideal(1);
     
    9841002  }
    9851003  i = 1;
    986   dbprint(ppl+1,"// pIntersectSyz starts...");
    987   dbprint(ppl+1,"// with ideal I=", I);
     1004  dbprint(ppl,"// pIntersectSyz starts...");
     1005  dbprint(ppl-1,"// with ideal I=", I);
    9881006  while (1)
    9891007  {
    990     dbprint(ppl,"// i:"+string(i));
     1008    dbprint(ppl,"// testing degree: "+string(i));
    9911009    if (i>1)
    9921010    {
     
    10041022    }
    10051023    // look for a solution
    1006     dbprint(ppl,"// linSyzSolve starts with: "+string(matrix(NI)));
     1024    dbprint(ppl-1,"// linSyzSolve starts with: "+string(matrix(NI)));
    10071025    if (solveincharp<>0) // modular method
    10081026    {
     
    10311049    }
    10321050    matrix MM[1][nrows(v)] = matrix(v);
    1033     dbprint(ppl,"// linSyzSolve ready  with: "+string(MM));
     1051    dbprint(ppl-1,"// linSyzSolve ready  with: "+string(MM));
    10341052    kill MM;
    10351053    //  "linSyzSolve ready with"; print(v);
     
    10571075    i++;
    10581076  }
    1059   dbprint(ppl+1,"// pIntersectSyz finished");
     1077  dbprint(ppl,"// pIntersectSyz finished");
    10601078  return(v);
    10611079}
     
    11901208    print("// basering is qring:");
    11911209    print("// discarding the quotient and proceeding...");
    1192     L[4] = 0;
     1210    L[4] = ideal(0);
    11931211    qr = 1;
    1194     def save2 = ring(L);
    1195     setring save2;
     1212    def save2 = ring(L); setring save2;
    11961213    poly f = imap(save,f);
    11971214  }
     
    12141231    ideal J = LD;
    12151232    kill LD;
     1233    poly s = var(2*n+1);
    12161234  }
    12171235  vector b;
     
    12211239    if (pIntersectchar == 0) // pIntersectSyz::modular
    12221240    {
    1223       int lb = 30000;
    1224       int ub = 536870909;
    1225       i = 1;
    1226       list usedprimes;
    1227       while (b == 0)
    1228       {
    1229         dbprint(ppl,"// number of run in the loop: "+string(i));
    1230         int q = prime(random(lb,ub));
    1231         if (findFirst(usedprimes,q)==0) // if q was not already used
    1232         {
    1233           usedprimes = usedprimes,q;
    1234           dbprint(ppl,"// used prime is: "+string(q));
    1235           b = pIntersectSyz(s,J,q,whichengine,modengine);
     1241      list L = ringlist(D);
     1242      if (typeof(L[1])=="int")
     1243      { 
     1244        int lb = 10000;
     1245        int ub = 536870909;
     1246        i = 1;
     1247        list usedprimes;
     1248        matrix L5 = L[5]; matrix L6 = L[6];
     1249        int sJ = size(J); int sJq;
     1250        while (b == 0)
     1251        {
     1252          dbprint(ppl,"// number of run in the loop: "+string(i));
     1253          int q = prime(random(lb,ub));
     1254          if (findFirst(usedprimes,q)==0) // if q was not already used
     1255          {
     1256            usedprimes = usedprimes,q;
     1257            dbprint(ppl,"// using prime: "+string(q));
     1258            L[1] = q;
     1259            def @Rq = ring(L); setring @Rq;
     1260            list lq = ringlist(@Rq);
     1261            lq[5] = fetch(D,L5); lq[6] = fetch(D,L6);
     1262            def Rq = ring(lq);
     1263            setring Rq; kill @Rq;
     1264            ideal Jq = fetch(D,J);
     1265            sJq = size(lead(Jq));
     1266            setring D; kill Rq;
     1267            if (sJq <> sJ)
     1268            {
     1269              dbprint(ppl,"// " +string(q) + " is unlucky");
     1270              b = 0;
     1271            }
     1272            else
     1273            {
     1274              b = pIntersectSyz(s,J,q,whichengine,modengine);
     1275            }
     1276          }
     1277          i++;
    12361278        }
    1237         i++;
    1238       }
    1239     }
    1240     else // pIntersectSyz::non-modular
     1279      }
     1280      else //parameters: problem when mapping Q(a_i) -> Z/p(a_i)
     1281      {
     1282        print("// basering must be free of parameters to use modular method");
     1283        print("// solving only in char 0...");
     1284        b = pIntersectSyz(s,J,0,whichengine);
     1285      }
     1286    } 
     1287    else // pIntersectSyz::non-modular else // parameters in basering: problems with mappings
    12411288    {
    12421289      b = pIntersectSyz(s,J,0,whichengine);
     
    12471294    b = pIntersect(s,J);
    12481295  }
    1249   if (qr == 1) { setring save2; }
    1250   else { setring save; }
    1251   vector b = imap(D,b);
    12521296  if (inorann == 0) { list l = listofroots(b,1); }
    12531297  else              { list l = listofroots(b,0); }
    1254   if (qr == 1)
    1255   {
    1256     setring save;
    1257     list l = imap(save2,l);
    1258   }
     1298  setring save;
     1299  list l = imap(D,l);
    12591300  return(l);
    12601301}
     
    13431384@*       If t<>0, the computation of the intersection is solely performed over
    13441385@*       charasteristic 0, otherwise and by default, a modular method is used.
     1386@*       Note that in this case, the basering must be free of parameters.
    13451387@*       If u<>0 and by default, @code{std} is used for GB computations in
    13461388@*       characteristic >0, otherwise, @code{slimgb} is used.
     
    14691511  {
    14701512    print("// given ideal is not holonomic");
    1471     print("// setting bound for degree of b-fubction to 10 and proceeding");
     1513    print("// setting bound for degree of b-function to 10 and proceeding");
    14721514    isH = 10;
    14731515  }
     
    15261568{
    15271569  int ppl = printlevel - voice +2;
    1528   if (isCommutative() == 0) { ERROR("basering must be commutative"); }
     1570  if (!isCommutative()) { ERROR("Basering must be commutative"); }
    15291571  def save = basering;
    15301572  int n = nvars(save);
     
    15391581    print("// basering is qring:");
    15401582    print("// discarding the quotient and proceeding...");
    1541     L[4] = 0;
     1583    L[4] = ideal(0);
    15421584    qr = 1;
    15431585    def save2 = ring(L);
     
    15451587    poly f = imap(save,f);
    15461588  }
    1547   int noofvars = 2*n+4;
     1589  int N = 2*n+4;
    15481590  int i;
    15491591  int whichengine = 0; // default
     
    15631605    }
    15641606  }
    1565   intvec uv;
    1566   uv[n+3] = 1;
    1567   ring r = 0,(x(1..n)),dp;
    1568   poly f = fetch(save,f);
    1569   uv[1] = -1; uv[noofvars] = 0;
    1570   //  for the ordering
    1571   intvec @a; @a = 1:noofvars; @a[2] = 2;
     1607  // creating the homogenized extended Weyl algebra
     1608  // create names for vars
     1609  list Lvar;
     1610  Lvar[1]   = safeVarName("t");
     1611  Lvar[2]   = safeVarName("s");
     1612  Lvar[n+3] = safeVarName("D"+Lvar[1]);
     1613  Lvar[N]   = safeVarName("h");
     1614  for (i=1; i<=n; i++)
     1615  {
     1616    Lvar[i+2]   = string(var(i));
     1617    Lvar[i+n+3] = safeVarName("D" + string(var(i)));
     1618  }
     1619  // create ordering
     1620  intvec uv = -1; uv[n+3] = 1; uv[N] = 0;
     1621  intvec @a = 1:N; @a[2] = 2;
    15721622  intvec @a2 = @a; @a2[2] = 0; @a2[2*n+4] = 0;
     1623  list Lord;
     1624  Lord[1] = list("a",@a); Lord[2] = list("a",@a2);
    15731625  if (methodord == 0) // default: block ordering
    15741626  {
    1575     ring @Dh = 0,(t,s,x(n..1),Dt,D(n..1),h),(a(@a),a(@a2),a(uv),dp(noofvars-1),lp(1));
     1627    //ring @Dh = 0,(t,s,x(n..1),Dt,D(n..1),h),(a(@a),a(@a2),a(uv),dp(N-1),lp(1));
     1628    Lord[3] = list("a",uv);
     1629    Lord[4] = list("dp",intvec(1:(N-1)));
     1630    Lord[5] = list("lp",intvec(1));
     1631    Lord[6] = list("C",intvec(0));
    15761632  }
    15771633  else // M() ordering
    15781634  {
    1579     intmat @Ord[noofvars][noofvars];
    1580     @Ord[1,1..noofvars] = uv;
    1581     @Ord[2,1..noofvars] = 1:(noofvars-1);
    1582     for (i=1; i<=noofvars-2; i++)
    1583     {
    1584       @Ord[2+i,noofvars - i] = -1;
    1585     }
     1635    intmat @Ord[N][N];
     1636    @Ord[1,1..N] = uv; @Ord[2,1..N] = 1:(N-1);
     1637    for (i=1; i<=N-2; i++) { @Ord[2+i,N - i] = -1; }
    15861638    dbprint(ppl,"// weights for ordering: "+string(transpose(@a)));
    15871639    dbprint(ppl,"// the ordering matrix:",@Ord);
    1588     ring @Dh = 0,(t,s,x(n..1),Dt,D(n..1),h),(a(@a),a(@a2),M(@Ord));
    1589   }
    1590   dbprint(ppl,"// the ring Dh:",Dh);
    1591   // non-commutative relations
    1592   matrix @relD[noofvars][noofvars];
    1593   @relD[1,2] = t*h^2;// s*t = t*s+t*h^2
    1594   @relD[2,n+3] = Dt*h^2;// Dt*s = s*Dt+h^2
    1595   @relD[1,n+3] = h^2;
     1640    //ring @Dh = 0,(t,s,x(n..1),Dt,D(n..1),h),(a(@a),a(@a2),M(@Ord));
     1641    Lord[3] = list("M",intvec(@Ord));
     1642    Lord[4] = list("C",intvec(0));
     1643  }
     1644  // create commutative ring
     1645  list L@Dh = ringlist(basering);
     1646  L@Dh = L@Dh[1..4]; // if basering is commutative nc_algebra
     1647  L@Dh[2] = Lvar; L@Dh[3] = Lord;
     1648  def @Dh = ring(L@Dh); setring @Dh;
     1649  dbprint(ppl,"// the ring @Dh:",@Dh);
     1650  // create non-commutative relations
     1651  matrix @relD[N][N];
     1652  @relD[1,2] = var(1)*var(N)^2;     //  s*t = t*s + t*h^2
     1653  @relD[2,n+3] = var(n+3)*var(N)^2; // Dt*s = s*Dt+Dt*h^2
     1654  @relD[1,n+3] = var(N)^2;
    15961655  for (i=1; i<=n; i++)
    15971656  {
    1598     @relD[i+2,n+3+i] = h^2;
     1657    @relD[i+2,n+3+i] = var(N)^2;
    15991658  }
    16001659  dbprint(ppl,"// nc relations:",@relD);
    16011660  def Dh = nc_algebra(1,@relD);
    1602   setring Dh;
    1603   dbprint(ppl,"// computing in ring",DDh);
    1604   ideal I;
    1605   poly f = imap(r,f);
    1606   kill r;
     1661  setring Dh; kill @Dh;
     1662  dbprint(ppl,"// computing in ring",Dh);
     1663  poly f = imap(save,f);
    16071664  f = homog(f,h);
    1608   I = t - f, t*Dt - s;  // defining the Malgrange ideal
     1665  // create the Malgrange ideal
     1666  ideal I = var(1) - f, var(1)*var(n+3) - var(2);
    16091667  for (i=1; i<=n; i++)
    16101668  {
    1611     I = I, D(i)+diff(f,x(i))*Dt;
    1612   }
     1669    I[3+i] = var(i+n+3)+diff(f,var(i+2))*var(n+3);
     1670  }
     1671  dbprint(ppl-1, "// the Malgrange ideal: " +string(I));
     1672  // the hard part: Groebner basis computation
    16131673  dbprint(ppl, "// starting Groebner basis computation with engine: "+string(whichengine));
    16141674  I = engine(I, whichengine);
    16151675  dbprint(ppl, "// finished Groebner basis computation");
    1616   dbprint(ppl, "// I before dehomogenization: "+string(I));
    16171676  I = subst(I,h,1); // dehomogenization
    1618   dbprint(ppl, "// I after dehomogenization: " +string(I));
    1619   I = inForm(I,uv); // we are only interested in the initial form w.r.t. uv
     1677  dbprint(ppl-1,string(I));
     1678  // 3.3 the initial form
     1679  I = inForm(I,uv);
    16201680  dbprint(ppl, "// the initial ideal:", string(matrix(I)));
     1681  // read off the solution
    16211682  intvec tonselect = 1;
    16221683  for (i=3; i<=2*n+4; i++) { tonselect = tonselect,i; }
  • Singular/LIB/dmod.lib

    re6d283f reaf8f8  
    11//////////////////////////////////////////////////////////////////////////////
    2 version="$Id: dmod.lib,v 1.36 2009-03-06 21:05:54 levandov Exp $";
     2version="$Id: dmod.lib,v 1.37 2009-03-09 18:34:51 levandov Exp $";
    33category="Noncommutative";
    44info="
     
    2828@*     PS*F^(s+1) = bs*F^s holds in K[x_1,...,x_n,1/F]*F^s.
    2929
    30 @* We provide the following implementations:
    31 @* OT) the classical Ann F^s algorithm from Oaku and Takayama (Journal of
     30REFERENCES:
     31@* We provide the following implementations of algorithms:
     32@* (OT) the classical Ann F^s algorithm from Oaku and Takayama (Journal of
    3233@* Pure and Applied Math., 1999),
    33 @* LOT) Levandovskyy's modification of the Oaku-Takayama algorithm (ISSAC 2007)
    34 @* BM) the Ann F^s algorithm by Briancon and Maisonobe (Remarques sur
     34@* (LOT) Levandovskyy's modification of the Oaku-Takayama algorithm (ISSAC 2007)
     35@* (BM) the Ann F^s algorithm by Briancon and Maisonobe (Remarques sur
    3536@*        l'ideal de Bernstein associe a des polynomes, preprint, 2002)
     37@* (LM08) V. Levandovskyy and J. Martin-Morales, ISSAC 2008
     38@* (C) Countinho, A Primer of Algebraic D-Modules,
     39@* (SST) Saito, Sturmfels, Takayama 'Groebner Deformations of Hypergeometric
     40@*         Differential Equations', Springer, 2000
     41
    3642
    3743GUIDE:
     
    7884AUXILIARY PROCEDURES:
    7985
    80 arrange(p);         create a poly, describing a full hyperplane arrangement
    81 reiffen(p,q);       create a poly, describing a Reiffen curve
    82 isHolonomic(M);     check whether a module is holonomic
     86arrange(p);           create a poly, describing a full hyperplane arrangement
     87reiffen(p,q);         create a poly, describing a Reiffen curve
     88isHolonomic(M);   check whether a module is holonomic
    8389convloc(L);         replace global orderings with local in the ringlist L
    8490minIntRoot(P,fact); minimal integer root among the roots of a maximal ideal P
    8591varnum(s);          the number of the variable with the name s
    86 
     92isRational(n);  check whether n is a rational number
    8793
    8894SEE ALSO: gmssing_lib, bfun_lib, dmodapp_lib
     
    97103LIB "control.lib";  // for genericity
    98104LIB "dmodapp.lib"; // for e.g. engine
     105LIB "poly.lib";
    99106
    100107proc testdmodlib()
     
    136143"USAGE:  annfs(f [,S,eng]);  f a poly, S a string, eng an optional int
    137144RETURN:  ring
    138 PURPOSE: compute the D-module structure of basering[1/f]*f^s with the algorithm given in S and with the Groebner basis engine given in 'eng'
    139 NOTE:    activate the output ring with the @code{setring} command.
    140 @*       The value of a string S can be
    141 @*       'bm' (default) - for the algorithm of Briancon and Maisonobe,
    142 @*       'ot'  - for the algorithm of Oaku and Takayama,
    143 @*       'lot' - for the Levandovskyy's modification of the algorithm of Oaku and Takayama.
    144 @*       If eng <>0, @code{std} is used for Groebner basis computations,
    145 @*       otherwise and by default @code{slimgb} is used.
    146 @*       In the output ring:
    147 @*       - the ideal LD (which is a Groebner basis) is the needed D-module structure,
    148 @*       - the list  BS is the list of roots and multiplicities of a Bernstein polynomial of f.
     145PURPOSE: compute the D-module structure of basering[1/f]*f^s with the algorithm
     146@*  given in S and with the Groebner basis engine given in 'eng'
     147NOTE:  activate the output ring with the @code{setring} command.
     148@*    The value of a string S can be
     149@*    'bm' (default) - for the algorithm of Briancon and Maisonobe,
     150@*    'ot'  - for the algorithm of Oaku and Takayama,
     151@*    'lot' - for the Levandovskyy's modification of the algorithm of OT.
     152@*  If eng <>0, @code{std} is used for Groebner basis computations,
     153@*  otherwise and by default @code{slimgb} is used.
     154@*  In the output ring:
     155@*  - the ideal LD (which is a Groebner basis) is the needed D-module structure,
     156@*  - the list  BS contains roots and multiplicities of a BS-polynomial of f.
    149157DISPLAY: If @code{printlevel}=1, progress debug messages will be printed,
    150158@*          if @code{printlevel}>=2, all the debug messages will be printed.
     
    259267"USAGE:  Sannfs(f [,S,eng]);  f a poly, S a string, eng an optional int
    260268RETURN:  ring
    261 PURPOSE: compute the D-module structure of basering[f^s] with the algorithm given in S and with the Groebner basis engine given in eng
     269PURPOSE: compute the D-module structure of basering[f^s] with the algorithm
     270@*  given in S and with the Groebner basis engine given in eng
    262271NOTE:    activate the output ring with the @code{setring} command.
    263272@*       The value of a string S can be
    264273@*       'bm' (default) - for the algorithm of  Briancon and Maisonobe,
    265 @*       'lot' - for the Levandovskyy's modification of the algorithm of Oaku and Takayama,
     274@*       'lot' - for the Levandovskyy's modification of the algorithm of OT,
    266275@*       'ot'  - for the algorithm of Oaku and Takayama.
    267276@*       If eng <>0, @code{std} is used for Groebner basis computations,
     
    377386"USAGE:  Sannfslog(f [,eng]);  f a poly, eng an optional int
    378387RETURN:  ring
    379 PURPOSE: compute the D-module structure of basering[1/f]*f^s, where D is the Weyl algebra
     388PURPOSE: compute the D-module structure of basering[1/f]*f^s
    380389NOTE:    activate this ring with the @code{setring} command.
    381 @*       In the ring D[s], the ideal LD1 is generated by the elements in Ann F^s in D[s] coming from logarithmic derivations.
     390@*   In the output ring D[s], the ideal LD1 is generated by the elements
     391@*   in Ann F^s in D[s], coming from logarithmic derivations.
    382392@*       If eng <>0, @code{std} is used for Groebner basis computations,
    383393@*       otherwise, and by default @code{slimgb} is used.
     
    526536"USAGE:  ALTannfsBM(f [,eng]);  f a poly, eng an optional int
    527537RETURN:  ring
    528 PURPOSE: compute the annihilator ideal of f^s in D[s], where D is the Weyl Algebra, according to the algorithm by Briancon and Maisonobe
    529 NOTE:    activate this ring with the @code{setring} command. In this ring,
     538PURPOSE: compute the annihilator ideal of f^s in D[s], where D is the Weyl
     539@*   algebra, according to the algorithm by Briancon and Maisonobe
     540NOTE:  Activate this ring with the @code{setring} command. In this ring,
    530541@*       - the ideal LD is the annihilator of f^s.
    531542@*       If eng <>0, @code{std} is used for Groebner basis computations,
     
    716727proc bernsteinBM(poly F, list #)
    717728"USAGE:  bernsteinBM(f [,eng]);  f a poly, eng an optional int
    718 RETURN:  list of roots of the Bernstein polynomial b and its multiplicies
    719 PURPOSE: compute the global Bernstein-Sato polynomial for a hypersurface, defined by f, according to the algorithm by Briancon and Maisonobe
     729RETURN:  list (of roots of the Bernstein polynomial b and its multiplicies)
     730PURPOSE: compute the global Bernstein-Sato polynomial for a hypersurface,
     731@* defined by f, according to the algorithm by Briancon and Maisonobe
    720732NOTE:    If eng <>0, @code{std} is used for Groebner basis computations,
    721733@*       otherwise, and by default @code{slimgb} is used.
     
    942954RETURN:  ring
    943955PURPOSE: compute the D-module structure of basering[1/f]*f^s, according
    944 to the algorithm by Briancon and Maisonobe
     956@* to the algorithm by Briancon and Maisonobe
    945957NOTE:    activate this ring with the @code{setring} command. In this ring,
    946958@*       - the ideal LD (which is a Groebner basis) is the needed D-module structure,
     
    12391251"USAGE:  annfs2(I, F [,eng]);  I an ideal, F a poly, eng an optional int
    12401252RETURN:  ring
    1241 PURPOSE: compute the annihilator ideal of f^s in the Weyl Algebra, based on the
    1242 output of Sannfs-like procedure
    1243 NOTE:    activate this ring with the @code{setring} command. In this ring,
    1244 @*       - the ideal LD (which is a Groebner basis) is the annihilator of f^s,
    1245 @*       - the list BS contains the roots with multiplicities of a Bernstein polynomial of f.
    1246 @*       If eng <>0, @code{std} is used for Groebner basis computations,
    1247 @*       otherwise and by default @code{slimgb} is used.
    1248 @*       annfs2 uses the shorter form of expressions in the variable s (the idea of Noro).
     1253PURPOSE: compute the annihilator ideal of f^s in the Weyl Algebra,
     1254@*           based on the output of Sannfs-like procedure
     1255NOTE: Activate this ring with the @code{setring} command. In this ring,
     1256@*      - the ideal LD (which is a Groebner basis) is the annihilator of f^s,
     1257@*      - the list BS contains the roots with multiplicities of the BS polynomial.
     1258@*    If eng <>0, @code{std} is used for Groebner basis computations,
     1259@*    otherwise and by default @code{slimgb} is used.
     1260@* annfs2 uses shorter expressions in the variable s (the idea of Noro).
    12491261DISPLAY: If @code{printlevel}=1, progress debug messages will be printed,
    12501262@*       if @code{printlevel}>=2, all the debug messages will be printed.
     
    14001412"USAGE:  annfsRB(I, F [,eng]);  I an ideal, F a poly, eng an optional int
    14011413RETURN:  ring
    1402 PURPOSE: compute the annihilator ideal of f^s in the Weyl Algebra, based on the
    1403 output of Sannfs like procedure
     1414PURPOSE: compute the annihilator ideal of f^s in the Weyl Algebra,
     1415@* based on the output of Sannfs like procedure
    14041416NOTE:    activate this ring with the @code{setring} command. In this ring,
    14051417@*       - the ideal LD (which is a Groebner basis) is the annihilator of f^s,
     
    15891601"USAGE:  operatorBM(f [,eng]);  f a poly, eng an optional int
    15901602RETURN:  ring
    1591 PURPOSE: compute the B-operator and other relevant data for Ann F^s, according to the algorithm by Briancon and Maisonobe
     1603PURPOSE: compute the B-operator and other relevant data for Ann F^s,
     1604@*  using e.g. algorithm by Briancon and Maisonobe for Ann F^s and BS.
    15921605NOTE:    activate this ring with the @code{setring} command. In this ring D[s]
    15931606@*       - the polynomial F is the same as the input,
     
    19821995"USAGE:  annfsParamBM(f [,eng]);  f a poly, eng an optional int
    19831996RETURN:  ring
    1984 PURPOSE: compute the generic Ann F^s and exceptional parametric constellations of a polynomial with parametric coefficients, according to the algorithm by Briancon and Maisonobe
     1997PURPOSE: compute the generic Ann F^s and exceptional parametric constellations
     1998@* of a polynomial with parametric coefficients with the BM algorithm
    19851999NOTE:    activate this ring with the @code{setring} command. In this ring,
    19862000@*       - the ideal LD is the D-module structure oa Ann F^s
     
    22242238"USAGE:  annfsBMI(F [,eng]);  F an ideal, eng an optional int
    22252239RETURN:  ring
    2226 PURPOSE: compute the D-module structure of basering[1/f]*f^s where f = F[1]*..*F[P],
    2227 according to the algorithm by Briancon and Maisonobe.
     2240PURPOSE: compute the D-module structure of basering[1/f]*f^s where
     2241@* f = F[1]*..*F[P], according to the algorithm by Briancon and Maisonobe.
    22282242NOTE:    activate this ring with the @code{setring} command. In this ring,
    22292243@*       - the ideal LD is the needed D-mod structure,
     
    25532567"USAGE:  annfsOT(f [,eng]);  f a poly, eng an optional int
    25542568RETURN:  ring
    2555 PURPOSE: compute the D-module structure of basering[1/f]*f^s, according
    2556 to the algorithm by Oaku and Takayama
     2569PURPOSE: compute the D-module structure of basering[1/f]*f^s,
     2570@* according to the algorithm by Oaku and Takayama
    25572571NOTE:    activate this ring with the @code{setring} command. In this ring,
    25582572@*       - the ideal LD (which is a Groebner basis) is the needed D-module structure,
     
    29352949"USAGE:  SannfsOT(f [,eng]);  f a poly, eng an optional int
    29362950RETURN:  ring
    2937 PURPOSE: compute the D-module structure of basering[1/f]*f^s, according to the 1st step of the algorithm by Oaku and Takayama in the ring D[s], where D is the Weyl algebra
     2951PURPOSE: compute the D-module structure of basering[1/f]*f^s, according to the
     2952@* 1st step of the algorithm by Oaku and Takayama in the ring D[s]
    29382953NOTE:    activate this ring with the @code{setring} command.
    2939 @*       In the ring D[s], the ideal LD (which is NOT a Groebner basis) is the needed D-module structure.
    2940 @*       If eng <>0, @code{std} is used for Groebner basis computations,
    2941 @*       otherwise, and by default @code{slimgb} is used.
    2942 @*       If printlevel=1, progress debug messages will be printed,
    2943 @*       if printlevel>=2, all the debug messages will be printed.
     2954@*  In the output ring D[s], the ideal LD (which is NOT a Groebner basis)
     2955@*  is the needed D-module structure.
     2956@*  If eng <>0, @code{std} is used for Groebner basis computations,
     2957@*  otherwise, and by default @code{slimgb} is used.
     2958@*  If printlevel=1, progress debug messages will be printed,
     2959@*  if printlevel>=2, all the debug messages will be printed.
    29442960EXAMPLE: example SannfsOT; shows examples
    29452961"
     
    32173233"USAGE:  SannfsBM(f [,eng]);  f a poly, eng an optional int
    32183234RETURN:  ring
    3219 PURPOSE: compute the D-module structure of basering[1/f]*f^s, according to the 1st step of the algorithm by Briancon and Maisonobe in the ring D[s], where D is the Weyl algebra
    3220 NOTE:    activate this ring with the @code{setring} command.
    3221 @*       In the ring D[s], the ideal LD (which is NOT a Groebner basis) is the needed D-module structure,
    3222 @*       If eng <>0, @code{std} is used for Groebner basis computations,
    3223 @*       otherwise, and by default @code{slimgb} is used.
    3224 @*       If printlevel=1, progress debug messages will be printed,
    3225 @*       if printlevel>=2, all the debug messages will be printed.
     3235PURPOSE: compute the D-module structure of basering[1/f]*f^s, according to the
     3236@* 1st step of the algorithm by Briancon and Maisonobe in the ring D[s].
     3237NOTE:  Activate this ring with the @code{setring} command.
     3238@*   In the output ring D[s], the ideal LD (which is NOT a Groebner basis) is
     3239@*   the needed D-module structure.
     3240@*   If eng <>0, @code{std} is used for Groebner basis computations,
     3241@*   otherwise, and by default @code{slimgb} is used.
     3242@*   If printlevel=1, progress debug messages will be printed,
     3243@*   if printlevel>=2, all the debug messages will be printed.
    32263244EXAMPLE: example SannfsBM; shows examples
    32273245"
     
    34223440"USAGE:  SannfsBFCT(f [,eng]);  f a poly, eng an optional int
    34233441RETURN:  ring
    3424 PURPOSE: compute ann f^s and Groebner basis of ann f^s+f in D[s]
     3442PURPOSE: compute Ann f^s and Groebner basis of Ann f^s+f in D[s]
    34253443NOTE:    activate this ring with the @code{setring} command.
    3426 @*       This procedure, unlike SannfsBM, returns a ring with the degrevlex ordering in all variables.
    3427 @*       In the ring D[s], the ideal LD (which IS a Groebner basis) is the needed ideal.
    3428 @*       If eng <>0, @code{std} is used for Groebner basis computations,
    3429 @*       otherwise, and by default @code{slimgb} is used.
     3444@*  This procedure, unlike SannfsBM, returns a ring with the degrevlex
     3445@*  ordering in all variables.
     3446@*  In the ring D[s], the ideal LD (which IS a Groebner basis) is the needed ideal.
     3447@*  If eng <>0, @code{std} is used for Groebner basis computations,
     3448@*  otherwise, and by default @code{slimgb} is used.
     3449DISPLAY: If printlevel=1, progress debug messages will be printed,
     3450@*          if printlevel>=2, all the debug messages will be printed.
     3451EXAMPLE: example SannfsBFCT; shows examples
     3452"
     3453{
     3454  // DEBUG INFO: ordering on the output ring = dp, engine on the sum of ideals is used
     3455  // hence it's the situation for slimgb
     3456
     3457  int eng = 0;
     3458  if ( size(#)>0 )
     3459  {
     3460    if ( typeof(#[1]) == "int" )
     3461    {
     3462      eng = int(#[1]);
     3463    }
     3464  }
     3465  // returns a list with a ring and an ideal LD in it
     3466  int ppl = printlevel-voice+2;
     3467  //  printf("plevel :%s, voice: %s",printlevel,voice);
     3468  def save = basering;
     3469  int N = nvars(basering);
     3470  int Nnew = 2*N+2;
     3471  int i,j;
     3472  list RL = ringlist(basering);
     3473  list L, Lord;
     3474  L[1] = RL[1]; // char
     3475  L[4] = RL[4]; // char, minpoly
     3476  // check whether vars have admissible names
     3477  list Name  = RL[2];
     3478  list RName;
     3479  RName[1] = "@t";
     3480  RName[2] = "@s";
     3481  list PName;
     3482  int BadName;
     3483  if (size(RL[1])>1)
     3484  {
     3485    PName = RL[1][2];
     3486  }
     3487  //  PName;
     3488  for(i=1;i<=2;i++)
     3489  {
     3490    for(j=1; j<=N; j++)
     3491    {
     3492      if (Name[j] == RName[i])
     3493      {
     3494        BadName = 1;
     3495        break;
     3496      }
     3497    }
     3498    for(j=1; j<=size(PName); j++)
     3499    {
     3500      if (PName[j] == RName[i])
     3501      {
     3502        BadName = 1;
     3503        break;
     3504      }
     3505    }
     3506  }
     3507  if (BadName == 1)
     3508  {
     3509    ERROR("Variable/parameter names should not include @t,@s");
     3510  }
     3511  kill PName,BadName;
     3512  // now, create the names for new vars
     3513  list DName;
     3514  for(i=1;i<=N;i++)
     3515  {
     3516    DName[i] = "D"+Name[i]; // concat
     3517  }
     3518  list NName = RName + DName + Name ;
     3519  L[2]   = NName;
     3520  // Name, Dname will be used further
     3521  kill NName;
     3522  // block ord (lp(2),dp);
     3523  Lord[1] = list("lp",intvec(1,1));
     3524  // continue with dp 1,1,1,1...
     3525  Lord[2] = list("dp",intvec(1:Nnew));
     3526  Lord[3] = list("C",intvec(0));
     3527  L[3]      = Lord;
     3528  // we are done with the list
     3529  def @R@ = ring(L);
     3530  setring @R@;
     3531  matrix @D[Nnew][Nnew];
     3532  @D[1,2] = var(1);
     3533  for(i=1; i<=N; i++)
     3534  {
     3535    @D[2+i,N+2+i]=-1;
     3536  }
     3537  //  L[5] = matrix(UpOneMatrix(Nnew));
     3538  //  L[6] = @D;
     3539  def @R = nc_algebra(1,@D);
     3540  setring @R;
     3541  kill @R@;
     3542  dbprint(ppl,"// -1-1- the ring @R(@t,@s,_Dx,_x) is ready");
     3543  dbprint(ppl-1, @R);
     3544  // create the ideal I
     3545  poly  F = imap(save,F);
     3546  ideal I = var(1)*F+var(2);
     3547  poly p;
     3548  for(i=1; i<=N; i++)
     3549  {
     3550    p = var(1); // t
     3551    p = diff(F,var(N+2+i))*p;
     3552    I = I, var(2+i) + p;
     3553  }
     3554  // -------- the ideal I is ready ----------
     3555  dbprint(ppl,"// -1-2- starting the elimination of @t in @R");
     3556  dbprint(ppl-1, I);
     3557  ideal J = engine(I,eng);
     3558  ideal K = nselect(J,1);
     3559  dbprint(ppl,"// -1-3- @t is eliminated");
     3560  dbprint(ppl-1, K);  // K is without @t
     3561  K = engine(K,eng);  // std does the job too
     3562  // now, we must change the ordering
     3563  // and create a ring without @t
     3564  //  setring S;
     3565  // ----------- the ring @R3 ------------
     3566  // _Dx,_x,s;  +fast ord !
     3567  // keep: N, i,j,RL
     3568  Nnew = 2*N+1;
     3569  kill Lord, RName;
     3570  list Lord;
     3571  list L=imap(save,L);
     3572  list RL=imap(save,RL);
     3573  L[1] = RL[1];
     3574  L[4] = RL[4];  // char, minpoly
     3575  // check whether vars hava admissible names -> done earlier
     3576  // DName is defined earlier
     3577  list NName = DName + Name + list(string(var(2)));
     3578  L[2] = NName;
     3579  kill NName;
     3580  // just dp
     3581  // block ord (dp(N),dp);
     3582  Lord[1] = list("dp",intvec(1:Nnew));
     3583  Lord[2]= list("C",intvec(0));
     3584  L[3] = Lord;
     3585  // we are done with the list. Now add a Plural part
     3586  def @R2@ = ring(L);
     3587  setring @R2@;
     3588  matrix @D[Nnew][Nnew];
     3589  for (i=1; i<=N; i++)
     3590  {
     3591    @D[i,N+i]=-1;
     3592  }
     3593  def @R2 = nc_algebra(1,@D);
     3594  setring @R2;
     3595  kill @R2@;
     3596  dbprint(ppl,"//  -2-1- the ring @R2(_Dx,_x,@s) is ready");
     3597  dbprint(ppl-1, @R2);
     3598  ideal MM = maxideal(1);
     3599  MM = 0,var(Nnew),MM;
     3600  map R01 = @R, MM;
     3601  ideal K = R01(K);
     3602  // total cleanup
     3603  poly F = imap(save, F);
     3604  ideal LD = K,F;
     3605  dbprint(ppl,"//  -2-2- start GB computations for Ann f^s + f");
     3606  dbprint(ppl-1, LD);
     3607  LD = engine(LD,eng);
     3608  dbprint(ppl,"//  -2-3- finished GB computations for Ann f^s + f");
     3609  dbprint(ppl-1, LD);
     3610  // make leadcoeffs positive
     3611  for (i=1; i<= ncols(LD); i++)
     3612  {
     3613    if (leadcoef(LD[i]) <0 )
     3614    {
     3615      LD[i] = -LD[i];
     3616    }
     3617  }
     3618  export LD;
     3619  kill @R;
     3620  return(@R2);
     3621}
     3622example
     3623{
     3624  "EXAMPLE:"; echo = 2;
     3625  ring r = 0,(x,y,z,w),Dp;
     3626  poly F = x^3+y^3+z^3*w;
     3627  printlevel = 0;
     3628  def A = SannfsBFCT(F); setring A;
     3629  intvec v = 1,2,3,4,5,6,7,8;
     3630  // are there polynomials, depending on @s only?
     3631  nselect(LD,v);
     3632  // a fancier example:
     3633  def R = reiffen(4,5); setring R;
     3634  v = 1,2,3,4;
     3635  RC; // the Reiffen curve in 4,5
     3636  def B = SannfsBFCT(RC);
     3637  setring B;
     3638  // Are there polynomials, depending on @s only?
     3639  nselect(LD,v);
     3640  // It is not the case. Are there leading monomials in @s only?
     3641  nselect(lead(LD),v);
     3642}
     3643
     3644
     3645proc SannfsBFCTstd(poly F, list #)
     3646"USAGE:  SannfsBFCTstd(f [,eng]);  f a poly, eng an optional int
     3647RETURN:  ring
     3648PURPOSE: compute Ann f^s and Groebner basis of Ann f^s+f in D[s]
     3649NOTE:    activate this ring with the @code{setring} command.
     3650@*    This procedure, unlike SannfsBM, returns a ring with the degrevlex
     3651@*    ordering in all variables.
     3652@*    In the ring D[s], the ideal LD (which IS a Groebner basis) is the needed ideal.
     3653@*    In this procedure @code{std} is used for Groebner basis computations.
    34303654DISPLAY: If printlevel=1, progress debug messages will be printed,
    34313655@*       if printlevel>=2, all the debug messages will be printed.
    3432 EXAMPLE: example SannfsBFCT; shows examples
     3656EXAMPLE: example SannfsBFCTstd; shows examples
    34333657"
    34343658{
    3435   // DEBUG INFO: ordering on the output ring = dp, engine on the sum of ideals is used
    3436   // hence it's the situation for slimgb
     3659  // DEBUG INFO: ordering on the output ring = dp,
     3660  // use std(K,F); for reusing the std property of K
    34373661
    34383662  int eng = 0;
     
    35993823  // total cleanup
    36003824  poly F = imap(save, F);
    3601   ideal LD = K,F;
     3825  //  ideal LD = K,F;
    36023826  dbprint(ppl,"//  -2-2- start GB computations for Ann f^s + f");
    3603   dbprint(ppl-1, LD);
    3604   LD = engine(LD,eng);
     3827  //  dbprint(ppl-1, LD);
     3828  ideal LD = std(K,F);
     3829  //  LD = engine(LD,eng);
    36053830  dbprint(ppl,"//  -2-3- finished GB computations for Ann f^s + f");
    36063831  dbprint(ppl-1, LD);
     
    36333858  def B = SannfsBFCT(RC);
    36343859  setring B;
    3635   // are there polynomials, depending on s only?
     3860  // Are there polynomials, depending on s only?
    36363861  nselect(LD,v);
    3637   // it is not the case. Are there leading monomials in s only?
    3638   nselect(lead(LD),v);
    3639 }
    3640 
    3641 proc SannfsBFCTstd(poly F, list #)
    3642 "USAGE:  SannfsBFCTstd(f [,eng]);  f a poly, eng an optional int
    3643 RETURN:  ring
    3644 PURPOSE: compute ann f^s and Groebner basis of ann f^s+f in D[s]
    3645 NOTE:    activate this ring with the @code{setring} command.
    3646 @*       This procedure, unlike SannfsBM, returns a ring with the degrevlex ordering in all variables.
    3647 @*       In the ring D[s], the ideal LD (which IS a Groebner basis) is the needed ideal.
    3648 @*       In this procedure @code{std} is used for Groebner basis computations.
    3649 DISPLAY: If printlevel=1, progress debug messages will be printed,
    3650 @*       if printlevel>=2, all the debug messages will be printed.
    3651 EXAMPLE: example SannfsBFCTstd; shows examples
    3652 "
    3653 {
    3654   // DEBUG INFO: ordering on the output ring = dp,
    3655   // use std(K,F); for reusing the std property of K
    3656 
    3657   int eng = 0;
    3658   if ( size(#)>0 )
    3659   {
    3660     if ( typeof(#[1]) == "int" )
    3661     {
    3662       eng = int(#[1]);
    3663     }
    3664   }
    3665   // returns a list with a ring and an ideal LD in it
    3666   int ppl = printlevel-voice+2;
    3667   //  printf("plevel :%s, voice: %s",printlevel,voice);
    3668   def save = basering;
    3669   int N = nvars(basering);
    3670   int Nnew = 2*N+2;
    3671   int i,j;
    3672   string s;
    3673   list RL = ringlist(basering);
    3674   list L, Lord;
    3675   list tmp;
    3676   intvec iv;
    3677   L[1] = RL[1]; // char
    3678   L[4] = RL[4]; // char, minpoly
    3679   // check whether vars have admissible names
    3680   list Name  = RL[2];
    3681   list RName;
    3682   RName[1] = "@t";
    3683   RName[2] = "@s";
    3684   for(i=1;i<=N;i++)
    3685   {
    3686     for(j=1; j<=size(RName);j++)
    3687     {
    3688       if (Name[i] == RName[j])
    3689       {
    3690         ERROR("Variable names should not include @t,@s");
    3691       }
    3692     }
    3693   }
    3694   // now, create the names for new vars
    3695   list DName;
    3696   for(i=1;i<=N;i++)
    3697   {
    3698     DName[i] = "D"+Name[i]; // concat
    3699   }
    3700   tmp[1] = "t";
    3701   tmp[2] = "s";
    3702   list NName = tmp + DName + Name ;
    3703   L[2]   = NName;
    3704   // Name, Dname will be used further
    3705   kill NName;
    3706   // block ord (lp(2),dp);
    3707   tmp[1]  = "lp"; // string
    3708   iv      = 1,1;
    3709   tmp[2]  = iv; //intvec
    3710   Lord[1] = tmp;
    3711   // continue with dp 1,1,1,1...
    3712   tmp[1]  = "dp"; // string
    3713   s       = "iv=";
    3714   for(i=1;i<=Nnew;i++)
    3715   {
    3716     s = s+"1,";
    3717   }
    3718   s[size(s)]= ";";
    3719   execute(s);
    3720   kill s;
    3721   tmp[2]    = iv;
    3722   Lord[2]   = tmp;
    3723   tmp[1]    = "C";
    3724   iv        = 0;
    3725   tmp[2]    = iv;
    3726   Lord[3]   = tmp;
    3727   tmp       = 0;
    3728   L[3]      = Lord;
    3729   // we are done with the list
    3730   def @R@ = ring(L);
    3731   setring @R@;
    3732   matrix @D[Nnew][Nnew];
    3733   @D[1,2]=t;
    3734   for(i=1; i<=N; i++)
    3735   {
    3736     @D[2+i,N+2+i]=-1;
    3737   }
    3738   //  L[5] = matrix(UpOneMatrix(Nnew));
    3739   //  L[6] = @D;
    3740   def @R = nc_algebra(1,@D);
    3741   setring @R;
    3742   kill @R@;
    3743   dbprint(ppl,"// -1-1- the ring @R(t,s,_Dx,_x) is ready");
    3744   dbprint(ppl-1, @R);
    3745   // create the ideal I
    3746   poly  F = imap(save,F);
    3747   ideal I = t*F+s;
    3748   poly p;
    3749   for(i=1; i<=N; i++)
    3750   {
    3751     p = t; // t
    3752     p = diff(F,var(N+2+i))*p;
    3753     I = I, var(2+i) + p;
    3754   }
    3755   // -------- the ideal I is ready ----------
    3756   dbprint(ppl,"// -1-2- starting the elimination of t in @R");
    3757   dbprint(ppl-1, I);
    3758   ideal J = engine(I,eng);
    3759   ideal K = nselect(J,1);
    3760   dbprint(ppl,"// -1-3- t is eliminated");
    3761   dbprint(ppl-1, K);  // K is without t
    3762   K = engine(K,eng);  // std does the job too
    3763   // now, we must change the ordering
    3764   // and create a ring without t
    3765   //  setring S;
    3766   // ----------- the ring @R3 ------------
    3767   // _Dx,_x,s;  +fast ord !
    3768   // keep: N, i,j,s, tmp, RL
    3769   Nnew = 2*N+1;
    3770   kill Lord, tmp, iv, RName;
    3771   list Lord, tmp;
    3772   intvec iv;
    3773   list L=imap(save,L);
    3774   list RL=imap(save,RL);
    3775   L[1] = RL[1];
    3776   L[4] = RL[4];  // char, minpoly
    3777   // check whether vars hava admissible names -> done earlier
    3778   // now, create the names for new var
    3779   tmp[1] = "s";
    3780   // DName is defined earlier
    3781   list NName = DName + Name + tmp;
    3782   L[2] = NName;
    3783   tmp = 0;
    3784   // just dp
    3785   // block ord (dp(N),dp);
    3786   string s = "iv=";
    3787   for (i=1; i<=Nnew; i++)
    3788   {
    3789     s = s+"1,";
    3790   }
    3791   s[size(s)]=";";
    3792   execute(s);
    3793   tmp[1] = "dp";  // string
    3794   tmp[2] = iv;   // intvec
    3795   Lord[1] = tmp;
    3796   kill s;
    3797   kill NName;
    3798   tmp[1]      = "C";
    3799   Lord[2]     = tmp;  tmp = 0;
    3800   L[3]        = Lord;
    3801   // we are done with the list. Now add a Plural part
    3802   def @R2@ = ring(L);
    3803   setring @R2@;
    3804   matrix @D[Nnew][Nnew];
    3805   for (i=1; i<=N; i++)
    3806   {
    3807     @D[i,N+i]=-1;
    3808   }
    3809   def @R2 = nc_algebra(1,@D);
    3810   setring @R2;
    3811   kill @R2@;
    3812   dbprint(ppl,"//  -2-1- the ring @R2(_Dx,_x,s) is ready");
    3813   dbprint(ppl-1, @R2);
    3814   ideal MM = maxideal(1);
    3815   MM = 0,s,MM;
    3816   map R01 = @R, MM;
    3817   ideal K = R01(K);
    3818   // total cleanup
    3819   poly F = imap(save, F);
    3820   //  ideal LD = K,F;
    3821   dbprint(ppl,"//  -2-2- start GB computations for Ann f^s + f");
    3822   //  dbprint(ppl-1, LD);
    3823   ideal LD = std(K,F);
    3824   //  LD = engine(LD,eng);
    3825   dbprint(ppl,"//  -2-3- finished GB computations for Ann f^s + f");
    3826   dbprint(ppl-1, LD);
    3827   // make leadcoeffs positive
    3828   for (i=1; i<= ncols(LD); i++)
    3829   {
    3830     if (leadcoef(LD[i]) <0 )
    3831     {
    3832       LD[i] = -LD[i];
    3833     }
    3834   }
    3835   export LD;
    3836   kill @R;
    3837   return(@R2);
    3838 }
    3839 example
    3840 {
    3841   "EXAMPLE:"; echo = 2;
    3842   ring r = 0,(x,y,z,w),Dp;
    3843   poly F = x^3+y^3+z^3*w;
    3844   printlevel = 0;
    3845   def A = SannfsBFCT(F); setring A;
    3846   intvec v = 1,2,3,4,5,6,7,8;
    3847   // are there polynomials, depending on s only?
    3848   nselect(LD,v);
    3849   // a fancier example:
    3850   def R = reiffen(4,5); setring R;
    3851   v = 1,2,3,4;
    3852   RC; // the Reiffen curve in 4,5
    3853   def B = SannfsBFCT(RC);
    3854   setring B;
    3855   // are there polynomials, depending on s only?
    3856   nselect(LD,v);
    3857   // it is not the case. Are there leading monomials in s only?
     3862  // It is not the case. Are there leading monomials in s only?
    38583863  nselect(lead(LD),v);
    38593864}
     
    38643869"USAGE:  SannfsLOT(f [,eng]);  f a poly, eng an optional int
    38653870RETURN:  ring
    3866 PURPOSE: compute the D-module structure of basering[1/f]*f^s, according to the Levandovskyy's modification of the algorithm by Oaku and Takayama in the ring D[s], where D is the Weyl algebra
     3871PURPOSE: compute the D-module structure of basering[1/f]*f^s, according to the
     3872@* Levandovskyy's modification of the algorithm by Oaku and Takayama in D[s]
    38673873NOTE:    activate this ring with the @code{setring} command.
    3868 @*       In the ring D[s], the ideal LD (which is NOT a Groebner basis) is the needed D-module structure.
    3869 @*       If eng <>0, @code{std} is used for Groebner basis computations,
    3870 @*       otherwise, and by default @code{slimgb} is used.
    3871 @*       If printlevel=1, progress debug messages will be printed,
    3872 @*       if printlevel>=2, all the debug messages will be printed.
     3874@*    In the ring D[s], the ideal LD (which is NOT a Groebner basis) is
     3875@*    the needed D-module structure.
     3876@*    If eng <>0, @code{std} is used for Groebner basis computations,
     3877@*    otherwise, and by default @code{slimgb} is used.
     3878@*    If printlevel=1, progress debug messages will be printed,
     3879@*    if printlevel>=2, all the debug messages will be printed.
    38733880EXAMPLE: example SannfsLOT; shows examples
    38743881"
     
    43194326"USAGE:  annfsLOT(F [,eng]);  F a poly, eng an optional int
    43204327RETURN:  ring
    4321 PURPOSE: compute the D-module structure of basering[1/f]*f^s, according to the Levandovskyy's modification of the algorithm by Oaku and Takayama
     4328PURPOSE: compute the D-module structure of basering[1/f]*f^s, according to
     4329@* the Levandovskyy's modification of the algorithm by Oaku and Takayama
    43224330NOTE:    activate this ring with the @code{setring} command. In this ring,
    4323 @*       - the ideal LD (which is a Groebner basis) is the needed D-module structure,
    4324 @*         which is obtained by substituting the minimal integer root of a Bernstein
    4325 @*         polynomial into the s-parametric ideal;
    4326 @*       - the list BS contains the roots with multiplicities of a Bernstein polynomial of f.
    4327 @*       If eng <>0, @code{std} is used for Groebner basis computations,
    4328 @*       otherwise and by default @code{slimgb} is used.
    4329 @*       If printlevel=1, progress debug messages will be printed,
    4330 @*       if printlevel>=2, all the debug messages will be printed.
     4331@*  - the ideal LD (which is a Groebner basis) is the needed D-module structure,
     4332@*    which is obtained by substituting the minimal integer root of a Bernstein
     4333@*    polynomial into the s-parametric ideal;
     4334@*  - the list BS contains the roots with multiplicities of BS polynomial of f.
     4335@*    If eng <>0, @code{std} is used for Groebner basis computations,
     4336@*    otherwise and by default @code{slimgb} is used.
     4337@*    If printlevel=1, progress debug messages will be printed,
     4338@*    if printlevel>=2, all the debug messages will be printed.
    43314339EXAMPLE: example annfsLOT; shows examples
    43324340"
     
    43634371"USAGE:  annfs0(I, F [,eng]);  I an ideal, F a poly, eng an optional int
    43644372RETURN:  ring
    4365 PURPOSE: compute the annihilator ideal of f^s in the Weyl Algebra, based on the
    4366 output of Sannfs-like procedure
     4373PURPOSE: compute the annihilator ideal of f^s in the Weyl Algebra, based
     4374@* on the output of Sannfs-like procedure
    43674375NOTE:    activate this ring with the @code{setring} command. In this ring,
    4368 @*       - the ideal LD (which is a Groebner basis) is the annihilator of f^s,
    4369 @*       - the list BS contains the roots with multiplicities of a Bernstein polynomial of f.
    4370 @*       If eng <>0, @code{std} is used for Groebner basis computations,
    4371 @*       otherwise and by default @code{slimgb} is used.
    4372 @*       If printlevel=1, progress debug messages will be printed,
    4373 @*       if printlevel>=2, all the debug messages will be printed.
     4376@* - the ideal LD (which is a Groebner basis) is the annihilator of f^s,
     4377@* - the list BS contains the roots with multiplicities of BS polynomial of f.
     4378@*  If eng <>0, @code{std} is used for Groebner basis computations,
     4379@*  otherwise and by default @code{slimgb} is used.
     4380@*  If printlevel=1, progress debug messages will be printed,
     4381@*  if printlevel>=2, all the debug messages will be printed.
    43744382EXAMPLE: example annfs0; shows examples
    43754383"
     
    48074815RETURN:  list
    48084816PURPOSE: convert a ringlist L into another ringlist,
    4809 where all the 'p' orderings are replaced with the 's' orderings.
     4817@* where all the 'p' orderings are replaced with the 's' orderings.
    48104818ASSUME: L is a result of a ringlist command
    48114819EXAMPLE: example convloc; shows examples
     
    48524860"USAGE:  annfspecial(I,F,mir,n);  I an ideal, F a poly, int mir, number n
    48534861RETURN:  ideal
    4854 PURPOSE: compute the annihilator ideal of F^n in the Weyl Algebra for a rational number n
    4855 ASSUME:  the basering contains 's' as a variable
    4856 NOTE:    We assume that the basering is D[s],
    4857 @*          ideal I is the Ann F^s in D[s] (obtained with e.g. SannfsBM, SannfsLOT, SannfsOT)
    4858 @*          integer 'mir' is the minimal integer root of the Bernstein polynomial of F
    4859 @*          and the number n is rational.
    4860 @*       We compute the real annihilator for any rational value of n (both generic and exceptional).
    4861 @*       The implementation goes along the lines of Saito-Sturmfels-Takayama, Alg. 5.3.15
     4862PURPOSE: compute the annihilator ideal of F^n in the Weyl Algebra
     4863@*           for the given rational number n
     4864ASSUME:  The basering is D[s] and contains 's' explicitly as a variable,
     4865@*   the ideal I is the Ann F^s in D[s] (obtained with e.g. SannfsBM),
     4866@*   the integer 'mir' is the minimal integer root of the BS polynomial of F,
     4867@*   and the number n is rational.
     4868NOTE: We compute the real annihilator for any rational value of n (both
     4869@*       generic and exceptional). The implementation goes along the lines of
     4870@*       the Algorithm 5.3.15 from Saito-Sturmfels-Takayama.
    48624871DISPLAY: If printlevel=1, progress debug messages will be printed,
    48634872@*       if printlevel>=2, all the debug messages will be printed.
     
    48654874"
    48664875{
     4876
     4877  if (!isRational(n))
     4878  {
     4879    "ERROR: n must be a rational number!";
     4880  }
    48674881  int ppl = printlevel-voice+2;
    48684882  //  int mir =  minIntRoot(L[1],0);
     
    50235037"USAGE:  isHolonomic(M); M an ideal/module/matrix
    50245038RETURN:  int, 1 if M is holonomic and 0 otherwise
    5025 ASSUME: basering is a Weyl algebra
     5039ASSUME: basering is a Weyl algebra in characteristic 0
    50265040PURPOSE: check the modules for the property of holonomy
    50275041NOTE:    M is holonomic, if 2*dim(M) = dim(R), where R is a
     
    50305044"
    50315045{
     5046  if (dmodappassumeViolation())
     5047  {
     5048    ERROR("Basering is inappropriate: characteristic>0 or qring present");
     5049  }
     5050  if (!isWeyl(basering))
     5051  {
     5052    ERROR("Basering is not a Weyl algebra");
     5053  }
     5054
    50325055  if ( (typeof(M) != "ideal") && (typeof(M) != "module") && (typeof(M) != "matrix") )
    50335056  {
     
    50615084RETURN:  ring
    50625085PURPOSE: set up the polynomial, describing a Reiffen curve
    5063 NOTE:    activate this ring with the @code{setring} command and find the
    5064          curve as a polynomial RC
    5065 @*   a Reiffen curve is defined as F = x^p + y^q + xy^{q-1}, q >= p+1 >= 5
    5066 ASSUME: q >= p+1 >= 5. Otherwise an error message is returned
     5086NOTE:  activate this ring with the @code{setring} command and
     5087@*       find the curve as a polynomial RC.
     5088@*  A Reiffen curve is defined as F = x^p + y^q + xy^{q-1}, q >= p+1 >= 5
     5089
    50675090EXAMPLE: example reiffen; shows examples
    50685091"
    50695092{
     5093  // we allow also other numbers, p \geq 1, q\geq 1
    50705094// a Reiffen curve is defined as
    50715095// F = x^p + y^q +x*y^{q-1}, q \geq p+1 \geq 5
    50725096
    5073   if ( (p<4) || (q<5) || (q-p<1) )
    5074   {
    5075     ERROR("Some of conditions p>=4, q>=5 or q>=p+1 is not satisfied!");
     5097// ASSUME: q >= p+1 >= 5. Otherwise an error message is returned
     5098
     5099//   if ( (p<4) || (q<5) || (q-p<1) )
     5100//   {
     5101//     ERROR("Some of conditions p>=4, q>=5 or q>=p+1 is not satisfied!");
     5102//   }
     5103  if ( (p<1) || (q<1) )
     5104  {
     5105    ERROR("Some of conditions p>=1, q>=1 is not satisfied!");
    50765106  }
    50775107  ring @r = 0,(x,y),dp;
     
    50925122RETURN:  ring
    50935123PURPOSE: set up the polynomial, describing a hyperplane arrangement
    5094 NOTE:   must be executed in a ring
    5095 ASSUME: basering is present
     5124NOTE:  must be executed in a commutative ring
     5125ASSUME: basering is present and it is commutative
    50965126EXAMPLE: example arrange; shows examples
    50975127"
     
    51555185
    51565186proc checkRoot(poly F, number a, list #)
    5157 "USAGE:  checkRoot(f,alpha [,S,eng]);  f a poly, alpha a number, S a string , eng an optional int
     5187"USAGE:  checkRoot(f,alpha [,S,eng]);  poly f, number alpha, string S, int eng
    51585188RETURN:  int
    5159 PURPOSE: check whether a rational is a root of the global Bernstein polynomial of f (and compute its multiplicity)
    5160 with the algorithm given in S and with the Groebner basis engine given in eng
    5161 NOTE:    The annihilator of f^s in D[s] is needed and it is computed according to the algorithm by Briancon and Maisonobe
    5162 @*       The value of a string S can be
    5163 @*       'alg1' (default) - for the algorithm 1 of J. Martin-Morales (unpublished)
    5164 @*       'alg2' - for the algorithm 2 of J. Martin-Morales (unpublished)
     5189ASSUME: Basering is commutative ring, alpha is a rational number.
     5190PURPOSE: check whether a rational number alpha is a root of the global
     5191@* Bernstein-Sato polynomial of f and compute its multiplicity,
     5192@* with the algorithm given by S and with the Groebner basis engine given by eng.
     5193NOTE:  The annihilator of f^s in D[s] is needed and hence it is computed with the
     5194@*       algorithm by Briancon and Maisonobe. The value of a string S can be
     5195@*       'alg1' (default) - for the algorithm 1 of [LM08]
     5196@*       'alg2' - for the algorithm 2 of [LM08]
    51655197@*       The output of type int is:
    5166 @*       'alg1': 1 if -alpha is a root of the global Bernstein polynomial and 0 otherwise
    5167 @*       'alg2':  the multiplicity of -alpha as a root of the global Bernstein polynomial of f.
    5168 @*                (If -alpha is not a root, the output is 0)
     5198@*       'alg1': 1 only if -alpha is a root of the global Bernstein-Sato polynomial
     5199@*       'alg2':  the multiplicity of -alpha as a root of the global Bernstein-Sato
     5200@*                  polynomial of f. If -alpha is not a root, the output is 0.
    51695201@*       If eng <>0, @code{std} is used for Groebner basis computations,
    51705202@*       otherwise (and by default) @code{slimgb} is used.
     
    51965228     {
    51975229       // incorrect value of S
    5198        print("Incorrect algorithm given, proceed with the default alg1 of J. Martín-Morales");
     5230       print("Incorrect algorithm given, proceed with the default alg1");
    51995231       algo = "alg1";
    52005232     }
     
    52695301
    52705302proc checkRoot1(ideal I, poly F, number a, list #)
    5271 "USAGE:  checkRoot1(I,f,alpha [,eng]);  I an ideal, f a poly, alpha a number, eng an optional int
    5272 ASSUME:  I is the annihilator of f^s in D[s], f is a polynomial in K[_x]
    5273 RETURN:  int, 1 if -alpha is a root of the global Bernstein polynomial of f and 0 otherwise
    5274 PURPOSE: check whether a rational is a root of the global Bernstein polynomial of f
    5275 NOTE:    If eng <>0, @code{std} is used for Groebner basis computations,
     5303"USAGE:  checkRoot1(I,f,alpha [,eng]);  ideal I, poly f, number alpha, int eng
     5304ASSUME:  Basering is D[s], I is the annihilator of f^s in D[s],
     5305@* that is basering and I are the output of Sannfs-like procedure,
     5306@* f is a polynomial in K[_x] and alpha is a rational number.
     5307RETURN:  int, 1 if -alpha is a root of the Bernstein-Sato polynomial of f
     5308PURPOSE: check, whether alpha is a root of the global Bernstein-Sato polynomial of f
     5309NOTE:  If eng <>0, @code{std} is used for Groebner basis computations,
    52765310@*       otherwise (and by default) @code{slimgb} is used.
    52775311DISPLAY: If printlevel=1, progress debug messages will be printed,
     
    52805314"
    52815315{
     5316  // to check: alpha is rational (has char 0 check inside)
     5317  if (!isRational(a))
     5318  {
     5319    "ERROR: alpha must be a rational number!";
     5320  }
     5321  //  no qring
     5322  if ( size(ideal(basering)) >0 )
     5323  {
     5324    "ERROR: no qring is allowed";
     5325  }
    52825326  int eng = 0;
    52835327  if ( size(#)>0 )
     
    53935437
    53945438proc checkRoot2 (ideal I, poly F, number a, list #)
    5395 "USAGE:  checkRoot2(I,f,alpha [,eng]);  I an ideal, f a poly, alpha a number, eng an optional int
    5396 ASSUME:  I is the annihilator of f^s in D[s], f is a polynomial in K[_x]
    5397 RETURN:  int, the multiplicity of -alpha as a root of the global Bernstein polynomial of f. If -alpha is not a root, the output is 0
    5398 PURPOSE: check whether a rational is a root of the global Bernstein polynomial of f and compute its multiplicity from the known Ann F^s in D[s]
    5399 NOTE:    If eng <>0, @code{std} is used for Groebner basis computations,
     5439"USAGE:  checkRoot2(I,f,a [,eng]);  I an ideal, f a poly, alpha a number, eng an optional int
     5440ASSUME:  I is the annihilator of f^s in D[s], basering is D[s],
     5441@* that is basering and I are the output os Sannfs-like procedure,
     5442@* f is a polynomial in K[_x] and alpha is a rational number.
     5443RETURN:  int, the multiplicity of -alpha as a root of the BS polynomial of f.
     5444PURPOSE: check whether a rational number alpha is a root of the global Bernstein-
     5445@* Sato polynomial of f and compute its multiplicity from the known Ann F^s in D[s]
     5446NOTE:   If -alpha is not a root, the output is 0.
     5447@*       If eng <>0, @code{std} is used for Groebner basis computations,
    54005448@*       otherwise (and by default) @code{slimgb} is used.
    54015449DISPLAY: If printlevel=1, progress debug messages will be printed,
     
    54045452"
    54055453{
     5454
     5455 
     5456  // to check: alpha is rational (has char 0 check inside)
     5457  if (!isRational(a))
     5458  {
     5459    "ERROR: alpha must be a rational number!";
     5460  }
     5461  //  no qring
     5462  if ( size(ideal(basering)) >0 )
     5463  {
     5464    "ERROR: no qring is allowed";
     5465  }
     5466
    54065467  int eng = 0;
    54075468  if ( size(#)>0 )
     
    55255586proc checkFactor(ideal I, poly F, poly q, list #)
    55265587"USAGE:  checkFactor(I,f,qs [,eng]);  I an ideal, f a poly, qs a poly, eng an optional int
    5527 ASSUME:  I is the output of Sannfs, SannfsBM, SannfsLOT or SannfsOT,
    5528          f is a polynomial in K[_x], qs is a polynomial in K[s]
     5588ASSUME:  checkFactor is called from the basering, created by Sannfs-like proc,
     5589@* that is, from the Weyl algebra in x1,..,xN,d1,..,dN tensored with K[s].
     5590@* The ideal I is the annihilator of f^s in D[s], that is the ideal, computed
     5591@* by Sannfs-like procedure (usually called LD there).
     5592@* Moreover, f is a polynomial in K[x1,..,xN] and qs is a polynomial in K[s].
    55295593RETURN:  int, 1 if qs is a factor of the global Bernstein polynomial of f and 0 otherwise
    5530 PURPOSE: check whether a rational is a root of the global Bernstein polynomial of f and compute its multiplicity from the known Ann F^s in D[s]
     5594PURPOSE: check whether a univariate polynomial qs is a factor of the
     5595@*  Bernstein-Sato polynomial of f without explicit knowledge of the latter.
    55315596NOTE:    If eng <>0, @code{std} is used for Groebner basis computations,
    55325597@*       otherwise (and by default) @code{slimgb} is used.
     
    55365601"
    55375602{
     5603
     5604  // ASSUME too complicated, cannot check it.
     5605
    55385606  int eng = 0;
    55395607  if ( size(#)>0 )
     
    55955663RETURN:  int
    55965664PURPOSE: returns the number of the variable with the name s
    5597 among the variables of basering or 0 if there is no such variable
     5665@*  among the variables of basering or 0 if there is no such variable
    55985666EXAMPLE: example varnum; shows examples
    55995667"
     
    56215689"USAGE:  indAR(L,n);  list L, int n
    56225690RETURN:  list
    5623 PURPOSE: computes arrangement inductively, using L and var(n) as the
    5624 next variable
     5691PURPOSE: computes arrangement inductively, using L and
     5692@* var(n) as the next variable
    56255693ASSUME: L has a structure of an arrangement
    56265694EXAMPLE: example indAR; shows examples
     
    56665734  M = indAR(M,4);
    56675735  M;
     5736}
     5737
     5738proc isRational(number n)
     5739"USAGE:  isRational(n); n number
     5740RETURN:  int
     5741PURPOSE: determine whether n is a rational number,
     5742@* that is it does not contain parameters.
     5743ASSUME: ground field is of characteristic 0
     5744EXAMPLE: example indAR; shows examples
     5745"
     5746{
     5747  if (char(basering) != 0)
     5748  {
     5749    ERROR("The ground field must be of characteristic 0!");
     5750  }
     5751  number dn = denominator(n);
     5752  number nn = numerator(n);
     5753  return( ((int(dn)==dn) && (int(nn)==nn)) );
     5754}
     5755example
     5756{
     5757  "EXAMPLE:"; echo = 2;
     5758  ring r = (0,a),(x,y),dp;
     5759  number n1 = 11/73;
     5760  isRational(n1);
     5761  number n2 = (11*a+3)/72;
     5762  isRational(n2);
    56685763}
    56695764
  • Singular/LIB/dmodapp.lib

    re6d283f reaf8f8  
    11//////////////////////////////////////////////////////////////////////////////
    2 version="$Id: dmodapp.lib,v 1.21 2009-03-06 20:32:29 levandov Exp $";
     2version="$Id: dmodapp.lib,v 1.22 2009-03-09 18:34:52 levandov Exp $";
    33category="Noncommutative";
    44info="
     
    15221522    }
    15231523  }
     1524 
    15241525  // 1. create  homogenized Weyl algebra
    15251526  // 1.1 create ordering
     
    15561557  def Dh = nc_algebra(1,@relD);
    15571558  setring Dh; kill @Dh;
    1558   dbprint(ppl,"// computing in ring",DDh);
     1559  dbprint(ppl,"// computing in ring",Dh);
    15591560  // 2. Compute the initial ideal
    15601561  ideal I = imap(save,I);
     
    16531654    u0 = 1:n;
    16541655  }
    1655   if (isCommutative() == 0) { ERROR("basering must be commutative"); }
    16561656  if (char(save) <> 0)      { ERROR("characteristic of basering has to be 0"); }
    16571657  // creating the homogenized extended Weyl algebra
    16581658  list RL = ringlist(save);
     1659  RL = RL[1..4]; // if basering is commutative nc_algebra
    16591660  list C0 = list("C",intvec(0));
    16601661  // 1. get the weighted degree of f
     
    17791780}
    17801781
    1781 static proc dmodappassumeViolation()
     1782proc dmodappassumeViolation()
    17821783{
    17831784  // returns Boolean : yes/no [for assume violation]
    17841785  // char K = 0
    17851786  // no qring
    1786   // input poly/ideal is nonzero ?
    1787   if ( (char(basering) !=0 ) || (nvars(basering) != gkdim(std(0)) ) )
    1788   {
     1787  if (  (size(ideal(basering)) >0) || (char(basering) >0) )
     1788  {
     1789    //    "ERROR: no qring is allowed";
    17891790    return(1);
    17901791  }
Note: See TracChangeset for help on using the changeset viewer.