Changeset a470eb in git for Singular/LIB/dmod.lib


Ignore:
Timestamp:
Dec 9, 2008, 5:50:21 PM (15 years ago)
Author:
Viktor Levandovskyy <levandov@…>
Branches:
(u'spielwiese', '8e0ad00ce244dfd0756200662572aef8402f13d5')
Children:
b27003ea53bc5aef753c4c03343c9966e60f84a5
Parents:
14ccffa45f9de16d6daa9a125a75bcc8b23f9014
Message:
*levandov: minor bugfixes and docu


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

Legend:

Unmodified
Added
Removed
  • Singular/LIB/dmod.lib

    r14ccff ra470eb  
    11//////////////////////////////////////////////////////////////////////////////
    2 version="$Id: dmod.lib,v 1.31 2008-10-06 17:04:26 Singular Exp $";
     2version="$Id: dmod.lib,v 1.32 2008-12-09 16:50:21 levandov Exp $";
    33category="Noncommutative";
    44info="
    55LIBRARY: dmod.lib     Algorithms for algebraic D-modules
    6 AUTHORS: Viktor Levandovskyy,     levandov@risc.uni-linz.ac.at
     6AUTHORS: Viktor Levandovskyy,     levandov@math.rwth-aachen.de
    77@*             Jorge Martin Morales,    jorge@unizar.es
    88
     
    5656annfsOT(F[,eng]);          compute Ann F^s0 in D and Bernstein poly for a poly F (algorithm of Oaku-Takayama)
    5757SannfsBM(F[,eng]);         compute Ann F^s in D[s] for a poly F (algorithm of Briancon-Maisonobe)
     58SannfsBFCT(F[,eng]);      compute Ann F^s in D[s] for a poly F (algorithm of Briancon-Maisonobe)
    5859SannfsLOT(F[,eng]);        compute Ann F^s in D[s] for a poly F (Levandovskyy modification of the Oaku-Takayama algorithm)
    5960SannfsOT(F[,eng]);         compute Ann F^s in D[s] for a poly F (algorithm of Oaku-Takayama)
    60 annfs0(I,F [,eng]);        compute Ann F^s0 in D and Bernstein poly from the known Ann F^s in D[s]
     61annfs0(I,F [,eng]);           compute Ann F^s0 in D and Bernstein poly from the known Ann F^s in D[s]
    6162checkRoot1(I,F,a[,eng]);   check whether a rational is a root of the global Bernstein polynomial of F from the known Ann F^s in D[s]
    6263checkRoot2(I,F,a[,eng]);   check whether a rational is a root of the global Bernstein polynomial of F and compute its multiplicity from the known Ann F^s in D[s]
     
    107108  example SannfsLOT;
    108109  example SannfsOT;
    109   example annfs0;
    110110  example checkRoot1;
    111111  example checkRoot2;
     
    18671867{
    18681868  "EXAMPLE:"; echo = 2;
    1869   //  ring r = 0,(x,y,z,w),Dp;
    1870   //  poly F = x^3+y^3+z^2*w;
    18711869  ring r = 0,(x,y,z),Dp;
    18721870  poly F = x^3+y^3+z^3;
     
    18811879  PS; // the operator, s.t. PS*F^{s+1} = bs*F^s mod LD
    18821880  reduce(PS*F-bs,LD); // check the property of PS
     1881}
     1882
     1883// more interesting:
     1884//  ring r = 0,(x,y,z,w),Dp;
     1885//  poly F = x^3+y^3+z^2*w;
     1886
     1887// TODO: 1 has to appear in the 2nd column of transp. matrix
     1888// this does not happen automatically
     1889// for this, do special modulo with emphasis on the 2comp
     1890// of the transp matrix, there must appear 1 in the GB
     1891// need: (c,<) ordering for such comp's
     1892
     1893// proc operatorModulo(poly F, ideal I, poly b)
     1894// "USAGE:  operatorModulo(f,I,b);  f a poly, I an ideal, b a poly
     1895// RETURN:  poly
     1896// PURPOSE: compute the B-operator from the poly F, ideal I = Ann f^s and Bernstein-Sato
     1897// polynomial b using modulo
     1898// NOTE:  The computations take place in the ring, similar to the one returned by Sannfs procedure.
     1899// @*       If printlevel=1, progress debug messages will be printed,
     1900// @*       if printlevel>=2, all the debug messages will be printed.
     1901// EXAMPLE: example operatorModulo; shows examples
     1902// "
     1903// {
     1904//   // with hom_kernel;
     1905//   matrix AA[1][2] = F,-b;
     1906//   //  matrix M = matrix(subst(I,s,s+1)*freemodule(2)); // ann f^{s+1}
     1907//   matrix N = matrix(I); // ann f^s
     1908//   //  matrix K = hom_kernel(AA,M,N);
     1909//   matrix K = modulo(AA,N);
     1910//   K = transpose(K);
     1911//   print(K);
     1912//   ideal J;
     1913//   int i;
     1914//   poly t; number n;
     1915//   for(i=1; i<=nrows(K); i++)
     1916//   {
     1917//     if (K[i,2]!=0)
     1918//     {
     1919//       if ( leadmonom(K[i,2]) == 1)
     1920//       {
     1921//      t = K[i,1];
     1922//      n = leadcoef(K[i,2]);
     1923//      t = t/n;
     1924//      //        J = J, K[i][2];
     1925//      break;
     1926//       }
     1927//     }
     1928//   }
     1929//   ideal J = groebner(subst(I,s,s+1)); // for NF
     1930//   t = NF(t,J);
     1931//   "candidate:"; t;
     1932//   J = subst(J,s,s-1);
     1933//   // test:
     1934//   if ( NF(t*F-b,J) !=0)
     1935//   {
     1936//     "Problem: PS does not work on F";
     1937//   }
     1938//   return(t);
     1939// }
     1940// example
     1941// {
     1942//   "EXAMPLE:"; echo = 2;
     1943//   //  ring r = 0,(x,y,z),Dp;
     1944//   //   poly F = x^3+y^3+z^3;
     1945//   LIB "dmod.lib"; option(prot); option(mem);
     1946//   ring r = 0,(x,y),Dp;
     1947//   //  poly F = x^3+y^3+x*y^2;
     1948//   poly F = x^4 + y^4 + x*y^4;
     1949//   def A = Sannfs(F); // here we get LD = ann f^s
     1950//   setring A;
     1951//   poly F = imap(r,F);
     1952//   def B = annfs0(LD,F); // to obtain BS polynomial
     1953//   list BS = imap(B,BS);
     1954//   poly b = fl2poly(BS,"s");
     1955//   LD = groebner(LD);
     1956//   poly PS = operatorModulo(F,LD,b);
     1957//   PS; // the operator, s.t. PS*F^{s+1} = bs*F^s mod LD
     1958//   reduce(PS*F-bs,LD); // check the property of PS
     1959// }
     1960
     1961proc fl2poly(list L, string s)
     1962"USAGE:  fl2poly(L,s); L a list, s a string
     1963RETURN:  poly
     1964PURPOSE: reconstruct a monic polynomial in one variable from its factorization
     1965ASSUME:  s is a string with the name of some variable and L is supposed to consist of two entries:
     1966@*         L[1] of the type ideal with the roots of a polynomial
     1967@*         L[2] of the type intvec with the multiplicities of corr. roots
     1968EXAMPLE: example fl2poly; shows examples
     1969"
     1970{
     1971  if (varnum(s)==0)
     1972  {
     1973    ERROR("no such variable found"); return(0);
     1974  }
     1975  poly x = var(varnum(s));
     1976  poly P = 1;
     1977  int sl = size(L[1]);
     1978  ideal RR = L[1];
     1979  intvec IV = L[2];
     1980  for(int i=1; i<= sl; i++)
     1981  {
     1982    P = P*((x-RR[i])^IV[i]);
     1983  }
     1984  return(P);
     1985}
     1986example
     1987{
     1988  "EXAMPLE:"; echo = 2;
     1989  ring r = 0,(x,y,z,s),Dp;
     1990  ideal I = -1,-4/3,-5/3,-2;
     1991  intvec mI = 2,1,1,1;
     1992  list BS = I,mI;
     1993  poly p = fl2poly(BS,"s");
     1994  p;
     1995  factorize(p,2);
    18831996}
    18841997
     
    33213434  setring A;
    33223435  LD;
     3436}
     3437
     3438proc SannfsBFCT(poly F, list #)
     3439"USAGE:  SannfsBFCT(f [,eng]);  f a poly, eng an optional int
     3440RETURN:  ring
     3441PURPOSE: compute the D-module structure of basering[1/f]*f^s, according to the 1st step of the algorithm by Briancon and Maisonobe in the ring D[s], where D is the Weyl algebra
     3442NOTE:    activate this ring with the @code{setring} command.
     3443@*       This procedure, unlike SannfsBM, returns a ring with the degrevlex ordering in all variables.
     3444@*       In the ring D[s], the ideal LD (which is NOT a Groebner basis) is the needed D-module structure,
     3445@*       If eng <>0, @code{std} is used for Groebner basis computations,
     3446@*       otherwise, and by default @code{slimgb} is used.
     3447@*       If printlevel=1, progress debug messages will be printed,
     3448@*       if printlevel>=2, all the debug messages will be printed.
     3449EXAMPLE: example SannfsBFCT; shows examples
     3450"
     3451{
     3452  int eng = 0;
     3453  if ( size(#)>0 )
     3454  {
     3455    if ( typeof(#[1]) == "int" )
     3456    {
     3457      eng = int(#[1]);
     3458    }
     3459  }
     3460  // returns a list with a ring and an ideal LD in it
     3461  int ppl = printlevel-voice+2;
     3462  //  printf("plevel :%s, voice: %s",printlevel,voice);
     3463  def save = basering;
     3464  int N = nvars(basering);
     3465  int Nnew = 2*N+2;
     3466  int i,j;
     3467  string s;
     3468  list RL = ringlist(basering);
     3469  list L, Lord;
     3470  list tmp;
     3471  intvec iv;
     3472  L[1] = RL[1]; // char
     3473  L[4] = RL[4]; // char, minpoly
     3474  // check whether vars have admissible names
     3475  list Name  = RL[2];
     3476  list RName;
     3477  RName[1] = "@t";
     3478  RName[2] = "@s";
     3479  for(i=1;i<=N;i++)
     3480  {
     3481    for(j=1; j<=size(RName);j++)
     3482    {
     3483      if (Name[i] == RName[j])
     3484      {
     3485        ERROR("Variable names should not include @t,@s");
     3486      }
     3487    }
     3488  }
     3489  // now, create the names for new vars
     3490  list DName;
     3491  for(i=1;i<=N;i++)
     3492  {
     3493    DName[i] = "D"+Name[i]; // concat
     3494  }
     3495  tmp[1] = "t";
     3496  tmp[2] = "s";
     3497  list NName = tmp + DName + Name ;
     3498  L[2]   = NName;
     3499  // Name, Dname will be used further
     3500  kill NName;
     3501  // block ord (lp(2),dp);
     3502  tmp[1]  = "lp"; // string
     3503  iv      = 1,1;
     3504  tmp[2]  = iv; //intvec
     3505  Lord[1] = tmp;
     3506  // continue with dp 1,1,1,1...
     3507  tmp[1]  = "dp"; // string
     3508  s       = "iv=";
     3509  for(i=1;i<=Nnew;i++)
     3510  {
     3511    s = s+"1,";
     3512  }
     3513  s[size(s)]= ";";
     3514  execute(s);
     3515  kill s;
     3516  tmp[2]    = iv;
     3517  Lord[2]   = tmp;
     3518  tmp[1]    = "C";
     3519  iv        = 0;
     3520  tmp[2]    = iv;
     3521  Lord[3]   = tmp;
     3522  tmp       = 0;
     3523  L[3]      = Lord;
     3524  // we are done with the list
     3525  def @R@ = ring(L);
     3526  setring @R@;
     3527  matrix @D[Nnew][Nnew];
     3528  @D[1,2]=t;
     3529  for(i=1; i<=N; i++)
     3530  {
     3531    @D[2+i,N+2+i]=-1;
     3532  }
     3533  //  L[5] = matrix(UpOneMatrix(Nnew));
     3534  //  L[6] = @D;
     3535  def @R = nc_algebra(1,@D);
     3536  setring @R;
     3537  kill @R@;
     3538  dbprint(ppl,"// -1-1- the ring @R(t,s,_Dx,_x) is ready");
     3539  dbprint(ppl-1, @R);
     3540  // create the ideal I
     3541  poly  F = imap(save,F);
     3542  ideal I = t*F+s;
     3543  poly p;
     3544  for(i=1; i<=N; i++)
     3545  {
     3546    p = t; // t
     3547    p = diff(F,var(N+2+i))*p;
     3548    I = I, var(2+i) + p;
     3549  }
     3550  // -------- the ideal I is ready ----------
     3551  dbprint(ppl,"// -1-2- starting the elimination of t in @R");
     3552  dbprint(ppl-1, I);
     3553  ideal J = engine(I,eng);
     3554  ideal K = nselect(J,1);
     3555  dbprint(ppl,"// -1-3- t is eliminated");
     3556  dbprint(ppl-1, K);  // K is without t
     3557  K = engine(K,eng);  // std does the job too
     3558  // now, we must change the ordering
     3559  // and create a ring without t
     3560  //  setring S;
     3561  // ----------- the ring @R3 ------------
     3562  // _Dx,_x,s;  +fast ord !
     3563  // keep: N, i,j,s, tmp, RL
     3564  Nnew = 2*N+1;
     3565  kill Lord, tmp, iv, RName;
     3566  list Lord, tmp;
     3567  intvec iv;
     3568  list L=imap(save,L);
     3569  list RL=imap(save,RL);
     3570  L[1] = RL[1];
     3571  L[4] = RL[4];  // char, minpoly
     3572  // check whether vars hava admissible names -> done earlier
     3573  // now, create the names for new var
     3574  tmp[1] = "s";
     3575  // DName is defined earlier
     3576  list NName = DName + Name + tmp;
     3577  L[2] = NName;
     3578  tmp = 0;
     3579  // just dp
     3580  // block ord (dp(N),dp);
     3581  string s = "iv=";
     3582  for (i=1; i<=Nnew; i++)
     3583  {
     3584    s = s+"1,";
     3585  }
     3586  s[size(s)]=";";
     3587  execute(s);
     3588  tmp[1] = "dp";  // string
     3589  tmp[2] = iv;   // intvec
     3590  Lord[1] = tmp;
     3591  kill s;
     3592  kill NName;
     3593  tmp[1]      = "C";
     3594  Lord[2]     = tmp;  tmp = 0;
     3595  L[3]        = Lord;
     3596  // we are done with the list. Now add a Plural part
     3597  def @R2@ = ring(L);
     3598  setring @R2@;
     3599  matrix @D[Nnew][Nnew];
     3600  for (i=1; i<=N; i++)
     3601  {
     3602    @D[i,N+i]=-1;
     3603  }
     3604  def @R2 = nc_algebra(1,@D);
     3605  setring @R2;
     3606  kill @R2@;
     3607  dbprint(ppl,"//  -2-1- the ring @R2(_Dx,_x,s) is ready");
     3608  dbprint(ppl-1, @R2);
     3609  ideal MM = maxideal(1);
     3610  MM = 0,s,MM;
     3611  map R01 = @R, MM;
     3612  ideal K = R01(K);
     3613  // total cleanup
     3614  poly F = imap(save, F);
     3615  ideal LD = K,F;
     3616  dbprint(ppl,"//  -2-2- start GB computations for Ann f^s + f");
     3617  dbprint(ppl-1, LD);
     3618  LD = engine(LD,eng);
     3619  dbprint(ppl,"//  -2-3- finished GB computations for Ann f^s + f");
     3620  dbprint(ppl-1, LD);
     3621  // make leadcoeffs positive
     3622  for (i=1; i<= ncols(LD); i++)
     3623  {
     3624    if (leadcoef(LD[i]) <0 )
     3625    {
     3626      LD[i] = -LD[i];
     3627    }
     3628  }
     3629  export LD;
     3630  kill @R;
     3631  return(@R2);
     3632}
     3633example
     3634{
     3635  "EXAMPLE:"; echo = 2;
     3636  ring r = 0,(x,y,z,w),Dp;
     3637  poly F = x^3+y^3+z^3*w;
     3638  printlevel = 0;
     3639  def A = SannfsBFCT(F);
     3640  setring A;
     3641  intvec v = 1,2,3,4,5,6,7,8;
     3642  // are there polynomials, depending on s only?
     3643  nselect(LD,v);
     3644  // a fancier example:
     3645  def R = reiffen(4,5);
     3646  setring R;
     3647  v = 1,2,3,4;
     3648  def B = SannfsBFCT(RC);
     3649  setring B;
     3650  // are there polynomials, depending on s only?
     3651  nselect(LD,v);
     3652  // it is not the case. Are there leading monomials in s only?
     3653  nselect(lead(LD),v);
    33233654}
    33243655
     
    51315462
    51325463
    5133 
    51345464static proc exCheckGenericity()
    51355465{
Note: See TracChangeset for help on using the changeset viewer.