Changeset d033934 in git


Ignore:
Timestamp:
Oct 8, 2010, 5:51:28 PM (14 years ago)
Author:
Viktor Levandovskyy <levandov@…>
Branches:
(u'fieker-DuVal', '117eb8c30fc9e991c4decca4832b1d19036c4c65')(u'spielwiese', '38077648e7239f98078663eb941c3c979511150a')
Children:
16f3ec8acc0e5cac82cb4932f043eb71a823aeb4
Parents:
06b868f104bd8bb9bbaee58e1dc3d68022ae66a3
Message:
*levandov: doc changes and minor fixes

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

Legend:

Unmodified
Added
Removed
  • Singular/LIB/dmod.lib

    r06b868 rd033934  
    55LIBRARY: dmod.lib     Algorithms for algebraic D-modules
    66AUTHORS: Viktor Levandovskyy,     levandov@math.rwth-aachen.de
    7          Jorge Martin Morales,    jorge@unizar.es
     7@*             Jorge Martin Morales,    jorge@unizar.es
    88
    99OVERVIEW:
    1010Theory: Let K be a field of characteristic 0. Given a polynomial ring
    11       R = K[x_1,...,x_n] and a polynomial F in R,
    12       one is interested in the R[1/F]-module of rank one, generated by
    13       the symbol F^s for a symbolic discrete variable s.
    14 In fact, the module R[1/F]*F^s has a structure of a D(R)[s]-module, where D(R)
    15 is an n-th Weyl algebra K<x_1,...,x_n,d_1,...,d_n | d_j x_j = x_j d_j +1> and
    16 D(R)[s] = D(R) tensored with K[s] over K.
    17 Constructively, one needs to find a left ideal I = I(F^s) in D(R), such
    18 that K[x_1,...,x_n,1/F]*F^s is isomorphic to D(R)/I as a D(R)-module.
    19 We often write just D for D(R) and D[s] for D(R)[s].
    20 One is interested in the following data:
    21 - Ann F^s = I = I(F^s) in D(R)[s], denoted by LD in the output
    22 - global Bernstein polynomial in K[s], denoted by bs,
    23 - its minimal integer root s0, the list of all roots of bs, which are known
    24    to be rational, with their multiplicities, which is denoted by BS
    25 - Ann F^s0 = I(F^s0) in D(R), denoted by LD0 in the output
    26    (LD0 is a holonomic ideal in D(R))
    27 - Ann^(1) F^s in D(R)[s], denoted by LD1 (logarithmic derivations)
    28 - an operator in D(R)[s], denoted by PS, such that the functional equality
    29      PS*F^(s+1) = bs*F^s holds in K[x_1,...,x_n,1/F]*F^s.
     11@*      R = K[x_1,...,x_n] and a polynomial F in R,
     12@*      one is interested in the R[1/F]-module of rank one, generated by
     13@*      the symbol F^s for a symbolic discrete variable s.
     14@* In fact, the module R[1/F]*F^s has a structure of a D(R)[s]-module, where D(R)
     15@* is an n-th Weyl algebra K<x_1,...,x_n,d_1,...,d_n | d_j x_j = x_j d_j +1> and
     16@* D(R)[s] = D(R) tensored with K[s] over K.
     17@* Constructively, one needs to find a left ideal I = I(F^s) in D(R), such
     18@* that K[x_1,...,x_n,1/F]*F^s is isomorphic to D(R)/I as a D(R)-module.
     19@* We often write just D for D(R) and D[s] for D(R)[s].
     20@* One is interested in the following data:
     21@* - Ann F^s = I = I(F^s) in D(R)[s], denoted by LD in the output
     22@* - global Bernstein polynomial in K[s], denoted by bs,
     23@* - its minimal integer root s0, the list of all roots of bs, which are known
     24@*   to be rational, with their multiplicities, which is denoted by BS
     25@* - Ann F^s0 = I(F^s0) in D(R), denoted by LD0 in the output
     26@*   (LD0 is a holonomic ideal in D(R))
     27@* - Ann^(1) F^s in D(R)[s], denoted by LD1 (logarithmic derivations)
     28@* - an operator in D(R)[s], denoted by PS, such that the functional equality
     29@*     PS*F^(s+1) = bs*F^s holds in K[x_1,...,x_n,1/F]*F^s.
    3030
    3131References:
    32 We provide the following implementations of algorithms:
    33 @*(OT) the classical Ann F^s algorithm from Oaku and Takayama (Journal of
    34 Pure and Applied Math., 1999),
    35 @*(LOT) Levandovskyy's modification of the Oaku-Takayama algorithm (ISSAC 2007)
    36 @*(BM) the Ann F^s algorithm by Briancon and Maisonobe (Remarques sur
    37 l'ideal de Bernstein associe a des polynomes, preprint, 2002)
    38 @*(LM08) V. Levandovskyy and J. Martin-Morales, ISSAC 2008
    39 @*(C) Countinho, A Primer of Algebraic D-Modules,
    40 @*(SST) Saito, Sturmfels, Takayama 'Groebner Deformations of Hypergeometric
    41 Differential Equations', Springer, 2000
     32@* We provide the following implementations of algorithms:
     33@* (OT) the classical Ann F^s algorithm from Oaku and Takayama (Journal of
     34@* Pure and Applied Math., 1999),
     35@* (LOT) Levandovskyy's modification of the Oaku-Takayama algorithm (ISSAC 2007)
     36@* (BM) the Ann F^s algorithm by Briancon and Maisonobe (Remarques sur
     37@*        l'ideal de Bernstein associe a des polynomes, preprint, 2002)
     38@* (LM08) V. Levandovskyy and J. Martin-Morales, ISSAC 2008
     39@* (C) Countinho, A Primer of Algebraic D-Modules,
     40@* (SST) Saito, Sturmfels, Takayama 'Groebner Deformations of Hypergeometric
     41@*         Differential Equations', Springer, 2000
    4242
    4343
    4444Guide:
    45 @*- Ann F^s = I(F^s) = LD in D(R)[s] can be computed by Sannfs [BM, OT, LOT]
    46 @*- Ann^(1) F^s in D(R)[s] can be computed by Sannfslog
    47 @*- global Bernstein polynomial bs in K[s] can be computed by bernsteinBM
    48 @*- Ann F^s0 = I(F^s0) = LD0 in D(R) can be computed by annfs0, annfs, annfsBM,
    49     annfsOT, annfsLOT, annfs2, annfsRB etc.
    50 @*- all the relevant data to F^s (LD, LD0, bs, PS) are computed by operatorBM
    51 @*- operator PS can be computed via operatorModulo or operatorBM
    52 
    53 @*- annihilator of F^{s1} for a number s1 is computed with annfspecial
    54 @*- annihilator of F_1^s_1 * ... * F_p^s_p is computed with annfsBMI
    55 @*- computing the multiplicity of a rational number r in the Bernstein poly
    56    of a given ideal goes with checkRoot
    57 @*- check, whether a given univariate polynomial divides the Bernstein poly
    58    goes with checkFactor
     45@* - Ann F^s = I(F^s) = LD in D(R)[s] can be computed by Sannfs [BM, OT, LOT]
     46@* - Ann^(1) F^s in D(R)[s] can be computed by Sannfslog
     47@* - global Bernstein polynomial bs in K[s] can be computed by bernsteinBM
     48@* - Ann F^s0 = I(F^s0) = LD0 in D(R) can be computed by annfs0, annfs, annfsBM,
     49@*    annfsOT, annfsLOT, annfs2, annfsRB etc.
     50@* - all the relevant data to F^s (LD, LD0, bs, PS) are computed by operatorBM
     51@* - operator PS can be computed via operatorModulo or operatorBM
     52@*
     53@* - annihilator of F^{s1} for a number s1 is computed with annfspecial
     54@* - annihilator of F_1^s_1 * ... * F_p^s_p is computed with annfsBMI
     55@* - computing the multiplicity of a rational number r in the Bernstein poly
     56@*   of a given ideal goes with checkRoot
     57@* - check, whether a given univariate polynomial divides the Bernstein poly
     58@*   goes with checkFactor
     59
    5960
    6061PROCEDURES:
     62
    6163annfs(F[,S,eng]);       compute Ann F^s0 in D and Bernstein polynomial for a poly F
    6264annfspecial(I, F, m, n);  compute Ann F^n from Ann F^s for a polynomial F and a number n
    6365Sannfs(F[,S,eng]);      compute Ann F^s in D[s] for a polynomial F
    6466Sannfslog(F[,eng]);     compute Ann^(1) F^s in D[s] for a polynomial F
    65 bernsteinBM(F[,eng]);   compute global Bernstein-Sato polynomial of a poly F (alg of Briancon-Maisonobe)
    66 bernsteinLift(I,F [,eng]);  compute a multiple of Bernstein-Sato polynomial via lift-like procedure
    67 operatorBM(F[,eng]);    compute Ann F^s, Ann F^s0, BS and PS for a poly F (algorithm of Briancon-Maisonobe)
     67bernsteinBM(F[,eng]);   compute global Bernstein polynomial for a polynomial F (algorithm of Briancon-Maisonobe)
     68bernsteinLift(I,F [,eng]);  compute a possible multiple of Bernstein polynomial via lift-like procedure
     69operatorBM(F[,eng]);    compute Ann F^s, Ann F^s0, BS and PS for a polynomial F (algorithm of Briancon-Maisonobe)
    6870operatorModulo(F, I, b); compute PS via the modulo approach
    6971annfsParamBM(F[,eng]);  compute the generic Ann F^s (algorithm by Briancon and Maisonobe) and exceptional parametric constellations for a polynomial F with parametric coefficients
     
    8890
    8991KEYWORDS: D-module; D-module structure; left annihilator ideal; Bernstein-Sato polynomial; global Bernstein-Sato polynomial;
    90 Weyl algebra; Bernstein operator; logarithmic annihilator ideal; parametric annihilator; root of Bernstein-Sato polynomial;
     92Weyl algebra; Bernstein operator; logarithmic annihilator ideal; parametric annihilator; root of Bernstein-Sato polynomial; 
    9193hyperplane arrangement; Oaku-Takayama algorithm; Briancon-Maisonobe algorithm; LOT algorithm
    9294";
     
    53525354"
    53535355{
    5354   if (dmodappassumeViolation())
     5356  // char>0 or qring
     5357  if (  (size(ideal(basering)) >0) || (char(basering) >0) )
    53555358  {
    53565359    ERROR("Basering is inappropriate: characteristic>0 or qring present");
     
    53685371  if (attrib(M,"isSB")!=1)
    53695372  {
    5370     M = std(M);
     5373    M = engine(M,0);
    53715374  }
    53725375  int dimR = gkdim(std(0));
     
    62216224  V[1]=0;
    62226225  number ct = content(V); // content of the cofactors
    6223   // addition by VL: indeed just gcd of denominators is needed!!!
    6224   // hence TODO
    62256226  poly CF = ct*V[ncols(J)]; // polynomial in K[s]<x,dx>, cofactor to F
    62266227  dbprint(ppl,"// -3-4- the cofactor candidate found");
  • Singular/LIB/dmodapp.lib

    r06b868 rd033934  
    1313@* In this library there are the following procedures for algebraic D-modules:
    1414@*
    15 @* - localization of a holonomic module D/I with respect to a mult. closed set
    16 @* of all powers of a given polynomial F from R. Our aim is to compute an
    17 @* ideal L in D, such that D/L is a presentation of a localized module. Such L
    18 @* always exists, since such localizations are known to be holonomic and thus
    19 @* cyclic modules. The procedures for the localization are DLoc,SDLoc and DLoc0.
     15@* - given a cyclic representation D/I of a holonomic module and a polynomial
     16@* F in R, it is proved that the localization of D/I with respect to the mult.
     17@* closed set of all powers of F is a holonomic D-module. Thus we aim to compute
     18@* its cyclic representaion D/L for an ideal L in D. The procedures for the
     19@* localization are DLoc, SDLoc and DLoc0.
    2020@*
    2121@* - annihilator in D of a given polynomial F from R as well as
     
    2323@* procedures annPoly resp. annRat.
    2424@*
    25 @* - Groebner bases with respect to weights, initial forms and initial ideals
    26 @* in Weyl algebras with respect to a given weight vector can be computed with
    27 @* GBWeight, inForm, initialMalgrange and initialIdealW.
     25@* - Groebner bases with respect to weights (according to (SST), given an
     26@* arbitrary integer vector containing weights for variables, one computes the
     27@* homogenization of a given ideal relative to this vector, then one computes a
     28@* Groebner basis and returns the dehomogenization of the result), initial
     29@* forms and initial ideals in Weyl algebras with respect to a given weight
     30@* vector can be computed with GBWeight, inForm, initialMalgrange and
     31@* initialIdealW.
    2832@*
    2933@* - restriction and integration of a holonomic module D/I. Suppose I
     
    4549@* (SST) Saito, Sturmfels, Takayama 'Groebner Deformations of Hypergeometric
    4650@*         Differential Equations', Springer, 2000
    47 @* (OTW) Oaku, Takayama, Walther 'A Localization Algorithm for D-modules', 2000
    48 @* (OT)  Oaku, Takayama 'Algorithms for D-modules', 1998
     51@* (OTW) Oaku, Takayama, Walther 'A Localization Algorithm for D-modules',
     52@*         Journal of Symbolic Computation, 2000
     53@* (OT)  Oaku, Takayama 'Algorithms for D-modules',
     54@*         Journal of Pure and Applied Algebra, 1998
    4955
    5056
    5157PROCEDURES:
    5258
    53 annPoly(f);  annihilator of a polynomial f in the corr. Weyl algebra
    54 annRat(f,g);  annihilator of a rational function f/g in the corr. Weyl algebra
    55 DLoc(I,F);    presentation of the localization of D/I w.r.t. f^s
    56 SDLoc(I,F);   a generic presentation of the localization of D/I w.r.t. f^s
    57 DLoc0(I,F);   presentation of the localization of D/I w.r.t. f^s, based on SDLoc
    58 
    59 GBWeight(I,u,v[,a,b]);       Groebner basis of I w.r.t. the weight vector (u,v)
    60 initialMalgrange(f[,s,t,v]); Groebner basis of the initial Malgrange ideal for f
    61 initialIdealW(I,u,v[,s,t]);  initial ideal of a given ideal w.r.t. given weights
    62 inForm(f,w);                 initial form of a poly/ideal w.r.t. a given weight
    63 
    64 restrictionIdeal(I,w,[,eng,m,G]); restriction ideal of I w.r.t. w
    65 restrictionModule(I,w[,eng,m,G]); restriction module of I w.r.t. w
    66 integralIdeal(I,w,[,eng,m,G]);    integral ideal of I w.r.t. w
    67 integralModule(I,w[,eng,m,G]);    integral module of I w.r.t. w
    68 deRhamCohom(f[,eng,m]);       basis of n-th de Rham cohomology group
    69 deRhamCohomIdeal(I[,w,eng,m,G]);  basis of n-th de Rham cohomology group
    70 
    71 charVariety(I); characteristic variety of the ideal I
    72 charInfo(I);    char. variety of ideal I, its singular locus and primary decomp.
    73 isFsat(I,F);    check whether the ideal I is F-saturated
    74 
    75 
    76 
    77 appelF1();     create an ideal annihilating Appel F1 function
    78 appelF2();     create an ideal annihilating Appel F2 function
    79 appelF4();     create an ideal annihilating Appel F4 function
    80 
    81 fourier(I[,v]);        Fourier automorphism
    82 inverseFourier(I[,v]); inverse Fourier automorphism
     59annPoly(f);  computes annihilator of a polynomial f in the corr. Weyl algebra
     60annRat(f,g); computes annihilator of rational function f/g in corr. Weyl algebra
     61DLoc(I,f);   computes presentation of localization of D/I wrt symbolic power f^s
     62SDLoc(I,f);  computes generic presentation of the localization of D/I wrt f^s
     63DLoc0(I,f);  computes presentation of localization of D/I wrt f^s based on SDLoc
     64
     65GBWeight(I,u,v[,a,b]);       computes Groebner basis of I wrt a weight vector
     66initialMalgrange(f[,s,t,v]); computes Groebner basis of initial Malgrange ideal
     67initialIdealW(I,u,v[,s,t]);  computes initial ideal of  wrt a given weight
     68inForm(f,w);                 computes initial form of poly/ideal wrt a weight
     69
     70restrictionIdeal(I,w[,eng,m,G]);  computes restriction ideal of I wrt w
     71restrictionModule(I,w[,eng,m,G]); computes restriction module of I wrt w
     72integralIdeal(I,w[,eng,m,G]);     computes integral ideal of I wrt w
     73integralModule(I,w[,eng,m,G]);    computes integral module of I wrt w
     74deRhamCohom(f[,eng,m]);           computes basis of n-th de Rham cohom. group
     75deRhamCohomIdeal(I[,w,eng,m,G]);  computes basis of n-th de Rham cohom. group
     76
     77charVariety(I); computes characteristic variety of the ideal I
     78charInfo(I);    computes char. variety, singular locus and primary decomp.
     79isFsat(I,F);    checks whether the ideal I is F-saturated
     80
     81
     82
     83appelF1();     creates an ideal annihilating Appel F1 function
     84appelF2();     creates an ideal annihilating Appel F2 function
     85appelF4();     creates an ideal annihilating Appel F4 function
     86
     87fourier(I[,v]);        applies Fourier automorphism to ideal
     88inverseFourier(I[,v]); applies inverse Fourier automorphism to ideal
    8389
    8490bFactor(F);    computes the roots of irreducible factors of an univariate poly
    85 intRoots(L);   dismiss non-integer roots from list in bFactor format
    86 poly2list(f);  decompose a polynomial into a list of terms and exponents
    87 fl2poly(L,s);  reconstruct a monic univariate polynomial from its factorization
    88 
    89 insertGenerator(id,p[,k]); insert an element into an ideal/module
    90 deleteGenerator(id,k);     delete the k-th element from an ideal/module
    91 
    92 engine(I,i);   computes a Groebner basis with the algorithm given by i
    93 isInt(n);      check whether object of type number is actually int
    94 sortIntvec(v); sort intvec
     91intRoots(L);   dismisses non-integer roots from list in bFactor format
     92poly2list(f);  decomposes the polynomial f into a list of terms and exponents
     93fl2poly(L,s);  reconstructs a monic univariate polynomial from its factorization
     94
     95insertGenerator(id,p[,k]); inserts an element into an ideal/module
     96deleteGenerator(id,k);     deletes the k-th element from an ideal/module
     97
     98engine(I,i);   computes a Groebner basis with the algorithm specified by i
     99isInt(n);      checks whether number n is actually an int
     100sortIntvec(v); sorts intvec
    95101
    96102
     
    99105
    100106KEYWORDS: D-module; annihilator of polynomial; annihilator of rational function;
    101 D-localization; localization of D-module; D-restriction; restriction of
     107D-localization; localization of D-module; D-restriction; restriction of 
    102108D-module; D-integration; integration of D-module; characteristic variety;
    103109Appel function; Appel hypergeometric function
     
    10911521.09.10 by DA:
    110116- restructured library for better readability
    111 - new / improved procs:
     117- new / improved procs: 
    112118  - toolbox: isInt, intRoots, sortIntvec
    113119  - GB wrt weights: GBWeight, initialIdealW rewritten using GBWeight
     
    119125- added SUPPORT in header
    120126- added reference (OT)
     127
     12804.10.10 by DA:
     129- incorporated suggestions by Oleksandr Motsak, among other:
     130  - bugfixes for fl2poly, sortIntvec, annPoly, GBWeight
     131  - enhanced functionality for deleteGenerator, inForm
    121132*/
    122133
     
    174185// general assumptions ////////////////////////////////////////////////////////
    175186
    176 proc dmodappassumeViolation()
    177 {
    178   // returns Boolean : yes/no [for assume violation]
    179   // char K = 0
    180   // no qring
     187static proc dmodappAssumeViolation()
     188
     189  // char K <> 0 or qring
    181190  if (  (size(ideal(basering)) >0) || (char(basering) >0) )
    182191  {
    183     //    "ERROR: no qring is allowed";
    184     return(1);
    185   }
    186   return(0);
     192    ERROR("Basering is inappropriate: characteristic>0 or qring present");
     193  }
     194  return();
    187195}
    188196
    189197static proc dmodappMoreAssumeViolation()
    190198{
    191   // char K = 0, no qring
    192   if ((size(ideal(basering))>0) || (char(basering)>0))
    193   {
    194     ERROR("Basering is inappropriate: characteristic>0 or qring present");
    195   }
     199  // char K <> 0, qring
     200  dmodappAssumeViolation();
    196201  // no Weyl algebra
    197202  if (isWeyl() == 0)
    198203  {
    199     ERROR("Basering is not a Weyl algebra");
     204    ERROR("Basering is not a Weyl algebra"); 
    200205  }
    201206  // wrong sequence of vars
     
    213218
    214219static proc safeVarName (string s, string cv)
     220// assumes 's' to be a valid variable name
     221// returns valid var name string @@..@s
    215222{
    216223  string S;
     
    226233  s = s[2..size(s)-1];
    227234  return(s)
     235}
     236
     237static proc intLike (def i)
     238{
     239  string str = typeof(i);
     240  if (str == "int" || str == "number" || str == "bigint")
     241  {
     242    return(1);
     243  }
     244  else
     245  {
     246    return(0);
     247  }
    228248}
    229249
     
    269289"USAGE:  poly2list(f); f a poly
    270290RETURN:  list of exponents and corresponding terms of f
    271 PURPOSE: convert a polynomial to a list of exponents and corresponding terms
     291PURPOSE: converts a poly to a list of pairs consisting of intvecs (1st entry)
     292@*       and polys (2nd entry), where the i-th pair contains the exponent of the
     293@*       i-th term of f and the i-th term (with coefficient) itself.
    272294EXAMPLE: example poly2list; shows examples
    273295"
     
    279301    l[1] = list(leadexp(f), lead(f));
    280302  }
    281   else { l[size(f)] = list(); } // memory pre-allocation
    282   while (f != 0)
    283   {
    284     l[i] = list(leadexp(f), lead(f));
    285     f = f - lead(f);
    286     i++;
     303  else
     304  {
     305    l[size(f)] = list(); // memory pre-allocation
     306    while (f != 0)
     307    {
     308      l[i] = list(leadexp(f), lead(f));
     309      f = f - lead(f);
     310      i++;
     311    }
    287312  }
    288313  return(l);
     
    295320  poly2list(F);
    296321  ring r2 = 0,(x,y),dp;
    297   poly F = x2y+x*y2;
     322  poly F = x2y+5xy2;
    298323  poly2list(F);
     324  poly2list(0);
    299325}
    300326
     
    312338  if (varNum(s)==0)
    313339  {
    314     ERROR("no such variable found in the basering"); return(0);
     340    ERROR(s+ " is no variable in the basering");
    315341  }
    316342  poly x = var(varNum(s));
    317343  poly P = 1;
    318   int sl = size(L[1]);
    319344  ideal RR = L[1];
     345  int sl = ncols(RR);
    320346  intvec IV = L[2];
    321   for(int i=1; i<= sl; i++)
     347  if (sl <> nrows(IV))
     348  {
     349    ERROR("number of roots doesn't match number of multiplicites");
     350  }
     351  for(int i=1; i<=sl; i++)
    322352  {
    323353    if (IV[i] > 0)
     
    336366  "EXAMPLE:"; echo = 2;
    337367  ring r = 0,(x,y,z,s),Dp;
    338   ideal I = -1,-4/3,-5/3,-2;
    339   intvec mI = 2,1,1,1;
     368  ideal I = -1,-4/3,0,-5/3,-2;
     369  intvec mI = 2,1,2,1,1;
    340370  list BS = I,mI;
    341371  poly p = fl2poly(BS,"s");
     
    347377"USAGE:  insertGenerator(id,p[,k]);
    348378@*       id an ideal/module, p a poly/vector, k an optional int
    349 RETURN:  same as id
    350 PURPOSE: inserts p into the first argument at k-th index position and returns
    351 @*       the enlarged object
     379RETURN:  of the same type as id
     380PURPOSE: inserts p into id at k-th position and returns the enlarged object
    352381NOTE:    If k is given, p is inserted at position k, otherwise (and by default),
    353 @*       p is inserted at the beginning.
     382@*       p is inserted at the beginning (k=1).
    354383SEE ALSO: deleteGenerator
    355384EXAMPLE: example insertGenerator; shows examples
     
    363392  if (inp1 == "ideal" || inp1 == "module")
    364393  {
    365     if (inp1 == "ideal") { ideal id = #[1]; }
    366     else { module id = #[1]; }
     394    def id = #[1];
    367395  }
    368396  else { ERROR("first argument has to be of type ideal or module"); }
     
    370398  if (inp2 == "poly" || inp2 == "vector")
    371399  {
    372     if (inp2 =="poly") { poly f = #[2]; }
    373     else
    374     {
    375       if (inp1 == "ideal")
    376       {
    377         ERROR("second argument has to be a polynomial if first argument is an ideal");
    378       }
    379       else { vector f = #[2]; }
    380     }
     400    def f = #[2];
    381401  }
    382402  else { ERROR("second argument has to be of type poly/vector"); }
     403  if (inp1 == "ideal" && inp2 == "vector")
     404  {
     405    ERROR("second argument has to be a polynomial if first argument is an ideal");
     406  }
     407  // don't check module/poly combination due to auto-conversion
     408  //   if (inp1 == "module" && inp2 == "poly")
     409  //   {
     410  //     ERROR("second argument has to be a vector if first argument is a module");
     411  //   }
    383412  int n = ncols(id);
    384413  int k = 1; // default
    385414  if (size(#)>=3)
    386415  {
    387     if (typeof(#[3]) == "int")
    388     {
    389       k = #[3];
     416    if (intLike(#[3]))
     417    {
     418      k = int(#[3]);
    390419      if (k<=0)
    391420      {
     
    406435    else // 1<k<=n
    407436    {
     437      J[n+1] = id[n]; // preinit
    408438      J[1..k-1] = id[1..k-1];
    409439      J[k] = f;
     
    420450  insertGenerator(I,y^3);
    421451  insertGenerator(I,y^3,2);
    422   module M = I;
     452  module M = I*gen(3);
    423453  insertGenerator(M,[x^3,y^2,z],2);
    424 }
    425 
    426 proc deleteGenerator (list #)
    427 "USAGE:  deleteGenerator(id,k);  id an ideal/module, k an int
    428 RETURN:  same as id
    429 PURPOSE: deletes the k-th generator from the first argument and returns
    430 @*       the altered object
     454  insertGenerator(M,x+y+z,4);
     455}
     456
     457proc deleteGenerator (def id, int k)
     458"USAGE:   deleteGenerator(id,k);  id an ideal/module, k an int
     459RETURN:   of the same type as id
     460PURPOSE:  deletes the k-th generator from the first argument and returns
     461@*        the altered object
    431462SEE ALSO: insertGenerator
    432 EXAMPLE: example insertGenerator; shows examples
     463EXAMPLE:  example deleteGenerator; shows examples
    433464"
    434465{
    435   if (size(#) < 2)
    436   {
    437     ERROR("deleteGenerator has to be called with 2 arguments (ideal/module,int)");
    438   }
    439   string inp1 = typeof(#[1]);
    440   if (inp1 == "ideal" || inp1 == "module")
    441   {
    442     if (inp1 == "ideal") { ideal id = #[1]; }
    443     else { module id = #[1]; }
    444   }
    445   else { ERROR("first argument has to be of type ideal or module"); }
    446   string inp2 = typeof(#[2]);
    447   if (inp2 == "int" || inp2 == "number") { int k = int(#[2]); }
    448   else { ERROR("second argument has to be of type int"); }
     466  string inp1 = typeof(id);
     467  if (inp1 <> "ideal" && inp1 <> "module")
     468  {
     469    ERROR("first argument has to be of type ideal or module");
     470  }
     471  execute(inp1 +" J;");
    449472  int n = ncols(id);
    450   if (n == 1) { ERROR(inp1+" must have more than one generator"); }
    451   if (k<=0 || k>n) { ERROR("second argument has to be in the range 1,...,"+string(n)); }
    452   execute(inp1 +" J;");
     473  if (n == 1 && k == 1) { return(J); }
     474  if (k<=0 || k>n)
     475  {
     476    ERROR("second argument has to be in the range 1,...,"+string(n));
     477  }
     478  J[n-1] = 0; // preinit
    453479  if (k == 1) { J = id[2..n]; }
    454480  else
     
    469495  ideal I = x^2,y^3,z^4;
    470496  deleteGenerator(I,2);
    471   module M = [x,y,z],[x2,y2,z2],[x3,y3,z3];;
    472   deleteGenerator(M,2);
     497  module M = [x,y,z],[x2,y2,z2],[x3,y3,z3];
     498  print(deleteGenerator(M,2));
     499  M = M[1];
     500  deleteGenerator(M,1);
    473501}
    474502
    475503proc bFactor (poly F)
    476504"USAGE:  bFactor(f);  f poly
    477 RETURN:  list
     505RETURN:  list of ideal and intvec and possibly a string
    478506PURPOSE: tries to compute the roots of a univariate poly f
    479507NOTE:    The output list consists of two or three entries:
     
    481509@*       if present, a third one being the product of all irreducible factors
    482510@*       of degree greater than one, given as string.
     511@*       If f is the zero polynomial or if f has no roots in the ground field,
     512@*       this is encoded as root 0 with multiplicity 0.
    483513DISPLAY: If printlevel=1, progress debug messages will be printed,
    484514@*       if printlevel>=2, all the debug messages will be printed.
     
    556586  bFactor((x^2+1)^2);
    557587  bFactor((y^2+1/2)*(y+9)*(y-7));
     588  bFactor(1);
     589  bFactor(0);
    558590}
    559591
     
    606638      if (sl>2)
    607639      {
    608         if (typeof(l[3])<>"string"){wronginput = 1;}
    609         if (sl>3){wronginput = 1;}
     640        if (typeof(l[3])<>"string"){wronginput = 1;}
     641        if (sl>3){wronginput = 1;}
    610642      }
    611643    }
     
    617649  }
    618650  int i,j;
    619   int n = ncols(l[1]);
     651  ideal l1 = l[1];
     652  int n = ncols(l1);
    620653  j = 1;
    621654  ideal I;
     
    623656  for (i=1; i<=n; i++)
    624657  {
    625     if (size(l[1][j])>1) // poly not number
     658    if (size(l1[j])>1) // poly not number
    626659    {
    627660      ERROR("Ideal in list has wrong format.");
    628661    }
    629     if (isInt(leadcoef(l[1][i])))
    630     {
    631       I[j] = l[1][i];
     662    if (isInt(leadcoef(l1[i])))
     663    {
     664      I[j] = l1[i];
    632665      v[j] = l[2][i];
    633666      j++;
     
    653686@*       Unlike in the procedure @code{sort}, zeros are not dismissed.
    654687SEE ALSO: sort
    655 EXAMPLE: example sortintvec; shows examples
     688EXAMPLE: example sortIntvec; shows examples
    656689"
    657690{
    658691  int i;
    659692  intvec vpos,vzero,vneg,vv,sortv,permv;
     693  list l;
    660694  for (i=1; i<=nrows(v); i++)
    661695  {
     
    680714    vpos = vpos[2..size(vpos)];
    681715    vv = v[vpos];
    682     list l = sort(vv);
     716    l = sort(vv);
    683717    vv = l[1];
    684718    vpos = vpos[l[2]];
     
    716750  list L = sortIntvec(v); L;
    717751  v[L[2]];
     752  v = -3,0;
     753  sortIntvec(v);
     754  v = 0,-3;
     755  sortIntvec(v);
    718756}
    719757
     
    723761proc isFsat(ideal I, poly F)
    724762"USAGE:  isFsat(I, F);  I an ideal, F a poly
    725 RETURN:  int
    726 PURPOSE: check whether the ideal I is F-saturated
    727 NOTE:    1 is returned if I is F-saturated, otherwise 0 is returned.
    728 @*       we check indeed that Ker(D --F--> D/I) is (0)
     763RETURN:  int, 1  if I is F-saturated and 0 otherwise
     764PURPOSE: checks whether the ideal I is F-saturated
     765NOTE:    We check indeed that Ker(D--> F--> D/I) is 0, where D is the basering.
    729766EXAMPLE: example isFsat; shows examples
    730767"
     
    733770  /* works in any algebra */
    734771  /*  for simplicity : later check attrib */
    735   /* returns -1 if true */
     772  /* returns 1 if I is F-sat */
    736773  if (attrib(I,"isSB")!=1)
    737774  {
     
    740777  matrix @M = matrix(I);
    741778  matrix @F[1][1] = F;
    742   module S = modulo(@F,@M);
     779  def S = modulo(module(@F),module(@M));
    743780  S = NF(S,I);
    744781  S = groebner(S);
     
    763800proc annRat(poly g, poly f)
    764801"USAGE:   annRat(g,f);  f, g polynomials
    765 RETURN:   ring
    766 PURPOSE:  compute the annihilator of a rational function g/f in the Weyl algebra
     802RETURN:   ring (a Weyl algebra) containing an ideal 'LD'
     803PURPOSE:  compute the annihilator of the rational function g/f in the
     804@*        corresponding Weyl algebra
     805ASSUME:   basering is commutative and over a field of characteristic 0
    767806NOTE:     Activate the output ring with the @code{setring} command.
    768 @*        In the output ring, the ideal LD (in Groebner basis) is the
    769 @*        annihilator.
    770 @*        The algorithm uses the computation of ann f^{-1} via D-modules.
     807@*        In the output ring, the ideal 'LD' (in Groebner basis) is the
     808@*        annihilator of g/f.
     809@*        The algorithm uses the computation of Ann(f^{-1}) via D-modules,
     810@*        see (SST).
    771811DISPLAY:  If printlevel =1, progress debug messages will be printed,
    772812@*        if printlevel>=2, all the debug messages will be printed.
     
    775815"
    776816{
    777 
    778   if (dmodappassumeViolation())
    779   {
    780     ERROR("Basering is inappropriate: characteristic>0 or qring present");
    781   }
    782 
     817  // assumption check
     818  dmodappAssumeViolation();
     819  if (!isCommutative())
     820  {
     821    ERROR("Basering must be commutative.");
     822  }
    783823  // assumptions: f is not a constant
    784   if (f==0) { ERROR("Denominator cannot be zero"); }
    785   if (leadexp(f) == 0)
     824  if (f==0) { ERROR("the denominator f cannot be zero"); }
     825  if ((leadexp(f) == 0) && (size(f) < 2))
    786826  {
    787827    // f = const, so use annPoly
     
    790830    return(@R);
    791831  }
    792     // computes the annihilator of g/f
     832  // computes the annihilator of g/f
    793833  def save = basering;
    794834  int ppl = printlevel-voice+2;
     
    811851    if (mir ==0)
    812852    {
    813       "No integer root found! Aborting computations, inform the authors!";
    814       return(0);
     853      ERROR("No integer root found! Aborting computations, inform the authors!");
    815854    }
    816855    // now mir == i is m.i.r.
     
    887926proc annPoly(poly f)
    888927"USAGE:   annPoly(f);  f a poly
    889 RETURN:   ring
    890 PURPOSE:  compute the complete annihilator ideal of f in the Weyl algebra D
    891 NOTE:     activate the output ring with the @code{setring} command.
    892 @*        In the output ring, the ideal LD (in Groebner basis) is the
     928RETURN:   ring (a Weyl algebra) containing an ideal 'LD'
     929PURPOSE:  compute the complete annihilator ideal of f in the corresponding
     930@*        Weyl algebra
     931ASSUME:   basering is commutative and over a field of characteristic 0
     932NOTE:     Activate the output ring with the @code{setring} command.
     933@*        In the output ring, the ideal 'LD' (in Groebner basis) is the
    893934@*        annihilator.
    894935DISPLAY:  If printlevel =1, progress debug messages will be printed,
     
    898939"
    899940{
     941  // assumption check
     942  dmodappAssumeViolation();
     943  if (!isCommutative())
     944  {
     945    ERROR("Basering must be commutative.");
     946  }
    900947  // computes a system of linear PDEs with polynomial coeffs for f
    901948  def save = basering;
     
    906953  for (i=1; i<=N; i++)
    907954  {
    908     Name[N+i] = "D"+Name[i]; // concat
     955    Name[N+i] = safeVarName("D"+Name[i],"cv"); // concat
    909956  }
    910957  L[2] = Name;
     
    920967  }
    921968  matrix F[1][1] = imap(save,f);
    922   ideal I = modulo(F,M);
    923   ideal LD = groebner(I);
     969  def I = modulo(module(F),module(M));
     970  ideal LD = I;
     971  LD = groebner(LD);
    924972  export LD;
    925973  return(@@R);
     
    935983  gkdim(LD);    // must be 3 = 6/2, since A/LD is holonomic module
    936984  NF(Dy^4, LD); // must be 0 since Dy^4 clearly annihilates f
     985  poly f = imap(r,f);
     986  NF(LD*f,std(ideal(Dx,Dy,Dz))); // must be zero if LD indeed annihilates f
    937987}
    938988
     
    942992
    943993proc DLoc(ideal I, poly F)
    944 "USAGE:  DLoc(I, F);  I an ideal, F a poly
    945 RETURN:  nothing (exports objects instead)
     994"USAGE:  DLoc(I, f);  I an ideal, f a poly
     995RETURN:  list of ideal and list
    946996ASSUME:  the basering is a Weyl algebra
    947997PURPOSE: compute the presentation of the localization of D/I w.r.t. f^s
    948 NOTE:    In the basering, the following objects are exported:
    949 @*       - the ideal LD0 (in Groebner basis) is the presentation of the
     998NOTE:    In the output list L,
     999@*       - L[1] is an ideal (given as Groebner basis), the presentation of the
    9501000@*       localization,
    951 @*       - the list BS contains roots with multiplicities of Bernstein
     1001@*       - L[2] is a list containing roots with multiplicities of Bernstein
    9521002@*       polynomial of (D/I)_f.
    9531003DISPLAY: If printlevel =1, progress debug messages will be printed,
     
    9581008  /* runs SDLoc and DLoc0 */
    9591009  /* assume: run from Weyl algebra */
    960   if (dmodappassumeViolation())
    961   {
    962     ERROR("Basering is inappropriate: characteristic>0 or qring present");
    963   }
     1010  dmodappAssumeViolation();
    9641011  if (!isWeyl())
    9651012  {
    9661013    ERROR("Basering is not a Weyl algebra");
    967   }
    968   if (defined(LD0) || defined(BS))
    969   {
    970     ERROR("Reserved names LD0 and/or BS are used. Please rename the objects.");
    9711014  }
    9721015  int old_printlevel = printlevel;
     
    9821025  setring @R;
    9831026  ideal LD0 = imap(@R3,LD0);
    984   export LD0;
    9851027  ideal bs = imap(@R3,bs);
    9861028  list BS; BS[1] = bs; BS[2] = m;
    987   export BS;
    9881029  kill @R3;
    9891030  printlevel = old_printlevel;
     1031  return(list(LD0,BS));
    9901032}
    9911033example;
     
    9981040  // I is not holonomic, since its dimension is not 4/2=2
    9991041  gkdim(I);
    1000   DLoc(I, x2-y3); // exports LD0 and BS
    1001   LD0; // localized module (R/I)_f is isomorphic to R/LD0
    1002   BS; // description of b-function for localization
     1042  list L = DLoc(I, x2-y3);
     1043  L[1]; // localized module (R/I)_f is isomorphic to R/LD0
     1044  L[2]; // description of b-function for localization
    10031045}
    10041046
    10051047proc DLoc0(ideal I, poly F)
    1006 "USAGE:  DLoc0(I, F);  I an ideal, F a poly
    1007 RETURN:  ring
     1048"USAGE:  DLoc0(I, f);  I an ideal, f a poly
     1049RETURN:  ring (a Weyl algebra) containing an ideal 'LD0' and a list 'BS'
    10081050PURPOSE: compute the presentation of the localization of D/I w.r.t. f^s,
    10091051@*       where D is a Weyl Algebra, based on the output of procedure SDLoc
    10101052ASSUME:  the basering is similar to the output ring of SDLoc procedure
    1011 NOTE:    activate this ring with the @code{setring} command. In this ring,
    1012 @*       - the ideal LD0 (in Groebner basis) is the presentation of the
    1013          localization,
    1014 @*       - the list BS contains roots and multiplicities of Bernstein
    1015          polynomial of (D/I)_f.
     1053NOTE:    activate the output ring with the @code{setring} command. In this ring,
     1054@*       - the ideal LD0 (given as Groebner basis) is the presentation of the
     1055@*       localization,
     1056@*       - the list BS contains roots and multiplicities of Bernstein 
     1057@*       polynomial of (D/I)_f.
    10161058DISPLAY: If printlevel =1, progress debug messages will be printed,
    10171059@*       if printlevel>=2, all the debug messages will be printed.
     
    10191061"
    10201062{
    1021   if (dmodappassumeViolation())
    1022   {
    1023     ERROR("Basering is inappropriate: characteristic>0 or qring present");
    1024   }
     1063  dmodappAssumeViolation();
    10251064  /* assume: to be run in the output ring of SDLoc */
    10261065  /* doing: add F, eliminate vars*Dvars, factorize BS */
     
    12481287
    12491288proc SDLoc(ideal I, poly F)
    1250 "USAGE:  SDLoc(I, F);  I an ideal, F a poly
    1251 RETURN:  ring
     1289"USAGE:  SDLoc(I, f);  I an ideal, f a poly
     1290RETURN:  ring (basering extended by a new variable) containing an ideal 'LD'
    12521291PURPOSE: compute a generic presentation of the localization of D/I w.r.t. f^s
    1253 ASSUME:  the basering D is a Weyl algebra
    1254 NOTE:    activate this ring with the @code{setring} command. In this ring,
    1255 @*       the ideal LD (in Groebner basis) is the presentation of the
    1256 @*       localization
     1292ASSUME:  the basering D is a Weyl algebra over a field of characteristic 0
     1293NOTE:    Activate this ring with the @code{setring} command. In this ring,
     1294@*       the ideal LD (given as Groebner basis) is the presentation of the
     1295@*       localization.
    12571296DISPLAY: If printlevel =1, progress debug messages will be printed,
    12581297@*       if printlevel>=2, all the debug messages will be printed.
     
    12641303  /* assume: we're in the Weyl algebra D  in x1,x2,...,d1,d2,... */
    12651304
    1266   if (dmodappassumeViolation())
    1267   {
    1268     ERROR("Basering is inappropriate: characteristic>0 or qring present");
    1269   }
     1305  dmodappAssumeViolation();
    12701306  if (!isWeyl())
    12711307  {
     
    14691505
    14701506proc GBWeight (ideal I, intvec u, intvec v, list #)
    1471 "USAGE:  GBWeight(I,u,v [,s,t,w]);
     1507"USAGE:  GBWeight(I,u,v [,s,t,w]); 
    14721508@*       I ideal, u,v intvecs, s,t optional ints, w an optional intvec
    14731509RETURN:  ideal, Groebner basis of I w.r.t. the weights u and v
    1474 ASSUME:  The basering is the n-th Weyl algebra in characteristic 0 and for all
    1475 @*       1<=i<=n the identity var(i+n)*var(i)=var(i)*var(i+1)+1 holds, i.e. the
    1476 @*       sequence of variables is given by x(1),...,x(n),D(1),...,D(n),
    1477 @*       where D(i) is the differential operator belonging to x(i).
     1510ASSUME:  The basering is the n-th Weyl algebra over a field of characteristic 0
     1511@*       and for all 1<=i<=n the identity var(i+n)*var(i)=var(i)*var(i+1)+1
     1512@*       holds, i.e. the sequence of variables is given by
     1513@*       x(1),...,x(n),D(1),...,D(n), where D(i) is the differential operator
     1514@*       belonging to x(i).
    14781515PURPOSE: computes a Groebner basis with respect to given weights
    1479 NOTE:    u and v are understood as weight vectors for x(i) and D(i),
    1480 @*       respectively.
     1516NOTE:    The weights u and v are understood as weight vectors for x(i) and D(i),
     1517@*       respectively. According to (SST), one computes the homogenization of a
     1518@*       given ideal relative to (u,v), then one computes a Groebner basis and
     1519@*       returns the dehomogenization of the result.
    14811520@*       If s<>0, @code{std} is used for Groebner basis computations,
    14821521@*       otherwise, and by default, @code{slimgb} is used.
     
    14841523@*       otherwise, and by default, a block ordering is used.
    14851524@*       If w is given and consists of exactly 2*n strictly positive entries,
    1486 @*       w is used as homogenization weight.
    1487 @*       Otherwise, and by default, the homogenization weight (1,...,1) is used.
     1525@*       w is used for constructing the weighted homogenized Weyl algebra,
     1526@*       see Noro (2002). Otherwise, and by default, the homogenization weight
     1527@*       (1,...,1) is used.
    14881528DISPLAY: If printlevel=1, progress debug messages will be printed,
    14891529@*       if printlevel>=2, all the debug messages will be printed.
     
    15001540  if (size(#)>0)
    15011541  {
    1502     if (typeof(#[1])=="int" || typeof(#[1])=="number")
     1542    if (intLike(#[1]))
    15031543    {
    15041544      whichengine = int(#[1]);
     
    15061546    if (size(#)>1)
    15071547    {
    1508       if (typeof(#[2])=="int" || typeof(#[2])=="number")
     1548      if (intLike(#[2]))
    15091549      {
    1510         methodord = int(#[2]);
     1550        methodord = int(#[2]);
    15111551      }
    15121552      if (size(#)>2)
    15131553      {
    1514         if (typeof(#[3])=="intvec")
    1515         {
    1516           if (size(#[3])==2*n && allPositive(#[3])==1)
    1517           {
    1518             homogweights = #[3];
    1519           }
    1520           else
    1521           {
    1522             print("// Homogenization weight vector must consist of positive entries and be");
    1523             print("// of size " + string(n) + ". Using weight (1,...,1).");
    1524           }
    1525         }
     1554        if (typeof(#[3])=="intvec")
     1555        {
     1556          if (size(#[3])==2*n && allPositive(#[3])==1)
     1557          {
     1558            homogweights = #[3];
     1559          }
     1560          else
     1561          {
     1562            print("// Homogenization weight vector must consist of positive entries and be");
     1563            print("// of size " + string(n) + ". Using weight (1,...,1).");
     1564          }
     1565        }
    15261566      }
    15271567    }
     
    15381578  if (methodord == 0) // default: blockordering
    15391579  {
     1580    Lord[5] = C0;
     1581    Lord[4] = list("lp",intvec(1));
     1582    Lord[3] = list("dp",intvec(1:(N-1)));
    15401583    Lord[2] = list("a",uv);
    1541     Lord[3] = list("dp",intvec(1:(N-1)));
    1542     Lord[4] = list("lp",intvec(1));
    1543     Lord[5] = C0;
    15441584  }
    15451585  else                // M() ordering
     
    15471587    intmat @Ord[N][N];
    15481588    @Ord[1,1..N] = uv; @Ord[2,1..N] = 1:(N-1);
    1549     for (i=1; i<=N-2; i++)
    1550     {
     1589    for (i=1; i<=N-2; i++) 
     1590    { 
    15511591      @Ord[2+i,N - i] = -1;
    15521592    }
     
    15641604  // 1.4 create non-commutative relations
    15651605  matrix @relD[N][N];
    1566   for (i=1; i<=n; i++)
    1567   {
    1568     @relD[i,n+i] = var(N)^(homogweights[i]+homogweights[n+i]);
     1606  for (i=1; i<=n; i++) 
     1607  {
     1608    @relD[i,n+i] = var(N)^(homogweights[i]+homogweights[n+i]); 
    15691609  }
    15701610  def Dh = nc_algebra(1,@relD);
    1571   setring Dh; kill @Dh;
     1611  setring Dh; kill @Dh; 
    15721612  dbprint(ppl-1,"// computing in ring",Dh);
    15731613  // 2. Compute the initial ideal
    15741614  ideal I = imap(save,I);
    1575   I = homog(I,h);
     1615  I = homog(I,var(N));
    15761616  // 2.1 the hard part: Groebner basis computation
    15771617  dbprint(ppl, "// starting Groebner basis computation with engine: "+string(whichengine));
     
    15901630  def D2 = Weyl();
    15911631  setring D2;
    1592   ideal I = 3*x^2*Dy+2*y*Dx,2*x*Dx+3*y*Dy+6; I = std(I);
     1632  ideal I = 3*x^2*Dy+2*y*Dx,2*x*Dx+3*y*Dy+6;
    15931633  intvec u = -2,-3;
    15941634  intvec v = -u;
    15951635  GBWeight(I,u,v);
     1636  ideal J = std(I);
     1637  GBWeight(J,u,v); // same as above
    15961638  u = 0,1;
    15971639  GBWeight(I,u,v);
    15981640}
    15991641
    1600 proc inForm (ideal I, intvec w)
    1601 "USAGE:  inForm(I,w);  I ideal, w intvec
    1602 RETURN:  ideal, the initial form of I w.r.t. the weight vector w
    1603 PURPOSE: computes the initial form of an ideal w.r.t. a given weight vector
    1604 NOTE:  the size of the weight vector must be equal to the number of variables
    1605 @*     of the basering.
     1642proc inForm (def I, intvec w)
     1643"USAGE:  inForm(I,w);  I ideal or poly, w intvec
     1644RETURN:  ideal, generated by initial forms of generators of I w.r.t. w, or
     1645@*       poly, initial form of input poly w.r.t. w
     1646PURPOSE: computes the initial form of an ideal or a poly w.r.t. the weight w
     1647NOTE:    The size of the weight vector must be equal to the number of variables
     1648@*       of the basering.
    16061649EXAMPLE: example inForm; shows examples
    16071650"
    16081651{
     1652  string inp1 = typeof(I);
     1653  if ((inp1 <> "ideal") && (inp1 <> "poly"))
     1654  {
     1655    ERROR("first argument has to be an ideal or a poly");
     1656  }
    16091657  if (size(w) != nvars(basering))
    16101658  {
     
    16151663    return(I);
    16161664  }
    1617   int j,i,s,m;
     1665  int j,i;
     1666  bigint s,m;
    16181667  list l;
    16191668  poly g;
     
    16291678      if (s == m)
    16301679      {
    1631         g = g + l[i][2];
     1680        g = g + l[i][2];
    16321681      }
    16331682      else
     
    16421691    J[j] = g;
    16431692  }
    1644   return(J);
     1693  if (inp1 == "ideal")
     1694  {
     1695    return(J);
     1696  }
     1697  else
     1698  {
     1699    return(J[1]);
     1700  }
    16451701}
    16461702example
    16471703{
    16481704  "EXAMPLE:"; echo = 2;
    1649   ring @D = 0,(x,y,Dx,Dy),dp;
    1650   def D = Weyl();
    1651   setring D;
     1705  ring r = 0,(x,y,Dx,Dy),dp;
     1706  def D = Weyl(); setring D;
    16521707  poly F = 3*x^2*Dy+2*y*Dx;
    16531708  poly G = 2*x*Dx+3*y*Dy+6;
     
    16591714  inForm(I,w2);
    16601715  inForm(I,w3);
     1716  inForm(F,w1);
    16611717}
    16621718
     
    16771733@*       otherwise, and by default, a block ordering is used.
    16781734@*       If w is given and consists of exactly 2*n strictly positive entries,
    1679 @*       w is used as homogenization weight.
     1735@*       w is used as homogenization weight. 
    16801736@*       Otherwise, and by default, the homogenization weight (1,...,1) is used.
    16811737DISPLAY: If printlevel=1, progress debug messages will be printed,
     
    17101766  def D2 = Weyl();
    17111767  setring D2;
    1712   ideal I = 3*x^2*Dy+2*y*Dx,2*x*Dx+3*y*Dy+6; I = std(I);
     1768  ideal I = 3*x^2*Dy+2*y*Dx,2*x*Dx+3*y*Dy+6;
    17131769  intvec u = -2,-3;
    17141770  intvec v = -u;
    17151771  initialIdealW(I,u,v);
     1772  ideal J = std(I);
     1773  initialIdealW(J,u,v); // same as above
    17161774  u = 0,1;
    17171775  initialIdealW(I,u,v);
     
    17211779"USAGE:  initialMalgrange(f,[,a,b,v]); f poly, a,b optional ints, v opt. intvec
    17221780RETURN:  ring, Weyl algebra induced by basering, extended by two new vars t,Dt
    1723 PURPOSE: computes the initial Malgrange ideal of a given polynomial w.r.t. the weight
    1724 @*       vector (-1,0...,0,1,0,...,0) such that the weight of t is -1 and the
    1725 @*       weight of Dt is 1.
    1726 ASSUME:  The basering is commutative and of characteristic 0.
     1781PURPOSE: computes the initial Malgrange ideal of a given polynomial w.r.t. the
     1782@*       weight vector (-1,0...,0,1,0,...,0) such that the weight of t is -1
     1783@*       and the weight of Dt is 1.
     1784ASSUME:  The basering is commutative and over a field of characteristic 0.
    17271785NOTE:    Activate the output ring with the @code{setring} command.
    1728 @*       The returned ring contains the ideal \"inF\", being the initial ideal
     1786@*       The returned ring contains the ideal 'inF', being the initial ideal
    17291787@*       of the Malgrange ideal of f.
    17301788@*       Varnames of the basering should not include t and Dt.
     
    17361794@*       (d,v[1],...,v[n],1,d+1-v[1],...,d+1-v[n]) is used for homogenization
    17371795@*       computations, where d denotes the weighted degree of f.
    1738 @*       Otherwise and by default, v is set to (1,...,1). See Noro, 2002.
     1796@*       Otherwise and by default, v is set to (1,...,1). See Noro (2002).
    17391797DISPLAY: If printlevel=1, progress debug messages will be printed,
    17401798@*       if printlevel>=2, all the debug messages will be printed.
     
    17421800"
    17431801{
    1744   if (dmodappassumeViolation())
    1745   {
    1746     ERROR("Basering is inappropriate: characteristic>0 or qring present");
    1747   }
     1802  dmodappAssumeViolation();
    17481803  if (!isCommutative())
    17491804  {
     
    17591814  if (size(#)>0)
    17601815  {
    1761     if (typeof(#[1])=="int" || typeof(#[1])=="number")
     1816    if (intLike(#[1]))
    17621817    {
    17631818      whichengine = int(#[1]);
     
    17651820    if (size(#)>1)
    17661821    {
    1767       if (typeof(#[2])=="int" || typeof(#[2])=="number")
     1822      if (intLike(#[2]))
    17681823      {
    17691824        methodord = int(#[2]);
     
    17711826      if (size(#)>2)
    17721827      {
    1773         if (typeof(#[3])=="intvec" && size(#[3])==n && allPositive(#[3])==1)
     1828        if ((typeof(#[3])=="intvec") && (size(#[3])==n) && (allPositive(#[3])==1))
    17741829        {
    17751830          u0 = #[3];
     
    17781833    }
    17791834  }
    1780   // creating the homogenized extended Weyl algebra
    17811835  list RL = ringlist(save);
    17821836  RL = RL[1..4]; // if basering is commutative nc_algebra
     
    18341888    I = I, var(n+2+i)+diff(f,var(i+1))*var(n+2);
    18351889  }
    1836   // I = engine(I,whichengine); // todo is it efficient to compute a GB first wrt dp first?
     1890  // I = engine(I,whichengine); // todo efficient to compute GB wrt dp first?
    18371891  // 3.2 computie the initial ideal
    18381892  intvec w = 1,0:n;
     
    18781932  if (size(#)>0)
    18791933  {
    1880     if (typeof(#[1])=="int" || typeof(#[1])=="number")
     1934    if (intLike(#[1]))
    18811935    {
    18821936      whichengine = int(#[1]);
     
    18841938    if (size(#)>1)
    18851939    {
    1886       if (typeof(#[2])=="int" || typeof(#[2])=="number")
     1940      if (intLike(#[2]))
    18871941      {
    1888         l0 = int(#[2]);
    1889         l0set = 1;
     1942        l0 = int(#[2]);
     1943        l0set = 1;
    18901944      }
    18911945      if (size(#)>2)
    18921946      {
    1893         if (typeof(#[3])=="ideal")
     1947        if (typeof(#[3])=="ideal")
    18941948        {
    1895           G = #[3];
    1896           Gset = 1;
    1897         }
     1949          G = #[3];
     1950          Gset = 1;
     1951        }
    18981952      }
    18991953    }
     
    19021956  int i,j,k;
    19031957  int n = nvars(basering)/2;
    1904   if (w == intvec(0))
     1958  if (w == 0:size(w))
    19051959  {
    19061960    ERROR("weight vector must not be zero");
     
    19401994    kill inG,v,s;
    19411995    L = intRoots(L);           // integral roots of b-function
    1942     if (L[2]==intvec(0))       // no integral roots
     1996    if (L[2]==0:size(L[2]))       // no integral roots
    19431997    {
    19441998      return(list(ideal(0),ideal(0)));
     
    19582012  }
    19592013  intvec m;
    1960   for (i=1; i<=size(G); i++)
     2014  for (i=ncols(G); i>0; i--)
    19612015  {
    19622016    m[i] = deg(G[i],ww);
     
    20142068      for (k=1; k<=ncols(B); k++)
    20152069      {
    2016         p = B[k]*G[i];
    2017         p = f(p);
    2018         M[size(M)+1] = p;
     2070        p = B[k]*G[i];
     2071        p = f(p);
     2072        M[size(M)+1] = p;
    20192073      }
    20202074    }
    20212075  }
    2022   ideal Bl0;
    2023   for (i=0; i<=l0; i++)
    2024   {
    2025     Bl0 = Bl0,Blist[i+1];
    2026   }
    2027   Bl0 = deleteGenerator(Bl0,1);
     2076  ideal Bl0 = Blist[1..(l0+1)];
    20282077  dbprint(ppl,"// found basis of free module");
    2029   dbprint(ppl-1,"// " + string(Blist));
     2078  dbprint(ppl-1,"// " + string(Bl0));
    20302079  dbprint(ppl,"// found generators of submodule");
    20312080  dbprint(ppl-1,"// " + string(M));
     
    20622111  if (!zeropresent) // restrict/integrate all vars, return input ring
    20632112  {
    2064     def newR = save;
     2113    def newR = save; 
    20652114  }
    20662115  else
     
    20962145"USAGE:  restrictionModule(I,w,[,eng,m,G]);
    20972146@*       I ideal, w intvec, eng and m optional ints, G optional ideal
    2098 RETURN:  ring
    2099 ASSUME:  The basering is the n-th Weyl algebra in characteristic 0 and for all
    2100 @*       1<=i<=n the identity var(i+n)*var(i)=var(i)*var(i+1)+1 holds, i.e. the
    2101 @*       sequence of variables is given by x(1),...,x(n),D(1),...,D(n),
    2102 @*       where D(i) is the differential operator belonging to x(i).
     2147RETURN:  ring (a Weyl algebra) containing a module 'resMod'
     2148ASSUME:  The basering is the n-th Weyl algebra over a field of characteristic 0
     2149@*       and for all 1<=i<=n the identity var(i+n)*var(i)=var(i)*var(i+1)+1
     2150@*       holds, i.e. the sequence of variables is given by
     2151@*       x(1),...,x(n),D(1),...,D(n), where D(i) is the differential operator
     2152@*       belonging to x(i).
    21032153@*       Further, assume that I is holonomic and that w is n-dimensional with
    21042154@*       non-negative entries.
    21052155PURPOSE: computes the restriction module of a holonomic ideal to the subspace
    2106 @*       defined by the variables belonging to the non-zero entries of the
    2107 @*       given intvec.
    2108 NOTE:    The output ring is the Weyl algebra defined by the zero entries of the
    2109 @*       given intvec. It contains an object @code{resMod} of type @code{module
    2110 @*       being the restriction module of the given ideal wrt the given intvec.
     2156@*       defined by the variables corresponding to the non-zero entries of the
     2157@*       given intvec
     2158NOTE:    The output ring is the Weyl algebra defined by the zero entries of w.
     2159@*       It contains a module 'resMod' being the restriction module of I wrt w.
    21112160@*       If there are no zero entries, the input ring is returned.
    21122161@*       If eng<>0, @code{std} is used for Groebner basis computations,
     
    21192168@*       Further note, that the assumptions on m and G (if given) are not
    21202169@*       checked.
    2121 0DISPLAY: If printlevel=1, progress debug messages will be printed,
     2170DISPLAY: If printlevel=1, progress debug messages will be printed,
    21222171@*       if printlevel>=2, all the debug messages will be printed.
    21232172EXAMPLE: example restrictionModule; shows examples
     
    21282177  if (size(#)>0)
    21292178  {
    2130     if (typeof(#[1])=="int" || typeof(#[1])=="number")
     2179    if (intLike(#[1]))
    21312180    {
    21322181      eng = int(#[1]);
     
    21562205  if (size(#)>0)
    21572206  {
    2158     if(typeof(#[1])=="int" || typeof(#[1])=="number")
    2159     {
    2160       eng = #[1];
     2207    if(intLike(#[1]))
     2208    {
     2209      eng = int(#[1]);
    21612210    }
    21622211  }
     
    21922241      if (M[1,i]<>0)
    21932242      {
    2194         v = M[2..r,i];
    2195         if (v == zm)
    2196         {
    2197           J[size(J+1)] = M[1,i];
    2198         }
     2243        v = M[2..r,i];
     2244        if (v == zm)
     2245        {
     2246          J[size(J+1)] = M[1,i];
     2247        }
    21992248      }
    22002249    }
     
    22182267"USAGE:  restrictionIdeal(I,w,[,eng,m,G]);
    22192268@*       I ideal, w intvec, eng and m optional ints, G optional ideal
    2220 RETURN:  ring
    2221 ASSUME:  The basering is the n-th Weyl algebra in characteristic 0 and for all
    2222 @*       1<=i<=n the identity var(i+n)*var(i)=var(i)*var(i+1)+1 holds, i.e. the
    2223 @*       sequence of variables is given by x(1),...,x(n),D(1),...,D(n),
    2224 @*       where D(i) is the differential operator belonging to x(i).
     2269RETURN:  ring (a Weyl algebra) containing an ideal 'resIdeal'
     2270ASSUME:  The basering is the n-th Weyl algebra over a field of characteristic 0
     2271@*       and for all 1<=i<=n the identity var(i+n)*var(i)=var(i)*var(i+1)+1
     2272@*       holds, i.e. the sequence of variables is given by
     2273@*       x(1),...,x(n),D(1),...,D(n), where D(i) is the differential operator
     2274@*       belonging to x(i).
    22252275@*       Further, assume that I is holonomic and that w is n-dimensional with
    22262276@*       non-negative entries.
    22272277PURPOSE: computes the restriction ideal of a holonomic ideal to the subspace
    2228 @*       defined by the variables belonging to the non-zero entries of the
    2229 @*       given intvec.
    2230 NOTE:    The output ring is the Weyl algebra defined by the zero entries of the
    2231 @*       given intvec. It contains an object @code{resIdeal} of type @code{ideal}
    2232 @*       being the restriction ideal of the given ideal wrt the given intvec.
     2278@*       defined by the variables corresponding to the non-zero entries of the
     2279@*       given intvec
     2280NOTE:    The output ring is the Weyl algebra defined by the zero entries of w.
     2281@*       It contains an ideal 'resIdeal' being the restriction ideal of I wrt w.
    22332282@*       If there are no zero entries, the input ring is returned.
    22342283@*       If eng<>0, @code{std} is used for Groebner basis computations,
     
    22462295"
    22472296{
    2248   def save = basering;
    22492297  def rm = restrictionIdealEngine(I,w,"restriction",#);
    2250   setring rm;
    2251   // export(resIdeal);
    2252   setring save;
    22532298  return(rm);
    22542299}
     
    22742319"USAGE:  fourier(I[,v]); I an ideal, v an optional intvec
    22752320RETURN:  ideal
    2276 PURPOSE: computes the Fourier transform of an ideal in the Weyl algebra
    2277 ASSUME:  The basering is the n-th Weyl algebra in characteristic 0 and for all
    2278 @*       1<=i<=n the identity var(i+n)*var(i)=var(i)*var(i+1)+1 holds, i.e. the
    2279 @*       sequence of variables is given by x(1),...,x(n),D(1),...,D(n),
    2280 @*       where D(i) is the differential operator belonging to x(i).
    2281 NOTE:    If v is an intvec with entries ranging from 1 to n, the Fourier
     2321PURPOSE: computes the Fourier transform of an ideal in a Weyl algebra
     2322ASSUME:  The basering is the n-th Weyl algebra over a field of characteristic 0
     2323@*       and for all 1<=i<=n the identity var(i+n)*var(i)=var(i)*var(i+1)+1
     2324@*       holds, i.e. the sequence of variables is given by
     2325@*       x(1),...,x(n),D(1),...,D(n), where D(i) is the differential operator
     2326@*       belonging to x(i).
     2327NOTE:    The Fourier automorphism is defined by mapping x(i) to -D(i) and
     2328@*       D(i) to x(i).
     2329@*       If v is an intvec with entries ranging from 1 to n, the Fourier
    22822330@*       transform of I restricted to the variables given by v is computed.
     2331SEE ALSO: inverseFourier
    22832332EXAMPLE: example fourier; shows examples
    22842333"
     
    22952344  int n = nvars(basering)/2;
    22962345  int i;
    2297   if(v <> intvec(0))
     2346  if(v <> 0:size(v))
    22982347  {
    22992348    v = sortIntvec(v)[1];
     
    23022351      if (v[i] == v[i+1])
    23032352      {
    2304         ERROR("No double entries allowed in intvec");
     2353        ERROR("No double entries allowed in intvec");
    23052354      }
    23062355    }
    23072356  }
    2308   else
    2309   {
    2310     for (i=1; i<=n; i++)
    2311     {
    2312       v[i] = i;
    2313     }
     2357  else 
     2358  {
     2359    v = 1..n;
    23142360  }
    23152361  ideal m = maxideal(1);
     
    23422388"USAGE:  inverseFourier(I[,v]); I an ideal, v an optional intvec
    23432389RETURN:  ideal
    2344 PURPOSE: computes the inverse of the Fourier transform of an ideal in the Weyl
    2345 @*       algebra
    2346 ASSUME:  The basering is the n-th Weyl algebra in characteristic 0 and for all
    2347 @*       1<=i<=n the identity var(i+n)*var(i)=var(i)*var(i+1)+1 holds, i.e. the
    2348 @*       sequence of variables is given by x(1),...,x(n),D(1),...,D(n),
    2349 @*       where D(i) is the differential operator belonging to x(i).
    2350 NOTE:    If v is an intvec with entries ranging from 1 to n, the inverse Fourier
     2390PURPOSE: computes the inverse Fourier transform of an ideal in a Weyl algebra
     2391ASSUME:  The basering is the n-th Weyl algebra over a field of characteristic 0
     2392@*       and for all 1<=i<=n the identity var(i+n)*var(i)=var(i)*var(i+1)+1
     2393@*       holds, i.e. the sequence of variables is given by
     2394@*       x(1),...,x(n),D(1),...,D(n), where D(i) is the differential operator
     2395@*       belonging to x(i).
     2396NOTE:    The Fourier automorphism is defined by mapping x(i) to -D(i) and
     2397@*       D(i) to x(i).
     2398@*       If v is an intvec with entries ranging from 1 to n, the inverse Fourier
    23512399@*       transform of I restricted to the variables given by v is computed.
     2400SEE ALSO: fourier
    23522401EXAMPLE: example inverseFourier; shows examples
    23532402"
     
    23642413  int n = nvars(basering)/2;
    23652414  int i;
    2366   if(v <> intvec(0))
     2415  if(v <> 0:size(v))
    23672416  {
    23682417    v = sortIntvec(v)[1];
     
    23712420      if (v[i] == v[i+1])
    23722421      {
    2373         ERROR("No double entries allowed in intvec");
     2422        ERROR("No double entries allowed in intvec");
    23742423      }
    23752424    }
    23762425  }
    2377   else
    2378   {
    2379     for (i=1; i<=n; i++)
    2380     {
    2381       v[i] = i;
    2382     }
     2426  else 
     2427  {
     2428    v = 1..n;
    23832429  }
    23842430  ideal m = maxideal(1);
     
    24112457"USAGE:  integralModule(I,w,[,eng,m,G]);
    24122458@*       I ideal, w intvec, eng and m optional ints, G optional ideal
    2413 RETURN:  ring
    2414 ASSUME:  The basering is the n-th Weyl algebra in characteristic 0 and for all
    2415 @*       1<=i<=n the identity var(i+n)*var(i)=var(i)*var(i+1)+1 holds, i.e. the
    2416 @*       sequence of variables is given by x(1),...,x(n),D(1),...,D(n),
    2417 @*       where D(i) is the differential operator belonging to x(i).
     2459RETURN:  ring (a Weyl algebra) containing a module 'intMod'
     2460ASSUME:  The basering is the n-th Weyl algebra over a field of characteristic 0
     2461@*       and for all 1<=i<=n the identity var(i+n)*var(i)=var(i)*var(i+1)+1
     2462@*       holds, i.e. the sequence of variables is given by
     2463@*       x(1),...,x(n),D(1),...,D(n), where D(i) is the differential operator
     2464@*       belonging to x(i).
    24182465@*       Further, assume that I is holonomic and that w is n-dimensional with
    24192466@*       non-negative entries.
    2420 PURPOSE: computes the integral module of a holonomic ideal to the subspace
    2421 @*       defined by the variables belonging to the non-zero entries of the
    2422 @*       given intvec.
    2423 NOTE:    The output ring is the Weyl algebra defined by the zero entries of the
    2424 @*       given intvec. It contains an object @code{intMod} of type @code{module}
    2425 @*       being the integral module of the given ideal wrt the given intvec.
     2467PURPOSE: computes the integral module of a holonomic ideal w.r.t. the subspace
     2468@*       defined by the variables corresponding to the non-zero entries of the
     2469@*       given intvec
     2470NOTE:    The output ring is the Weyl algebra defined by the zero entries of w.
     2471@*       It contains a module 'intMod' being the integral module of I wrt w.
    24262472@*       If there are no zero entries, the input ring is returned.
    24272473@*       If eng<>0, @code{std} is used for Groebner basis computations,
    24282474@*       otherwise, and by default, @code{slimgb} is used.
    2429 @*       Let F denote the Fourier transform of I wrt w.
    2430 @*       The minimal integer root of the b-function of F(I) wrt the weight
     2475@*       Let F(I) denote the Fourier transform of I w.r.t. w.
     2476@*       The minimal integer root of the b-function of F(I) w.r.t. the weight
    24312477@*       (-w,w) can be specified via the optional argument m.
    24322478@*       The optional argument G is used for specifying a Groebner Basis of F(I)
    24332479@*       wrt the weight (-w,w), that is, the initial form of G generates the
    2434 @*       initial ideal of F(I) wrt the weight (-w,w).
     2480@*       initial ideal of F(I) w.r.t. the weight (-w,w).
    24352481@*       Further note, that the assumptions on m and G (if given) are not
    24362482@*       checked.
     
    24452491  if (size(#)>0)
    24462492  {
    2447     if (typeof(#[1])=="int" || typeof(#[1])=="number")
     2493    if (intLike(#[1]))
    24482494    {
    24492495      whichengine = int(#[1]);
     
    24512497    if (size(#)>1)
    24522498    {
    2453       if (typeof(#[2])=="int" || typeof(#[2])=="number")
     2499      if (intLike(#[2]))
    24542500      {
    2455         l0 = int(#[2]);
    2456         l0set = 1;
     2501        l0 = int(#[2]);
     2502        l0set = 1;
    24572503      }
    24582504      if (size(#)>2)
    24592505      {
    2460         if (typeof(#[3])=="ideal")
     2506        if (typeof(#[3])=="ideal")
    24612507        {
    2462           G = #[3];
    2463           Gset = 1;
    2464         }
     2508          G = #[3];
     2509          Gset = 1;
     2510        }
    24652511      }
    24662512    }
     
    24742520    if (w[i]>0)
    24752521    {
    2476       if (v == intvec(0))
     2522      if (v == 0:size(v))
    24772523      {
    2478         v[1] = i;
     2524        v[1] = i;
    24792525      }
    24802526      else
    24812527      {
    2482         v[size(v)+1] = i;
     2528        v[size(v)+1] = i;
    24832529      }
    24842530    }
     
    25252571"USAGE:  integralIdeal(I,w,[,eng,m,G]);
    25262572@*       I ideal, w intvec, eng and m optional ints, G optional ideal
    2527 RETURN:  ring
    2528 ASSUME:  The basering is the n-th Weyl algebra in characteristic 0 and for all
    2529 @*       1<=i<=n the identity var(i+n)*var(i)=var(i)*var(i+1)+1 holds, i.e. the
    2530 @*       sequence of variables is given by x(1),...,x(n),D(1),...,D(n),
    2531 @*       where D(i) is the differential operator belonging to x(i).
     2573RETURN:  ring (a Weyl algebra) containing an ideal 'intIdeal'
     2574ASSUME:  The basering is the n-th Weyl algebra over a field of characteristic 0
     2575@*       and for all 1<=i<=n the identity var(i+n)*var(i)=var(i)*var(i+1)+1
     2576@*       holds, i.e. the sequence of variables is given by
     2577@*       x(1),...,x(n),D(1),...,D(n), where D(i) is the differential operator
     2578@*       belonging to x(i).
    25322579@*       Further, assume that I is holonomic and that w is n-dimensional with
    25332580@*       non-negative entries.
    2534 PURPOSE: computes the integral ideal of a holonomic ideal to the subspace
    2535 @*       defined by the variables belonging to the non-zero entries of the
     2581PURPOSE: computes the integral ideal of a holonomic ideal w.r.t. the subspace
     2582@*       defined by the variables corresponding to the non-zero entries of the
    25362583@*       given intvec.
    2537 NOTE:    The output ring is the Weyl algebra defined by the zero entries of the
    2538 @*       given intvec. It contains an object @code{intIdeal} of type @code{ideal}
    2539 @*       being the integral ideal of the given ideal wrt the given intvec.
     2584NOTE:    The output ring is the Weyl algebra defined by the zero entries of w.
     2585@*       It contains ideal 'intIdeal' being the integral ideal of I w.r.t. w.
    25402586@*       If there are no zero entries, the input ring is returned.
    25412587@*       If eng<>0, @code{std} is used for Groebner basis computations,
     
    25532599"
    25542600{
    2555   def save = basering;
    25562601  def im = restrictionIdealEngine(I,w,"integral",#);
    2557   setring im;
    2558   //export(intIdeal);
    2559   setring save;
    25602602  return(im);
    25612603}
     
    25772619@*       I ideal, w optional intvec, eng and k optional ints, G optional ideal
    25782620RETURN:  ideal
    2579 ASSUME:  The basering is the n-th Weyl algebra in characteristic 0 and for all
    2580 @*       1<=i<=n the identity var(i+n)*var(i)=var(i)*var(i+1)+1 holds, i.e. the
    2581 @*       sequence of variables is given by x(1),...,x(n),D(1),...,D(n),
    2582 @*       where D(i) is the differential operator belonging to x(i).
    2583 @*       Further, assume that I is a cyclic representation of the holonomic
    2584 @*       module K[x,1/f]f^m, where f in K[x] and m is smaller than or equal to
     2621ASSUME:  The basering is the n-th Weyl algebra D over a field of characteristic
     2622@*       zero and for all 1<=i<=n the identity var(i+n)*var(i)=var(i)*var(i+1)+1
     2623@*       holds, i.e. the sequence of variables is given by
     2624@*       x(1),...,x(n),D(1),...,D(n), where D(i) is the differential operator
     2625@*       belonging to x(i).
     2626@*       Further, assume that I is of special kind, namely let f in K[x] and
     2627@*       consider the module K[x,1/f]f^m, where m is smaller than or equal to
    25852628@*       the minimal integer root of the Bernstein-Sato polynomial of f.
     2629@*       Since this module is known to be a holonomic D-module, it has a cyclic
     2630@*       presentation D/I.
    25862631PURPOSE: computes a basis of the n-th de Rham cohomology group of the complement
    25872632@*       of the hypersurface defined by f
    2588 NOTE:    If I does not satisfy the conditions described above, the result might
    2589 @*       have no meaning.
     2633NOTE:    If I does not satisfy the assumptions described above, the result might
     2634@*       have no meaning. Note that I can be computed with @code{annfs}.
    25902635@*       If w is an intvec with exactly n strictly positive entries, w is used
    25912636@*       in the computation. Otherwise, and by default, w is set to (1,...,1).
    25922637@*       If eng<>0, @code{std} is used for Groebner basis computations,
    25932638@*       otherwise, and by default, @code{slimgb} is used.
    2594 @*       Let F denote the Fourier transform of I wrt w.
     2639@*       Let F(I) denote the Fourier transform of I wrt w.
    25952640@*       An integer smaller than or equal to the minimal integer root of the
    25962641@*       b-function of F(I) wrt the weight (-w,w) can be specified via the
     
    26012646@*       Further note, that the assumptions on I, k and G (if given) are not
    26022647@*       checked.
     2648THEORY:  (SST) pp. 232-235
    26032649DISPLAY: If printlevel=1, progress debug messages will be printed,
    26042650@*       if printlevel>=2, all the debug messages will be printed.
     2651SEE ALSO: deRhamCohom
    26052652EXAMPLE: example deRhamCohomIdeal; shows examples
    26062653"
     
    26162663      if (allPositive(#[1])==1)
    26172664      {
    2618         w = #[1];
     2665        w = #[1];
    26192666      }
    26202667      else
    26212668      {
    2622         print("// Entries of intvec must be strictly positive");
    2623         print("// Using weight " + string(w));
     2669        print("// Entries of intvec must be strictly positive");
     2670        print("// Using weight " + string(w));
    26242671      }
    26252672      if (size(#)>1)
    26262673      {
    2627         if (typeof(#[2])=="int" || typeof(#[2])=="number")
     2674        if (intLike(#[2]))
    26282675        {
    2629           whichengine = int(#[2]);
    2630         }
    2631         if (size(#)>2)
     2676          whichengine = int(#[2]);
     2677        }
     2678        if (size(#)>2)
    26322679        {
    2633           if (typeof(#[3])=="int" || typeof(#[3])=="number")
     2680          if (intLike(#[3]))
    26342681          {
    2635             l0 = int(#[3]);
    2636             l0set = 1;
    2637           }
    2638           if (size(#)>3)
     2682            l0 = int(#[3]);
     2683            l0set = 1;
     2684          }
     2685          if (size(#)>3)
    26392686          {
    2640             if (typeof(#[4])=="ideal")
     2687            if (typeof(#[4])=="ideal")
    26412688            {
    2642               G = #[4];
    2643               Gset = 1;
    2644             }
    2645           }
    2646         }
     2689              G = #[4];
     2690              Gset = 1;
     2691            }
     2692          }
     2693        }
    26472694      }
    26482695    }
     
    26562703    if (w[i]>0)
    26572704    {
    2658       if (v == intvec(0))
     2705      if (v == 0:size(v))
    26592706      {
    2660         v[1] = i;
     2707        v[1] = i;
    26612708      }
    26622709      else
    26632710      {
    2664         v[size(v)+1] = i;
     2711        v[size(v)+1] = i;
    26652712      }
    26662713    }
     
    27002747  N = simplify(N,2+8);
    27012748  printlevel = printlevel-1;
    2702   N = linReduceIdeal(N);
     2749  N = linReduceIdeal(N); 
    27032750  N = simplify(N,2+8);
    27042751  for (i=1; i<=size(B); i++)
     
    27112758      while (p<N[j])
    27122759      {
    2713         j++;
     2760        j++;
    27142761      }
    27152762      N = insertGenerator(N,p,j+1);
     
    27272774  def W = annRat(1,F^2); // so we compute the annihilator of 1/F^2
    27282775  setring W; W;          // Weyl algebra, contains LD = Ann(1/F^2)
    2729   LD;                    // K[x,y,z,1/f]f^(-2) is isomorphic to W/LD as W-module
     2776  LD;                    // K[x,y,z,1/F]F^(-2) is isomorphic to W/LD as W-module
    27302777  deRhamCohomIdeal(LD);  // we see that the K-dim is 2
    27312778}
     
    27332780proc deRhamCohom (poly f, list #)
    27342781"USAGE:  deRhamCohom(f[,eng,m]);  f poly, eng and m optional ints
    2735 RETURN:  ring
    2736 ASSUME:  Basering is a commutative ring in n variables over a field of char 0.
    2737 PURPOSE: computes a basis of the n-th de Rham cohomology group of f^m
    2738 NOTE:    The output ring is the n-th Weyl algebra. It contains an object
    2739 @*       @code{DR} of type @code{ideal}, being a basis of the n-th de Rham
    2740 @*       cohomology group of the complement of the hypersurface defined by f.
     2782RETURN:  ring (a Weyl Algebra) containing an ideal 'DR'
     2783ASSUME:  Basering is a commutative and over a field of characteristic 0.
     2784PURPOSE: computes a basis of the n-th de Rham cohomology group of the complement
     2785@*       of the hypersurface defined by f, where n denotes the number of
     2786@*       variables of the basering
     2787NOTE:    The output ring is the n-th Weyl algebra. It contains an ideal 'DR'
     2788@*       being a basis of the n-th de Rham cohomology group of the complement of
     2789@*       the hypersurface defined by f.
    27412790@*       If eng<>0, @code{std} is used for Groebner basis computations,
    27422791@*       otherwise, and by default, @code{slimgb} is used.
     
    27452794@*       not checked. If not specified, m is set to the minimal integer root of
    27462795@*       the Bernstein-Sato polynomial of f.
     2796THEORY:  (SST) pp. 232-235
    27472797DISPLAY: If printlevel=1, progress debug messages will be printed,
    27482798@*       if printlevel>=2, all the debug messages will be printed.
     2799SEE ALSO: deRhamCohomIdeal
    27492800EXAMPLE: example deRhamCohom; shows example
    27502801"
     
    27542805  if (size(#)>0)
    27552806  {
    2756     if(typeof(#[1])=="int" || typeof(#[1])=="number")
     2807    if(intLike(#[1]))
    27572808    {
    27582809      eng = int(#[1]);
     
    27602811    if (size(#)>1)
    27612812    {
    2762       if(typeof(#[2])=="int" || typeof(#[2])=="number")
     2813      if(intLike(#[2]))
    27632814      {
    2764         l0 = int(#[2]);
    2765         l0given = 1;
     2815        l0 = int(#[2]);
     2816        l0given = 1;
    27662817      }
    27672818    }
     
    27742825  def save = basering;
    27752826  int n = nvars(save);
    2776   dbprint(ppl,"// Computing Ann(f^s)...");
     2827  dbprint(ppl,"// Computing s-parametric annihilator Ann(f^s)...");
    27772828  def A = Sannfs(f);
    27782829  setring A;
     
    27852836    ideal LDf = LD,f;
    27862837    LDf = engine(LDf,eng);
    2787     vector v = pIntersect(s,LDf);   // BS poly of f
     2838    vector v = pIntersect(var(2*n+1),LDf);   // BS poly of f
    27882839    list BS = bFactor(vec2poly(v));
    27892840    dbprint(ppl,"// ...done");
     
    28402891proc appelF1()
    28412892"USAGE:  appelF1();
    2842 RETURN:  ring  (and exports an ideal into it)
    2843 PURPOSE: define the ideal in a parametric Weyl algebra,
    2844 @* which annihilates Appel F1 hypergeometric function
    2845 NOTE: the ideal called  IAppel1 is exported to the output ring
    2846 EXAMPLE: example appelF1; shows examples
     2893RETURN:  ring (a parametric Weyl algebra) containing an ideal 'IAppel1'
     2894PURPOSE: defines the ideal in a parametric Weyl algebra,
     2895@*       which annihilates Appel F1 hypergeometric function
     2896NOTE:    The output ring is a parametric Weyl algebra. It contains an ideal
     2897@*       'IAappel1' annihilating Appel F1 hypergeometric function.
     2898@*       See (SST) p. 48.
     2899EXAMPLE: example appelF1; shows example
    28472900"
    28482901{
    28492902  // Appel F1, d = b', SST p.48
    28502903  ring @r = (0,a,b,c,d),(x,y,Dx,Dy),(a(0,0,1,1),a(0,0,1,0),dp);
    2851   matrix @D[4][4];
    2852   @D[1,3]=1; @D[2,4]=1;
    2853   def @S = nc_algebra(1,@D);
     2904  def @S = Weyl();
    28542905  setring @S;
    28552906  ideal IAppel1 =
     
    28712922proc appelF2()
    28722923"USAGE:  appelF2();
    2873 RETURN:  ring (and exports an ideal into it)
    2874 PURPOSE: define the ideal in a parametric Weyl algebra,
    2875 @* which annihilates Appel F2 hypergeometric function
    2876 NOTE: the ideal called  IAppel2 is exported to the output ring
    2877 EXAMPLE: example appelF2; shows examples
     2924RETURN:  ring (a parametric Weyl algebra) containing an ideal 'IAppel2'
     2925PURPOSE: defines the ideal in a parametric Weyl algebra,
     2926@*       which annihilates Appel F2 hypergeometric function
     2927NOTE:    The output ring is a parametric Weyl algebra. It contains an ideal
     2928@*       'IAappel2' annihilating Appel F2 hypergeometric function.
     2929@*       See (SST) p. 85.
     2930EXAMPLE: example appelF2; shows example
    28782931"
    28792932{
    28802933  // Appel F2, c = b', SST p.85
    28812934  ring @r = (0,a,b,c),(x,y,Dx,Dy),(a(0,0,1,1),a(0,0,1,0),dp);
    2882   matrix @D[4][4];
    2883   @D[1,3]=1; @D[2,4]=1;
    2884   def @S = nc_algebra(1,@D);
     2935  def @S = Weyl();
    28852936  setring @S;
    28862937  ideal IAppel2 =
     
    29012952proc appelF4()
    29022953"USAGE:  appelF4();
    2903 RETURN:  ring  (and exports an ideal into it)
    2904 PURPOSE: define the ideal in a parametric Weyl algebra,
    2905 @* which annihilates Appel F4 hypergeometric function
    2906 NOTE: the ideal called  IAppel4 is exported to the output ring
    2907 EXAMPLE: example appelF4; shows examples
     2954RETURN:  ring (a parametric Weyl algebra) containing an ideal 'IAppel4'
     2955PURPOSE: defines the ideal in a parametric Weyl algebra,
     2956@*       which annihilates Appel F4 hypergeometric function
     2957NOTE:    The output ring is a parametric Weyl algebra. It contains an ideal
     2958@*       'IAappel4' annihilating Appel F4 hypergeometric function.
     2959@*       See (SST) p. 39.
     2960EXAMPLE: example appelF4; shows example
    29082961"
    29092962{
    29102963  // Appel F4, d = c', SST, p. 39
    29112964  ring @r = (0,a,b,c,d),(x,y,Dx,Dy),(a(0,0,1,1),a(0,0,1,0),dp);
    2912   matrix @D[4][4];
    2913   @D[1,3]=1; @D[2,4]=1;
    2914   def @S = nc_algebra(1,@D);
     2965  def @S = Weyl();
    29152966  setring @S;
    29162967  ideal IAppel4 =
     
    29342985proc charVariety(ideal I, list #)
    29352986"USAGE:  charVariety(I [,eng]); I an ideal, eng an optional int
    2936 RETURN:  ring
    2937 PURPOSE: compute the characteristic variety of the D-module D/I
    2938 ASSUME:  The basering is the n-th Weyl algebra in characteristic 0 and for all
    2939 @*       1<=i<=n the identity var(i+n)*var(i)=var(i)*var(i+1)+1 holds, i.e. the
    2940 @*       sequence of variables is given by x(1),...,x(n),D(1),...,D(n),
    2941 @*       where D(i) is the differential operator belonging to x(i).
    2942 NOTE:    The output ring is commutative. It contains an object @code{charVar} of
    2943 @*       type @code{ideal}, whose zero set is the characteristic variety of I in
    2944 @*       the sense of D-module theory.
    2945 @*       In this procedure, the initial ideal of I wrt weight 0 for x(i) and
    2946 @*       weight 1 for D(i) is computed.
     2987RETURN:  ring (commutative) containing an ideal 'charVar'
     2988PURPOSE: computes an ideal whose zero set is the characteristic variety of I in
     2989@*       the sense of D-module theory
     2990ASSUME:  The basering is the n-th Weyl algebra over a field of characteristic 0
     2991@*       and for all 1<=i<=n the identity var(i+n)*var(i)=var(i)*var(i+1)+1
     2992@*       holds, i.e. the sequence of variables is given by
     2993@*       x(1),...,x(n),D(1),...,D(n), where D(i) is the differential operator
     2994@*       belonging to x(i).
     2995NOTE:    The output ring is commutative. It contains an ideal 'charVar'.
    29472996@*       If eng<>0, @code{std} is used for Groebner basis computations,
    29482997@*       otherwise, and by default, @code{slimgb} is used.
    2949 @*      If @code{printlevel}=1, progress debug messages will be printed,
     2998DISPLAY: If @code{printlevel}=1, progress debug messages will be printed,
    29502999@*       if @code{printlevel}>=2, all the debug messages will be printed.
     3000SEE ALSO: charInfo
    29513001EXAMPLE: example charVariety; shows examples
    29523002"
     
    29563006  if (size(#)>0)
    29573007  {
    2958     if (typeof(#[1])=="int" || typeof(#[1])=="number")
     3008    if (intLike(#[1]))
    29593009    {
    29603010      eng = int(#[1]);
     
    29773027  intvec uv = u,v;
    29783028  charVar = inForm(charVar,uv);
    2979   charVar = engine(charVar,eng);
     3029  charVar = groebner(charVar);
    29803030  export(charVar);
    29813031  setring save;
     
    29943044  setring CA; CA; // commutative ring
    29953045  charVar;
    2996   dim(charVar);
     3046  dim(charVar);   // hence I is holonomic
    29973047}
    29983048
    29993049proc charInfo(ideal I)
    30003050"USAGE:  charInfo(I);  I an ideal
    3001 RETURN:  ring
    3002 PURPOSE: compute the characteristic information for I
    3003 ASSUME:  The basering is the n-th Weyl algebra in characteristic 0 and for all
    3004 @*       1<=i<=n the identity var(i+n)*var(i)=var(i)*var(i+1)+1 holds, i.e. the
    3005 @*       sequence of variables is given by x(1),...,x(n),D(1),...,D(n),
    3006 @*       where D(i) is the differential operator belonging to x(i).
    3007 NOTE:    Activate the output ring with the @code{setring} command.
    3008 @*       In the output (in a commutative ring):
    3009 @*       - the ideal charVar is the characteristic variety char(I),
    3010 @*       - the ideal SingLoc is the singular locus of char(I),
    3011 @*       - the list primDec is the primary decomposition of char(I).
    3012 @*       If @code{printlevel}=1, progress debug messages will be printed,
     3051RETURN:  ring (commut.) containing ideals 'charVar','singLoc' and list 'primDec'
     3052PURPOSE: computes characteristic variety of I (in the sense of D-module theory),
     3053@*       its singular locus and primary decomposition
     3054ASSUME:  The basering is the n-th Weyl algebra over a field of characteristic 0
     3055@*       and for all 1<=i<=n the identity var(i+n)*var(i)=var(i)*var(i+1)+1
     3056@*       holds, i.e. the sequence of variables is given by
     3057@*       x(1),...,x(n),D(1),...,D(n), where D(i) is the differential operator
     3058@*       belonging to x(i).
     3059NOTE:    In the output ring, which is commutative:
     3060@*       - the ideal 'charVar' is the characteristic variety char(I),
     3061@*       - the ideal 'SingLoc' is the singular locus of char(I),
     3062@*       - the list 'primDec' is the primary decomposition of char(I).
     3063DISPLAY: If @code{printlevel}=1, progress debug messages will be printed,
    30133064@*       if @code{printlevel}>=2, all the debug messages will be printed.
    30143065EXAMPLE: example charInfo; shows examples
     
    30243075  dbprint(ppl,"// computing singular locus...");
    30253076  ideal singLoc = slocus(charVar);
    3026   singLoc = std(singLoc);
     3077  singLoc = groebner(singLoc);
    30273078  dbprint(ppl,"// ...done");
    30283079  dbprint(ppl-1,"//    Got: " + string(singLoc));
     
    31153166  setring R;
    31163167  DLoc(I,F);
    3117   LD0;  BS;
    31183168}
    31193169
     
    31473197  setring R;
    31483198  DLoc(I,F);
    3149   LD0;  BS;
    31503199}
    31513200
Note: See TracChangeset for help on using the changeset viewer.