Index: Singular/LIB/bfct.lib
===================================================================
--- Singular/LIB/bfct.lib	(revision 49f94f3754d486ab94e553bfb86651899f334c83)
+++ Singular/LIB/bfct.lib	(revision 238c959ae4616e6b794e6679468a388c696c97fd)
@@ -1,4 +1,4 @@
 //////////////////////////////////////////////////////////////////////////////
-version="$Id: bfct.lib,v 1.3 2008-08-22 09:31:56 Singular Exp $";
+version="$Id: bfct.lib,v 1.4 2008-10-01 17:44:37 levandov Exp $";
 category="Noncommutative";
 info="
@@ -19,9 +19,9 @@
 
 bfct(f[,s,t,v]);           compute the global Bernstein-Sato polynomial of a given poly
-bfctsyz(f[,r,s,t,v]);      compute the global Bernstein-Sato polynomial of a given poly
+bfctsyz(f[,r,s,t,u,v]);    compute the global Bernstein-Sato polynomial of a given poly
 bfctonestep(f[,s,t]);      compute the global Bernstein-Sato polynomial of a given poly
 bfctideal(I,w[,s,t]);      compute the global b-function of a given ideal w.r.t. a given weight
-minpol(f,I);               compute the minimal polynomial of the endormorphism in basering modulo I given by f
-minpolsyz(f,I[,p,t]);      compute the minimal polynomial of the endormorphism in basering modulo I given by f
+minpol(f,I);               compute the minimal polynomial of the endormorphism in basering modulo ideal given by a poly
+minpolsyz(f,I[,p,s,t]);    compute the minimal polynomial of the endormorphism in basering modulo ideal given by a poly
 linreduce(f,I[,s]);        reduce a poly by linear reductions of its leading term
 ncsolve(I[,s]);            find and compute a linear dependency of the elements of an ideal
@@ -41,9 +41,8 @@
 
 
-proc testbfctlib()
+proc testbfctlib ()
 {
   // tests all procs for consistency
   "AUXILIARY PROCEDURES:";
-
   example ispositive;
   example isin;
@@ -186,6 +185,6 @@
 RETURN:  an int, the standard scalar product of v and w
 PURPOSE: compute the scalar product of two intvecs
+NOTE:    the arguments must have the same size
 EXAMPLE: example scalarprod; shows examples
-NOTE:    the arguments must have the same size
 "
 {
@@ -218,6 +217,6 @@
 proc linreduce(poly f, ideal I, list #)
 "USAGE:  linreduce(f, I [,s]);  f a poly, I an ideal, s an optional int
-RETURN:  a poly obtained by linear reductions of the leading term with I
-PURPOSE: reduce a poly by linear reductions of its leading term only
+RETURN:  a poly obtained by linear reductions of the leading term of the given poly with an ideal
+PURPOSE: reduce a poly only by linear reductions of its leading term
 NOTE:    If s<>0, a list consisting of the reduced poly and the vector of the used 
 @*       reductions is returned.
@@ -280,5 +279,5 @@
   ideal I = 1,y,xy;
   poly f = 5xy+7y+3;
-  poly g = 5xy+7x+3;
+  poly g = 5y+7x+3;
   linreduce(f,I);
   linreduce(g,I);
@@ -349,10 +348,8 @@
     dbprint(ppl, "ncsolve: starting Groebner basis computation with engine:", whichengine);
     QQ = engine(QQ,whichengine);
-    dbprint(ppl, "QQ after groebner:", QQ);
-    //    "QQ after groebner:"; QQ;
+    dbprint(ppl, "QQ after engine:", QQ);
     if (dim(QQ) == -1)
     {
       dbprint(ppl+1, "no solutions by ncsolve");
-      //      "no solutions by ncsolve";
       // output zeroes
       setring save;
@@ -362,6 +359,6 @@
     // 4. in order to get the numeric values
     matrix AA = matrix(maxideal(1));
-    attrib(QQ,"isSB",1); // to suppress NF warnings
-    AA = NF(AA,QQ);      // todo: we still receive NF warnings
+    module MQQ = std(module(QQ));
+    AA = NF(AA,MQQ); // todo: we still receive NF warnings
     dbprint(ppl, "AA after NF:",AA);
     //    "AA after NF:"; print(AA);
@@ -483,15 +480,16 @@
 {
   "EXAMPLE:"; echo = 2;
-  ring r = 0,(t,x,y,Dt,Dx,Dy),dp;
-  def D = Weyl();
+  printlevel = 0;
+  ring r = 0,(x,y),dp;
+  poly f = x^2+y^3+x*y^2;
+  def D = initialmalgrange(f);
   setring D;
-  ideal I = x*Dt,6*t*Dt+2*y*Dy+3*x*Dx+6,3*y^2*Dx-2*x*Dy,2*y*x*Dy+3*x^2*Dx+6*x,y^2*Dt,y^3+x^2,9*y*x^2*Dx^2+4*x^2*Dy^2+6*y^2*Dy+24*y*x*Dx+18*y,27*x^3*Dx^3-8*x^2*Dy^3-12*y^2*Dy^2+162*x^2*Dx^2-48*y*Dy+186*x*Dx;
-  // I is a Groebner basis of the initial Malgrange ideal of x2+y3
+  inF;
   poly s = t*Dt;
-  vector m = minpol(s,I);m;
+  minpol(s,inF);
 }
 
 proc minpolsyz (poly s, ideal II, list #)
-"USAGE:  minpolsyz(f, I [,p,t]);  f a poly, I an ideal, p, t optial ints, p a prime number
+"USAGE:  minpolsyz(f, I [,p,s,t]);  f a poly, I an ideal, p, t optial ints, p a prime number
 RETURN:  coefficient vector of the minimal polynomial of the endomorphism of basering modulo I defined by f
 PURPOSE: compute the minimal polynomial
@@ -502,7 +500,8 @@
 @*       Otherwise, it searched for all degrees.
 @*       This is done by computing syzygies.
-@*       If s<>0, @code{std} is used for Groebner basis computations,
-@*       otherwise @code{slimgb} is used.
-@*       By default, @code{slimgb} is used in char 0 and @code{std} in char p.
+@*       If s<>0, @code{std} is used for Groebner basis computations in char 0,
+@*       otherwise, and by default, @code{slimgb} is used.
+@*       If t<>0 and by default, @code{std} is used for Groebner basis computations in char >0,
+@*       otherwise, @code{slimgb} is used.
 @*       If printlevel=1, progress debug messages will be printed,
 @*       if printlevel>=2, all the debug messages will be printed.
@@ -515,5 +514,5 @@
   int ppl = printlevel-voice+2;
   int whichengine  = 0; // default
-  int enginespec   = 0; // default
+  int modengine    = 1; // default
   int solveincharp = 0; // default
   def save = basering;
@@ -522,5 +521,5 @@
     if (typeof(#[1])=="int" || typeof(#[1])=="number")
     {
-      solveincharp = int( #[1]);
+      solveincharp = int(#[1]);
     }
     if (size(#)>1)
@@ -529,5 +528,11 @@
       {
         whichengine = int(#[2]);
-	enginespec = 1;
+      }
+      if (size(#)>2)
+      {
+	if (typeof(#[3])=="int" || typeof(#[3])=="number")
+	{
+	  modengine = int(#[3]);
+	}
       }
     }
@@ -586,12 +591,5 @@
       setring Rp;
       NI[i+1] = phi(newNF);
-      if (enginespec==1)
-      {
-	v = ncsolve(NI,whichengine);
-      }
-      else
-      {
-	v = ncsolve(NI);
-      }
+      v = ncsolve(NI,modengine);
       if (v!=0) // there is a modular solution
       {
@@ -647,13 +645,14 @@
 {
   "EXAMPLE:"; echo = 2;
-  ring r = 0,(t,x,y,Dt,Dx,Dy),dp;
-  def D = Weyl();
+  printlevel = 0;
+  ring r = 0,(x,y),dp;
+  poly f = x^2+y^3+x*y^2;
+  def D = initialmalgrange(f);
   setring D;
-  ideal I = x*Dt,6*t*Dt+2*y*Dy+3*x*Dx+6,3*y^2*Dx-2*x*Dy,2*y*x*Dy+3*x^2*Dx+6*x,y^2*Dt,y^3+x^2,9*y*x^2*Dx^2+4*x^2*Dy^2+6*y^2*Dy+24*y*x*Dx+18*y,27*x^3*Dx^3-8*x^2*Dy^3-12*y^2*Dy^2+162*x^2*Dx^2-48*y*Dy+186*x*Dx;
-  // I is a Groebner basis of the initial Malgrange ideal of x2+y3
+  inF;
   poly s = t*Dt;
-  minpolsyz(s,I);
+  minpolsyz(s,inF);
   int p = prime(20000);
-  minpolsyz(s,I,p,0);
+  minpolsyz(s,inF,p,0,0);
 }
 
@@ -685,5 +684,5 @@
   map @m = save,J;
   poly p = @m(p);
-  if (substitution ==1)
+  if (substitution == 1)
   {
     p = subst(p,s,-s-1);
@@ -706,5 +705,5 @@
 }
 
-static proc bfctengine (poly f, int whichengine, int methodord, int methodminpol, int minpolchar, intvec u0)
+static proc bfctengine (poly f, int whichengine, int methodord, int methodminpol, int minpolchar, int modengine, intvec u0)
 {
   int ppl = printlevel - voice +2;
@@ -735,5 +734,5 @@
 	  usedprimes = usedprimes,q;
 	  dbprint(ppl,"used prime is: "+string(q));
-	  b = minpolsyz(s,inI,q,whichengine);
+	  b = minpolsyz(s,inI,q,whichengine,modengine);
 	}
 	i++;
@@ -756,6 +755,6 @@
 
 proc bfct (poly f, list #)
-"USAGE:  bfct(f [,s,t,v]);  f a poly, r,s,t optional ints, v an optional intvec
-RETURN:  list of roots of the Bernstein-Sato polynomial bs(f) and its multiplicies
+"USAGE:  bfct(f [,s,t,v]);  f a poly, s,t optional ints, v an optional intvec
+RETURN:  list of roots of the Bernstein-Sato polynomial bs(f) and their multiplicies
 PURPOSE: compute the global Bernstein-Sato polynomial for a hypersurface, defined by f, according to the algorithm by Masayuki Noro
 NOTE:    In this proc, a system of linear equations is solved by linear reductions.
@@ -802,5 +801,5 @@
     }
   }
-  list b = bfctengine(f,whichengine,methodord,0,0,u0);
+  list b = bfctengine(f,whichengine,methodord,0,0,0,u0);
   return(b);
 }
@@ -809,11 +808,12 @@
   "EXAMPLE:"; echo = 2;
   ring r = 0,(x,y),dp;
-  poly f = x2+y3+x*y^2;
+  poly f = x^2+y^3+x*y^2;
   bfct(f);
-  bfct(f,1,1);
+  intvec v = 3,2;
+  bfct(f,1,0,v);
 }
 
 proc bfctsyz (poly f, list #)
-"USAGE:  bfctsyz(f [,r,s,t,v]);  f a poly, r,s,t optional ints, v an optional intvec
+"USAGE:  bfctsyz(f [,r,s,t,u,v]);  f a poly, r,s,t,u optional ints, v an optional intvec
 RETURN:  list of roots of the Bernstein-Sato polynomial bs(f) and its multiplicies
 PURPOSE: compute the global Bernstein-Sato polynomial for a hypersurface, defined by f, according to the algorithm by Masayuki Noro
@@ -825,6 +825,6 @@
 @*       If t<>0, the minimal polynomial computation is solely performed over charasteristic 0,
 @*       otherwise and by default, a modular method is used.
-@*       If u<>0, @code{std} is used for Groebner basis computations in characteristic >0,
-@*       otherwise, and by default, @code{slimgb} is used. 
+@*       If u<>0 and by default, @code{std} is used for Groebner basis computations in characteristic >0,
+@*       otherwise, @code{slimgb} is used. 
 @*       If v is a positive weight vector, v is used for homogenization computations,
 @*       otherwise and by default, no weights are used.
@@ -847,4 +847,5 @@
   int methodord   = 0; // default
   int minpolchar  = 0; // default
+  int modengine   = 1; // default
   intvec u0       = 0; // default
   if (size(#)>0)
@@ -866,9 +867,16 @@
 	  minpolchar = int(#[3]);
 	}
-        if (size(#)>3)
+	if (size(#)>3)
         {
-	  if (typeof(#[4])=="intvec" && size(#[4])==n && ispositive(#[4])==1)
+	  if (typeof(#[4])=="int" || typeof(#[4])=="number")
           {
-	    u0 = #[4];
+	    modengine = int(#[4]);
+	  }
+	  if (size(#)>4)
+	  {
+	    if (typeof(#[5])=="intvec" && size(#[5])==n && ispositive(#[5])==1)
+	    {
+	      u0 = #[5];
+	    }
 	  }
 	}
@@ -876,5 +884,5 @@
     }
   }
-  list b = bfctengine(f,whichengine,methodord,1,minpolchar,u0);
+  list b = bfctengine(f,whichengine,methodord,1,minpolchar,modengine,u0);
   return(b);
 }
@@ -883,13 +891,14 @@
   "EXAMPLE:"; echo = 2;
   ring r = 0,(x,y),dp;
-  poly F = x2+y3;
-  bfctsyz(F);
-  bfctsyz(F,1,1,1);
+  poly f = x^2+y^3+x*y^2;
+  bfctsyz(f);
+  intvec v = 3,2;
+  bfctsyz(f,0,1,1,0,v);
 }
 
 proc bfctideal (ideal I, intvec w, list #)
-"USAGE:  bfctideal(I,w[,s,t]);  I an ideal, r,s optional ints
-RETURN:  list of roots and its multiplicies of the global b-function of I w.r.t. to the weight -w,w
-PURPOSE: compute the global b-function of an ideal according to the algorithm by Masayuki Noro
+"USAGE:  bfctideal(I,w[,s,t]);  I an ideal, w an intvec, s,t optional ints
+RETURN:  list of roots and their multiplicies of the global b-function of I w.r.t. the weight vector (-w,w)
+PURPOSE: compute the global b-function of an ideal according to the algorithm by M. Noro
 NOTE:    Assume, I is an ideal in the n-th Weyl algebra where the sequence of the
 @*       variables is x(1),...,x(n),D(1),...,D(n).
@@ -937,6 +946,6 @@
   "EXAMPLE:"; echo = 2;
   ring @D = 0,(x,y,Dx,Dy),dp;
-  def DD = Weyl();
-  setring DD;
+  def D = Weyl();
+  setring D;
   ideal I = 3*x^2*Dy+2*y*Dx,2*x*Dx+3*y*Dy+6;
   intvec w1 = 1,1;
@@ -944,6 +953,6 @@
   intvec w3 = 2,3;
   bfctideal(I,w1);
-  bfctideal(I,w2);
-  bfctideal(I,w3);
+  bfctideal(I,w2,1);
+  bfctideal(I,w3,0,1);
 }
 
@@ -984,4 +993,5 @@
   def DDh = initialidealengine("bfctonestep", whichengine, methodord, f);
   setring DDh;
+  dbprint(ppl, "the initial ideal:", string(matrix(inF)));
   inF = nselect(inF,3,2*n+4);
   inF = nselect(inF,1);
@@ -1000,6 +1010,7 @@
   "EXAMPLE:"; echo = 2;
   ring r = 0,(x,y),dp;
-  poly f = x2+y3;
+  poly f = x^2+y^3+x*y^2;
   bfctonestep(f);
+  bfctonestep(f,1,1);
 }
 
Index: Singular/LIB/dmodapp.lib
===================================================================
--- Singular/LIB/dmodapp.lib	(revision 49f94f3754d486ab94e553bfb86651899f334c83)
+++ Singular/LIB/dmodapp.lib	(revision 238c959ae4616e6b794e6679468a388c696c97fd)
@@ -1,4 +1,4 @@
 //////////////////////////////////////////////////////////////////////////////
-version="$Id: dmodapp.lib,v 1.7 2008-08-08 12:57:31 Singular Exp $";
+version="$Id: dmodapp.lib,v 1.8 2008-10-01 17:44:38 levandov Exp $";
 category="Noncommutative";
 info="
@@ -19,5 +19,5 @@
 initialideal(I,u,v[,s,t]); compute the initial ideal of a given ideal w.r.t. given weights
 
-SECONDARY PROCEDURES FOR D-MODULES:
+SECONDARY PROCEDURES FOR D-MODULES: //todo: no seperate paragraph on web page
 isFsat(I, F);            check whether the ideal I is F-saturated
 SDLoc(I, F); compute a generic presentation of the localization of D/I w.r.t. f^s, for D a Weyl algebra
@@ -66,12 +66,12 @@
 
 proc initialideal (ideal I, intvec u, intvec v, list #)
-"USAGE:  initialideal(I, [,s,t]);  I an ideal, s,t optional ints
-RETURN:  an ideal, the initial ideal of the input ideal w.r.t. the weights u and v
+"USAGE:  initialideal(I,u,v [,s,t]);  I an ideal, u,v intvecs, s,t optional ints
+RETURN:  an ideal, a Broebner basis of the initial ideal of the input ideal w.r.t. the weights u and v
 PURPOSE: compute the initial ideal
 NOTE:    Assume, I is an ideal in the n-th Weyl algebra where the sequence of the
-@*       variables is x(1),...,x(n),D(1),...,D(n).
+@*       indeterminates is x(1),...,x(n),D(1),...,D(n).
 @*       Further assume that u is the weight for the x(i) and v the weight for the D(i).
 @*       Note that the returned ideal is not a D-ideal but an ideal in the associated
-@*       graded ring.
+@*       graded ring while the Groebner basis is a subset of D.
 @*       If s<>0, @code{std} is used for Groebner basis computations, otherwise,
 @*       and by default, @code{slimgb} is used. 
@@ -119,6 +119,6 @@
 proc initialmalgrange (poly f,list #)
 "USAGE:  initialmalgrange(f, [,s,t,u,v]);  f a poly, s,t,u optional ints, v an optional intvec
-RETURN:  a ring, the Weyl algebra induced by the basering, extended in the variables t and Dt
-PURPOSE: compute the initial Malgrange ideal of a given poly w.r.t. to the weight vector
+RETURN:  a ring, the Weyl algebra induced by the basering, extended in the indeterminates t and Dt
+PURPOSE: compute the initial Malgrange ideal of a given poly w.r.t. the weight vector
 @*       (-1,0...,0,1,0,...,0) such that the weight of t is -1 and the weight of Dt is 1.
 NOTE:    Activate the output ring with the @code{setring} command.
@@ -184,10 +184,11 @@
   "EXAMPLE:"; echo = 2;
   ring r = 0,(x,y),dp;
-  poly f = x2+y3;
+  poly f = x^2+y^3+x*y^2;
   def D = initialmalgrange(f);
   setring D;
   inF;
   setring r;
-  def D2 = initialmalgrange(f,1,1,1);
+  intvec v = 3,2;
+  def D2 = initialmalgrange(f,1,0,1,v);
   setring D2;
   inF;
@@ -218,7 +219,7 @@
   {
     poly f = #[1];
-    uv[n+2] = 1;
     if (calledfrom == "initialmalgrange")
     {
+      uv[n+2] = 1;
       noofvars = 2*n+3;
       intvec u0 = #[4];
@@ -438,6 +439,6 @@
 proc InForm (list #)
 "USAGE:  InForm(f,w) or InForm(I,w);  f a poly, I an ideal, w an intvec
-RETURN:  the initial of f or I w.r.t. to the weight w
-PURPOSE: compute the initial form of a poly or ideal w.r.t a given weight
+RETURN:  the initial form of f or I w.r.t. the weight vector w
+PURPOSE: compute the initial form of a poly or an  ideal w.r.t a given weight
 NOTE:    the size of the weight vector must be equal to the number of variables of the basering
 EXAMPLE: example InForm; shows examples
@@ -628,5 +629,5 @@
 
 
-proc AppelF1()
+proc AppelF1() //todo: create help string
 //(number a,b,c,d)
 {
@@ -654,5 +655,5 @@
 }
 
-proc AppelF2()
+proc AppelF2() //todo: create help string
 //(number a,b,c)
 {
@@ -679,5 +680,5 @@
 }
 
-proc AppelF4()
+proc AppelF4() //todo: create help string
 //number a,b,c,d - ?
 {
@@ -742,5 +743,5 @@
 PURPOSE: check whether the ideal I is F-saturated
 NOTE:    1 is returned if I is F-saturated, otherwise 0 is returned
-*   we check indeed that  Ker(D --F--> D/I) is (0)
+*   we check indeed that  Ker(D --F--> D/I) is (0) //todo: * or @* ??
 EXAMPLE: example isFsat; shows examples
 "
@@ -1358,5 +1359,5 @@
   RLD;
   // Now, compare with the output of Macaulay2:
- ideal tst = 3*x*Dx + 2*y*Dy + 1, y^3*Dy^2 - x^2*Dy^2 + 6*y^2*Dy + 6*y, 9*y^2*Dx^2*Dy - 4*y*Dy^3 + 27*y*Dx^2 + 2*Dy^2, 9*y^3*Dx^2 - 4*y^2*Dy^2 + 10*y*Dy -10;
+  ideal tst = 3*x*Dx + 2*y*Dy + 1, y^3*Dy^2 - x^2*Dy^2 + 6*y^2*Dy + 6*y, 9*y^2*Dx^2*Dy - 4*y*Dy^3 + 27*y*Dx^2 + 2*Dy^2, 9*y^3*Dx^2 - 4*y^2*Dy^2 + 10*y*Dy -10; //todo: maybe a bit too long
  option(redSB);
  option(redTail);
@@ -1523,5 +1524,5 @@
 }
 
-proc engine(ideal I, int i)
+proc engine(ideal I, int i) //todo: create help string
 {
   /* std - slimgb mix */
@@ -1540,5 +1541,5 @@
   return(J);
 }
-example
+example //todo: strange: example not showing on web page
 {
   "EXAMPLE:"; echo = 2;
