Changeset dfb2c6 in git for Singular/LIB/bfun.lib
- Timestamp:
- Mar 6, 2009, 9:32:29 PM (15 years ago)
- Branches:
- (u'spielwiese', 'fe61d9c35bf7c61f2b6cbf1b56e25e2f08d536cc')
- Children:
- fda698647a5a06bd263906206d3ce89a87b42c0d
- Parents:
- 2a5ce368e94b24f2bbac34de08062477cb206040
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
Singular/LIB/bfun.lib
r2a5ce36 rdfb2c6 1 1 ////////////////////////////////////////////////////////////////////////////// 2 version="$Id: bfun.lib,v 1. 2 2009-02-23 15:10:18 SingularExp $";2 version="$Id: bfun.lib,v 1.3 2009-03-06 20:32:28 levandov Exp $"; 3 3 category="Noncommutative"; 4 4 info=" … … 9 9 THEORY: Given a polynomial ring R = K[x_1,...,x_n] and a polynomial F in R, 10 10 @* one is interested in the global b-Function (also known as Bernstein-Sato 11 @* polynomial) b(s) in K[s], defined to be the monic polynomial, satisfying a functional 12 @* identity L * F^{s+1} = b(s) F^s, for some operator L in D[s]. Here, D stands for an 13 @* n-th Weyl algebra K<x_1,...,x_n,d_1,...,d_n | d_j x_j = x_j d_j +1>. 11 @* polynomial) b(s) in K[s], defined to be the monic polynomial, satisfying 12 @* a functional identity L * F^{s+1} = b(s) F^s, 13 @* for some operator L in D[s]. Here, D stands for an n-th Weyl algebra 14 @* K<x_1,...,x_n,d_1,...,d_n | d_j x_j = x_j d_j +1>. 14 15 @* One is interested in the following data: 15 16 @* - Bernstein-Sato polynomial b(s) in K[s], 16 17 @* - the list of its roots, which are known to be rational 17 18 @* - the multiplicities of the roots. 18 @* References: Saito, Sturmfels, Takayama: Groebner Deformations of Hypergeometric 19 @* Differential Equations (2000), Noro: An Efficient Modular Algorithm for Computing 20 @* the Global b-function, (2002). 19 @* 20 @* There is a general definition of a b-function of a holonomic ideal [SST] 21 @* (that is, an ideal I in a Weyl algebra D, such that D/I is holonomic module) 22 @* with respect to the given weight vector. B-function b_w(s) is in K[s]. 23 @* Unlike Bernstein-Sato polynomial, general B-function with respect to 24 @* arbitrary weights need not have rational roots at all. 25 @* 26 @* References: [SST] Saito, Sturmfels, Takayama: Groebner Deformations of 27 @* Hypergeometric Differential Equations (2000), 28 @* Noro: An Efficient Modular Algorithm for Computing the Global b-function, 29 @* (2002). 21 30 22 31 … … 27 36 bfctAnn(f[,s]); computes the Bernstein-Sato polynomial of poly f 28 37 bfctOneGB(f[,s,t]); computes the Bernstein-Sato polynomial of poly f 29 bfctIdeal(I,w[,s,t]); computes the global b-function of ideal I w.r.t. the weight w30 pIntersect(f,I ); intersection of the ideal I with the subalgebra K[f] for apoly f31 pIntersectSyz(f,I[,p,s,t]); intersection of the ideal I with the subalgebra K[f] for apoly f38 bfctIdeal(I,w[,s,t]); computes the global b-function of ideal wrt weight 39 pIntersect(f,I[,s]); intersection of ideal with subalgebra K[f] for poly f 40 pIntersectSyz(f,I[,p,s,t]); intersection of ideal with subalgebra K[f] for poly f 32 41 linReduce(f,I[,s]); reduces a poly by linear reductions only 33 42 linReduceIdeal(I,[s,t]); reduces generators of ideal by linear reductions only 34 linSyzSolve(I[,s]); computes a linear dependency of theelements of ideal I43 linSyzSolve(I[,s]); computes a linear dependency of elements of ideal I 35 44 36 45 AUXILIARY PROCEDURES: … … 47 56 LIB "dmod.lib"; // for SannfsBFCT etc 48 57 LIB "dmodapp.lib"; // for initialIdealW etc 49 58 LIB "nctools.lib"; // for isWeyl etc 50 59 51 60 /////////////////////////////////////////////////////////////////////////////// … … 83 92 " 84 93 { 94 // todo check assumption 85 95 int i; 86 96 def save = basering; … … 137 147 } 138 148 149 static proc safeVarName (string s) 150 { 151 string cv = "," + charstr(basering) + "," + varstr(basering) + ","; 152 s = "," + s + ","; 153 while (find(cv,s) <> 0) 154 { 155 s[1] = "@"; 156 s = "," + s; 157 } 158 s = s[2..size(s)-1]; 159 return(s) 160 } 139 161 140 162 proc allPositive (intvec v) … … 167 189 static proc findFirst (list l, i) 168 190 "USAGE: findFirst(l,i); l a list, i an argument of any type 169 RETURN: int, the position of the first appearance of i in l, or 0 if i is not a member of l 191 RETURN: int, the position of the first appearance of i in l, 192 @* or 0 if i is not a member of l 170 193 PURPOSE: check whether the second argument is a member of a list 171 194 EXAMPLE: example findFirst; shows an example … … 230 253 "USAGE: linReduceIdeal(I [,s,t,u]); I an ideal, s,t,u optional ints 231 254 RETURN: ideal or list, linear reductum (over field) of I by its elements 232 PURPOSE: reduce a list of polys only by linear reductions (no monomial multiplications) 233 NOTE: If s<>0, a list consisting of the reduced ideal and the coefficient 255 PURPOSE: reduces a list of polys only by linear reductions (no monomial 256 @* multiplications) 257 NOTE: If s<>0, a list consisting of the reduced ideal and the coefficient 234 258 @* vectors of the used reductions given as module is returned. 235 259 @* Otherwise (and by default), only the reduced ideal is returned. … … 237 261 @* otherwise, only leading monomials are reduced. 238 262 @* If u<>0 (and by default), the ideal is first sorted in increasing order. 239 @* If u is set to 0 and the given ideal is not sorted in the way described, 263 @* If u is set to 0 and the given ideal is not sorted in the way described, 240 264 @* the result might not be as expected. 241 265 DISPLAY: If @code{printlevel}=1, progress debug messages will be printed, … … 327 351 } 328 352 } 329 dbprint(ppl-1," initially sorted ideal:", I);330 if (remembercoeffs <> 0) { dbprint(ppl-1," used permutations:", M); }353 dbprint(ppl-1,"// initially sorted ideal:", I); 354 if (remembercoeffs <> 0) { dbprint(ppl-1,"// used permutations:", M); } 331 355 // step 2: reduce leading monomials by linear reductions 332 356 poly lm,c,redpoly,maxlmJ; … … 358 382 if (lm == lmJ[j]) 359 383 { 360 dbprint(ppl-1," reducing " + string(redpoly));361 dbprint(ppl-1," with " + string(J[j]));384 dbprint(ppl-1,"// reducing " + string(redpoly)); 385 dbprint(ppl-1,"// with " + string(J[j])); 362 386 c = leadcoef(redpoly)/leadcoef(J[j]); 363 387 redpoly = redpoly - c*J[j]; 364 dbprint(ppl-1," to " + string(redpoly));388 dbprint(ppl-1,"// to " + string(redpoly)); 365 389 lm = leadmonom(redpoly); 366 390 ordlm = ord(lm); … … 390 414 if (redtail <> 0) 391 415 { 392 dbprint(ppl," finished reducing leading monomials");416 dbprint(ppl,"// finished reducing leading monomials"); 393 417 dbprint(ppl-1,string(J)); 394 if (remembercoeffs <> 0) { dbprint(ppl-1," used reductions:" + string(M)); }418 if (remembercoeffs <> 0) { dbprint(ppl-1,"// used reductions:" + string(M)); } 395 419 int k; 396 420 for (i=sZeros+1; i<=sI; i++) … … 406 430 { 407 431 c = leadcoef(J[j][k])/leadcoef(J[i]); 408 dbprint(ppl-1," reducing " + string(J[j]));409 dbprint(ppl-1," with " + string(J[i]));432 dbprint(ppl-1,"// reducing " + string(J[j])); 433 dbprint(ppl-1,"// with " + string(J[i])); 410 434 J[j] = J[j] - c*J[i]; 411 dbprint(ppl-1," to " + string(J[j]));435 dbprint(ppl-1,"// to " + string(J[j])); 412 436 if (remembercoeffs <> 0) { M[j] = M[j] - c * M[i]; } 413 437 } … … 442 466 @* If t<>0 (and by default) all monomials are reduced (if possible), 443 467 @* otherwise, only leading monomials are reduced. 444 @* If u<>0 (and by default), the ideal is linearly pre-reduced, i.e. instead445 @* of the given ideal, the output of @code{linReduceIdeal} is used. If u is446 @* set to 0 and the given ideal does not equal the output of447 @* @code{linReduceIdeal}, the result might not be as expected. 468 @* If u<>0 (and by default), the ideal is linearly pre-reduced, i.e. 469 @* instead of the given ideal, the output of @code{linReduceIdeal} is used. 470 @* If u is set to 0 and the given ideal does not equal the output of 471 @* @code{linReduceIdeal}, the result might not be as expected. 448 472 DISPLAY: If @code{printlevel}=1, progress debug messages will be printed, 449 473 @* if printlevel>=2, all the debug messages will be printed. … … 487 511 I = sortedI[1]; 488 512 M = sortedI[2]; 489 dbprint(ppl-1," prepared ideal:",I);490 dbprint(ppl-1," with operations:",M);513 dbprint(ppl-1,"// prepared ideal:" +string(I)); 514 dbprint(ppl-1,"// with operations:" +string(M)); 491 515 } 492 516 else { I = linReduceIdeal(I,0,redtail); } … … 532 556 if (redtail <> 0) 533 557 { 534 dbprint(ppl," finished reducing leading monomials");558 dbprint(ppl,"// finished reducing leading monomials"); 535 559 dbprint(ppl-1,string(f)); 536 if (remembercoeffs <> 0) { dbprint(ppl-1," used reductions:" + string(v)); }560 if (remembercoeffs <> 0) { dbprint(ppl-1,"// used reductions:" + string(v)); } 537 561 for (i=1; i<=sI; i++) 538 562 { 539 dbprint(ppl," testing ideal entry:",i);563 dbprint(ppl,"// testing ideal entry "+string(i)); 540 564 for (j=1; j<=size(f); j++) 541 565 { … … 546 570 c = leadcoef(f[j])/lcI[i]; 547 571 f = f - c*I[i]; 548 dbprint(ppl-1," reducing with " + string(I[i]));549 dbprint(ppl-1," to " + string(f));572 dbprint(ppl-1,"// reducing with " + string(I[i])); 573 dbprint(ppl-1,"// to " + string(f)); 550 574 if (remembercoeffs <> 0) { v = v - c * M[i]; } 551 575 } … … 581 605 proc linSyzSolve (ideal I, list #) 582 606 "USAGE: linSyzSolve(I[,s]); I an ideal, s an optional int 583 RETURN: vector, coefficient vector of a linear combination of 0 in theelements of I607 RETURN: vector, coefficient vector of linear combination of 0 in elements of I 584 608 PURPOSE: compute a linear dependency between the elements of an ideal 585 609 @* if such one exists … … 613 637 // ------- 1. introduce undefined coeffs ------------------ 614 638 def save = basering; 639 list RL = ringlist(save); 640 int nv = nvars(save); 641 int np = npars(save); 615 642 int p = char(save); 643 string cs = "(" + charstr(save) + ")"; 616 644 if (enginespecified == 0) 617 645 { … … 621 649 } 622 650 } 623 ring @A = p,(@a(1..sI)),lp; 624 ring @aA = (p,@a(1..sI)), (@z),dp; 625 // TODO: BUG! WHAT IF THE ORIGINAL RING ALREADY HAS SUCH VARIABLES/PARAMETERS!!!? 626 // TODO: YOU CAN OVERCOME THIS BY MEANS SIMILAR TO "chooseSafeVarName" FROM NEW "matrix.lib" 651 int i; 652 list Lvar; 653 for (i=1; i<=sI; i++) 654 { 655 Lvar[i] = safeVarName("@a(" + string(i) + ")"); 656 } 657 list L@A = RL[1..4]; 658 L@A[2] = Lvar; 659 L@A[3] = list(list("lp",intvec(1:sI)),list("C",intvec(0))); 660 def @A = ring(L@A); 661 L@A[2] = list(safeVarName("@z")); 662 L@A[3][1] = list("dp",intvec(1)); 663 if (size(L@A[1])>1) 664 { 665 L@A[1][2] = L@A[1][2] + Lvar; 666 L@A[1][3][size(L@A[1][3])+1] = list("lp",intvec(1:sI)); 667 } 668 else 669 { 670 L@A[1] = list(p,Lvar,list(list("lp",intvec(1:sI))),ideal(0)); 671 } 672 def @aA = ring(L@A); 627 673 def @B = save + @aA; 628 674 setring @B; 629 675 ideal I = imap(save,I); 630 676 // ------- 2. form the linear system for the undef coeffs --- 631 int i;poly W; ideal QQ;677 poly W; ideal QQ; 632 678 for (i=1; i<=sI; i++) 633 679 { 634 W = W + @a(i)*I[i];680 W = W + par(np+i)*I[i]; 635 681 } 636 682 while (W!=0) … … 643 689 ideal QQ = imap(@B,QQ); 644 690 // ------- 3. this QQ is a polynomial ideal, so "solve" the system ----- 645 dbprint(ppl, " linSyzSolve: starting Groebner basis computation with engine:", whichengine);691 dbprint(ppl, "// linSyzSolve: starting Groebner basis computation with engine:", whichengine); 646 692 QQ = engine(QQ,whichengine); 647 dbprint(ppl, " QQ after engine:", QQ);693 dbprint(ppl, "// QQ after engine:", QQ); 648 694 if (dim(QQ) == -1) 649 695 { 650 dbprint(ppl+1, " no solutions by linSyzSolve");696 dbprint(ppl+1, "// no solutions by linSyzSolve"); 651 697 // output zeroes 652 698 setring save; … … 658 704 module MQQ = std(module(QQ)); 659 705 AA = NF(AA,MQQ); // todo: we still receive NF warnings 660 dbprint(ppl, " AA after NF:",AA);706 dbprint(ppl, "// AA after NF:",AA); 661 707 // "AA after NF:"; print(AA); 662 708 for(i=1; i<=sI; i++) … … 664 710 AA = subst(AA,var(i),1); 665 711 } 666 dbprint(ppl, " AA after subst:",AA);712 dbprint(ppl, "// AA after subst:",AA); 667 713 // "AA after subst: "; print(AA); 668 714 vector v = (module(transpose(AA)))[1]; … … 687 733 RETURN: vector, coefficient vector of the monic polynomial 688 734 PURPOSE: compute the intersection of ideal I with the subalgebra K[f] 689 ASSUME: I is given as Groebner basis .735 ASSUME: I is given as Groebner basis, basering is not a qring. 690 736 NOTE: If the intersection is zero, this proc might not terminate. 691 737 @* If s>0 is given, it is searched for the generator of the intersection … … 696 742 " 697 743 { 744 def save = basering; 745 int n = nvars(save); 746 list RL = ringlist(save); 747 int i,j,k; 748 if (RL[4]<>0) 749 { 750 ERROR ("basering must not be a qring"); 751 } 698 752 // assume I is given in Groebner basis 699 753 if (attrib(I,"isSB") <> 1) 700 754 { 701 print(" WARNING: The input has no SB attribute!");702 print(" Treating it as if it were a Groebner basis and proceeding...");755 print("// WARNING: The input has no SB attribute!"); 756 print("// Treating it as if it were a Groebner basis and proceeding..."); 703 757 attrib(I,"isSB",1); // set attribute for suppressing NF messages 704 758 } … … 711 765 } 712 766 } 713 int ppl = printlevel-voice+ 1;767 int ppl = printlevel-voice+2; 714 768 // ---case 1: I = basering--- 715 769 if (size(I) == 1) … … 717 771 if (simplify(I,2)[1] == 1) 718 772 { 719 return(gen(2)); // = s 720 } 721 } 722 def save = basering; 723 int n = nvars(save); 724 int i,j,k; 773 return(gen(1)); // = 1 774 } 775 } 725 776 // ---case 2: intersection is zero--- 726 777 intvec degs = leadexp(s); … … 752 803 return(vector(0)); 753 804 } 754 dbprint(ppl,"a lower bound for the degree of the insection is:"); 755 dbprint(ppl,degbound); 805 dbprint(ppl,"// lower bound for the degree of the insection is " +string(degbound)); 756 806 if (degbound == 0) // lm(s) does not appear in lm(I) 757 807 { … … 766 816 poly toNF,tobracket,newNF,rednewNF,oldNF,secNF; 767 817 i = 1; 768 dbprint(ppl+1,"pIntersect starts...");769 818 while (1) 770 819 { 771 820 if (bound>0 && i>bound) { return(vector(0)); } 772 dbprint(ppl," testing degree:"+string(i));821 dbprint(ppl,"// Testing degree "+string(i)); 773 822 if (i>1) 774 823 { … … 793 842 rednewNF = ll[1]; 794 843 l[i+1] = ll[2]; 795 dbprint(ppl ,"newNF is:", newNF);796 dbprint(ppl ,"rednewNF is:", rednewNF);844 dbprint(ppl-1,"// newNF is: "+string(newNF)); 845 dbprint(ppl-1,"// rednewNF is: "+string(rednewNF)); 797 846 if (rednewNF != 0) // no linear dependency 798 847 { … … 802 851 else // there is a linear dependency, hence we are done 803 852 { 804 dbprint(ppl +1,"the degree of the generator of the intersection is:", i);853 dbprint(ppl,"// degree of the generator of the intersection is: "+string(i)); 805 854 break; 806 855 } 807 856 } 808 dbprint(ppl,"used linear reductions:", l); 809 // we obtain the coefficients of the generator of the intersection by the used reductions: 810 ring @R = 0,(a(1..i+1)),dp; 811 setring @R; 857 dbprint(ppl-1,"// used linear reductions:", l); 858 // we obtain the coefficients of the generator by the used reductions: 859 list Lvar; 860 for (j=1; j<=i+1; j++) 861 { 862 Lvar[j] = safeVarName("a("+string(j)+")"); 863 } 864 list Lord = list("dp",intvec(1:(i+1))),list("C",intvec(0)); 865 list L@R = RL[1..4]; 866 L@R[2] = Lvar; L@R[3] = Lord; 867 def @R = ring(L@R); setring @R; 812 868 list l = imap(save,l); 813 869 ideal C; … … 817 873 for (k=1;k<=j;k++) 818 874 { 819 C[j] = C[j]+l[j][k]* a(k);875 C[j] = C[j]+l[j][k]*var(k); 820 876 } 821 877 } 822 878 for (j=i;j>=1;j--) 823 879 { 824 C[i+1]= subst(C[i+1], a(j),a(j)+C[j]);880 C[i+1]= subst(C[i+1],var(j),var(j)+C[j]); 825 881 } 826 882 matrix m = coeffs(C[i+1],maxideal(1)); … … 833 889 v = imap(@R,v); 834 890 kill @R; 835 dbprint(ppl+1,"pIntersect finished");836 891 return(v); 837 892 } … … 849 904 850 905 proc pIntersectSyz (poly s, ideal II, list #) 851 "USAGE: pIntersectSyz(f, I [,p,s,t]); f a poly, I an ideal, p, t optial ints, p a prime number906 "USAGE: pIntersectSyz(f, I [,p,s,t]); f poly, I ideal, p,t optial ints, p prime 852 907 RETURN: vector, coefficient vector of the monic polynomial 853 908 PURPOSE: compute the intersection of an ideal I with the subalgebra K[f] 854 ASSUME: I is given as Groebner basis .909 ASSUME: I is given as Groebner basis, basering is free of parameters. 855 910 NOTE: If the intersection is zero, this procedure might not terminate. 856 @* If p>0 is given, this proc computes the generator of the intersection in char p first 857 @* and then only searches for a generator of the obtained degree in the basering. 858 @* Otherwise, it searched for all degrees by computing syzygies. 911 @* If p>0 is given, this proc computes the generator of the intersection in 912 @* char p first and then only searches for a generator of the obtained 913 @* degree in the basering. Otherwise, it searched for all degrees by 914 @* computing syzygies. 859 915 @* If s<>0, @code{std} is used for Groebner basis computations in char 0, 860 916 @* otherwise, and by default, @code{slimgb} is used. 861 @* If t<>0 and by default, @code{std} is used for Groebner basis computations in char >0,862 @* otherwise, @code{slimgb} is used.917 @* If t<>0 and by default, @code{std} is used for Groebner basis 918 @* computations in char >0, otherwise, @code{slimgb} is used. 863 919 DISPLAY: If printlevel=1, progress debug messages will be printed, 864 920 @* if printlevel>=2, all the debug messages will be printed. … … 870 926 if (attrib(I,"isSB") <> 1) 871 927 { 872 print(" WARNING: The input has no SB attribute!");873 print(" Treating it as if it were a Groebner basis and proceeding...");928 print("// WARNING: The input has no SB attribute!"); 929 print("// Treating it as if it were a Groebner basis and proceeding..."); 874 930 attrib(I,"isSB",1); // set attribute for suppressing NF messages 875 931 } … … 920 976 setring Rp; 921 977 kill @Rp; 922 dbprint(ppl+1," solving in ring ", Rp);978 dbprint(ppl+1,"// solving in ring ", Rp); 923 979 vector v; 924 980 map phi = save,maxideal(1); … … 928 984 } 929 985 i = 1; 930 dbprint(ppl+1," pIntersectSyz starts...");931 dbprint(ppl+1," with ideal I=", I);986 dbprint(ppl+1,"// pIntersectSyz starts..."); 987 dbprint(ppl+1,"// with ideal I=", I); 932 988 while (1) 933 989 { 934 dbprint(ppl," i:"+string(i));990 dbprint(ppl,"// i:"+string(i)); 935 991 if (i>1) 936 992 { … … 948 1004 } 949 1005 // look for a solution 950 dbprint(ppl," linSyzSolve starts with: "+string(matrix(NI)));1006 dbprint(ppl,"// linSyzSolve starts with: "+string(matrix(NI))); 951 1007 if (solveincharp<>0) // modular method 952 1008 { … … 956 1012 if (v!=0) // there is a modular solution 957 1013 { 958 dbprint(ppl," got solution in char ",solveincharp," of degree " ,i);1014 dbprint(ppl,"// got solution in char "+string(solveincharp)+" of degree "+string(i)); 959 1015 setring save; 960 1016 v = linSyzSolve(NI,whichengine); … … 975 1031 } 976 1032 matrix MM[1][nrows(v)] = matrix(v); 977 dbprint(ppl," linSyzSolve ready with: "+string(MM));1033 dbprint(ppl,"// linSyzSolve ready with: "+string(MM)); 978 1034 kill MM; 979 1035 // "linSyzSolve ready with"; print(v); … … 989 1045 if (p!=0) 990 1046 { 991 dbprint(ppl," linSyzSolve: bad solution!");1047 dbprint(ppl,"// linSyzSolve: bad solution!"); 992 1048 } 993 1049 else 994 1050 { 995 dbprint(ppl," linSyzSolve: got solution!");1051 dbprint(ppl,"// linSyzSolve: got solution!"); 996 1052 // "got solution!"; 997 1053 break; … … 1001 1057 i++; 1002 1058 } 1003 dbprint(ppl+1," pIntersectSyz finished");1059 dbprint(ppl+1,"// pIntersectSyz finished"); 1004 1060 return(v); 1005 1061 } … … 1088 1144 } 1089 1145 int substitution = int(#[2]); 1090 ring S = 0,s,dp; 1146 string s = safeVarName("s"); 1147 list RL = ringlist(save); RL = RL[1..4]; 1148 RL[2] = list(s); RL[3] = list(list("dp",intvec(1)),list("C",0)); 1149 def S = ring(RL); setring S; 1091 1150 ideal J; 1092 1151 for (i=1; i<=n; i++) 1093 1152 { 1094 J[i] = s;1153 J[i] = var(1); 1095 1154 } 1096 1155 map @m = save,J; … … 1098 1157 if (substitution == 1) 1099 1158 { 1100 p = subst(p, s,-s-1);1159 p = subst(p,var(1),-var(1)-1); 1101 1160 } 1102 1161 // the rest of this proc is nicked from bernsteinBM from dmod.lib 1103 1162 list P = factorize(p);//with constants and multiplicities 1104 ideal bs; intvec m; //the B ernstein polynomialis monic, so we are not interested in constants1163 ideal bs; intvec m; //the BS poly is monic, so we are not interested in constants 1105 1164 for (i=2; i<= size(P[1]); i++) //we delete P[1][1] and P[2][1] 1106 1165 { … … 1109 1168 } 1110 1169 bs = normalize(bs); 1111 bs = -subst(bs, s,0);1170 bs = -subst(bs,var(1),0); 1112 1171 setring save; 1113 1172 ideal bs = imap(S,bs); … … 1123 1182 def save = basering; 1124 1183 int n = nvars(save); 1184 if (isCommutative() == 0) { ERROR("basering must be commutative"); } 1185 if (char(save) <> 0) { ERROR("characteristic of basering has to be 0"); } 1186 list L = ringlist(save); 1187 int qr; 1188 if (L[4] <> 0) // qring 1189 { 1190 print("// basering is qring:"); 1191 print("// discarding the quotient and proceeding..."); 1192 L[4] = 0; 1193 qr = 1; 1194 def save2 = ring(L); 1195 setring save2; 1196 poly f = imap(save,f); 1197 } 1125 1198 if (size(variables(f)) == 0) // f is constant 1126 1199 { … … 1129 1202 if (inorann == 0) // bfct using initial ideal 1130 1203 { 1131 def D = initialMalgrange(f,whichengine,methodord, 1,u0);1204 def D = initialMalgrange(f,whichengine,methodord,u0); 1132 1205 setring D; 1133 1206 ideal J = inF; … … 1154 1227 while (b == 0) 1155 1228 { 1156 dbprint(ppl," number of run in the loop: "+string(i));1229 dbprint(ppl,"// number of run in the loop: "+string(i)); 1157 1230 int q = prime(random(lb,ub)); 1158 1231 if (findFirst(usedprimes,q)==0) // if q was not already used 1159 1232 { 1160 1233 usedprimes = usedprimes,q; 1161 dbprint(ppl," used prime is: "+string(q));1234 dbprint(ppl,"// used prime is: "+string(q)); 1162 1235 b = pIntersectSyz(s,J,q,whichengine,modengine); 1163 1236 } … … 1174 1247 b = pIntersect(s,J); 1175 1248 } 1176 setring save; 1249 if (qr == 1) { setring save2; } 1250 else { setring save; } 1177 1251 vector b = imap(D,b); 1178 if (inorann == 0) 1179 { 1180 list l = listofroots(b,1); 1181 } 1182 else 1183 { 1184 list l = listofroots(b,0); 1252 if (inorann == 0) { list l = listofroots(b,1); } 1253 else { list l = listofroots(b,0); } 1254 if (qr == 1) 1255 { 1256 setring save; 1257 list l = imap(save2,l); 1185 1258 } 1186 1259 return(l); … … 1192 1265 PURPOSE: computes the roots of the Bernstein-Sato polynomial b(s) 1193 1266 @* for the hypersurface defined by f. 1194 ASSUME: The basering is a commutative polynomial ring in char 0. 1195 BACKGROUND: In this proc, the initial Malgrange ideal is computed according to the algorithm 1196 @* by Masayuki Noro and then a system of linear equations is solved by linear reductions. 1267 ASSUME: The basering is commutative and of characteristic 0. 1268 BACKGROUND: In this proc, the initial Malgrange ideal is computed according to 1269 @* the algorithm by Masayuki Noro and then a system of linear equations is 1270 @* solved by linear reductions. 1197 1271 NOTE: In the output list, the ideal contains all the roots 1198 1272 @* and the intvec their multiplicities. … … 1201 1275 @* If t<>0, a matrix ordering is used for Groebner basis computations, 1202 1276 @* otherwise, and by default, a block ordering is used. 1203 @* If v is a positive weight vector, v is used for homogenization computations,1204 @* otherwise and by default, no weights are used.1277 @* If v is a positive weight vector, v is used for homogenization 1278 @* computations, otherwise and by default, no weights are used. 1205 1279 DISPLAY: If printlevel=1, progress debug messages will be printed, 1206 1280 @* if printlevel>=2, all the debug messages will be printed. … … 1253 1327 1254 1328 proc bfctSyz (poly f, list #) 1255 "USAGE: bfctSyz(f [,r,s,t,u,v]); f a poly, r,s,t,u optional ints, v an optionalintvec1329 "USAGE: bfctSyz(f [,r,s,t,u,v]); f poly, r,s,t,u optional ints, v opt. intvec 1256 1330 RETURN: list of ideal and intvec 1257 PURPOSE: computes the roots of the Bernstein-Sato polynomial b(s) 1331 PURPOSE: computes the roots of the Bernstein-Sato polynomial b(s) 1258 1332 @* for the hypersurface defined by f 1259 ASSUME: The basering is a commutative polynomial ring in char 0. 1260 BACKGROUND: In this proc, the initial Malgrange ideal is computed according to the algorithm 1261 @* by Masayuki Noro and then a system of linear equations is solved by computing syzygies. 1262 NOTE: In the output list, the ideal contains all the roots 1263 @* and the intvec their multiplicities. 1264 @* If r<>0, @code{std} is used for GB computations in characteristic 0, 1265 @* otherwise, and by default, @code{slimgb} is used. 1266 @* If s<>0, a matrix ordering is used for GB computations, otherwise, 1333 ASSUME: The basering is commutative and of characteristic 0. 1334 BACKGROUND: In this proc, the initial Malgrange ideal is computed according to 1335 @* the algorithm by Masayuki Noro and then a system of linear equations is 1336 @* solved by computing syzygies. 1337 NOTE: In the output list, the ideal contains all the roots and the intvec 1338 @* their multiplicities. 1339 @* If r<>0, @code{std} is used for GB computations in characteristic 0, 1340 @* otherwise, and by default, @code{slimgb} is used. 1341 @* If s<>0, a matrix ordering is used for GB computations, otherwise, 1267 1342 @* and by default, a block ordering is used. 1268 @* If t<>0, the computation of the intersection is solely performed over 1343 @* If t<>0, the computation of the intersection is solely performed over 1269 1344 @* charasteristic 0, otherwise and by default, a modular method is used. 1270 @* If u<>0 and by default, @code{std} is used for GB computations in 1271 @* characteristic >0, otherwise, @code{slimgb} is used. 1272 @* If v is a positive weight vector, v is used for homogenization 1345 @* If u<>0 and by default, @code{std} is used for GB computations in 1346 @* characteristic >0, otherwise, @code{slimgb} is used. 1347 @* If v is a positive weight vector, v is used for homogenization 1273 1348 @* computations, otherwise and by default, no weights are used. 1274 1349 DISPLAY: If printlevel=1, progress debug messages will be printed, … … 1285 1360 // and one for the engine used for Groebner basis computations in char >0 1286 1361 // in # can also be the optional weight vector 1287 def save = basering; 1288 int n = nvars(save); 1362 int n = nvars(basering); 1289 1363 int whichengine = 0; // default 1290 1364 int methodord = 0; // default … … 1343 1417 "USAGE: bfctIdeal(I,w[,s,t]); I an ideal, w an intvec, s,t optional ints 1344 1418 RETURN: list of ideal and intvec 1345 PURPOSE: computes the roots of the global b-function of I wrt the weight vector (-w,w). 1346 ASSUME: The basering is the n-th Weyl algebra in char 0, where the sequence of 1347 @* the variables is x(1),...,x(n),D(1),...,D(n). 1348 BACKGROUND: In this proc, the initial ideal of I is computed according to the algorithm by 1349 @* Masayuki Noro and then a system of linear equations is solved by linear reductions. 1350 NOTE: In the output list, the ideal contains all the roots 1351 @* and the intvec their multiplicities. 1419 PURPOSE: computes the roots of the global b-function of I wrt the weight (-w,w). 1420 ASSUME: The basering is the n-th Weyl algebra in characteristic 0 and for all 1421 @* 1<=i<=n the identity var(i+n)*var(i)=var(i)*var(i+1)+1 holds, i.e. the 1422 @* sequence of variables is given by x(1),...,x(n),D(1),...,D(n), 1423 @* where D(i) is the differential operator belonging to x(i). 1424 @* Further assume that I is holonomic. 1425 BACKGROUND: In this proc, the initial ideal of I is computed according to the 1426 @* algorithm by Masayuki Noro and then a system of linear equations is 1427 @* solved by linear reductions. 1428 NOTE: In the output list, the ideal contains all the roots and the intvec 1429 @* their multiplicities. 1352 1430 @* If s<>0, @code{std} is used for GB computations in characteristic 0, 1353 1431 @* otherwise, and by default, @code{slimgb} is used. … … 1379 1457 } 1380 1458 } 1459 if (isWeyl()==0) { ERROR("basering is not a Weyl algebra"); } 1460 for (i=1; i<=n; i++) 1461 { 1462 if (bracket(var(i+n),var(i))<>1) 1463 { 1464 ERROR(string(var(i+n))+" is not a differential operator for " +string(var(i))); 1465 } 1466 } 1467 int isH = isHolonomic(I); 1468 if (isH<>1) 1469 { 1470 print("// given ideal is not holonomic"); 1471 print("// setting bound for degree of b-fubction to 10 and proceeding"); 1472 isH = 10; 1473 } 1474 else { isH = 0; } // no degree bound for pIntersect 1381 1475 ideal J = initialIdealW(I,-w,w,whichengine,methodord); 1382 1476 poly s; … … 1385 1479 s = s + w[i]*var(i)*var(n+i); 1386 1480 } 1387 vector b = pIntersect(s,J); 1388 list l = listofroots(b,0); 1481 vector b = pIntersect(s,J,isH); 1482 list RL = ringlist(save); RL = RL[1..4]; 1483 RL[2] = list(safeVarName("s")); 1484 RL[3] = list(list("dp",intvec(1)),list("C",intvec(0))); 1485 def @S = ring(RL); setring @S; 1486 vector b = imap(save,b); 1487 poly bs = vec2poly(b); 1488 list l = bFactor(bs); 1489 setring save; 1490 list l = imap(@S,l); 1389 1491 return(l); 1390 1492 } … … 1407 1509 "USAGE: bfctOneGB(f [,s,t]); f a poly, s,t optional ints 1408 1510 RETURN: list of ideal and intvec 1409 PURPOSE: computes the roots of the Bernstein-Sato polynomial b(s) for the 1511 PURPOSE: computes the roots of the Bernstein-Sato polynomial b(s) for the 1410 1512 @* hypersurface defined by f, using only one GB computation 1411 ASSUME: The basering is a commutative polynomial ring in char0.1412 BACKGROUND: In this proc, the initial Malgrange ideal is computed based on the 1513 ASSUME: The basering is commutative and of characteristic 0. 1514 BACKGROUND: In this proc, the initial Malgrange ideal is computed based on the 1413 1515 @* algorithm by Masayuki Noro and combined with an elimination ordering. 1414 NOTE: In the output list, the ideal contains all the roots 1415 @* and the intvectheir multiplicities.1516 NOTE: In the output list, the ideal contains all the roots and the intvec 1517 @* their multiplicities. 1416 1518 @* If s<>0, @code{std} is used for the GB computation, otherwise, 1417 1519 @* and by default, @code{slimgb} is used. … … 1424 1526 { 1425 1527 int ppl = printlevel - voice +2; 1528 if (isCommutative() == 0) { ERROR("basering must be commutative"); } 1426 1529 def save = basering; 1427 1530 int n = nvars(save); 1531 if (char(save) <> 0) 1532 { 1533 ERROR("characteristic of basering has to be 0"); 1534 } 1535 list L = ringlist(save); 1536 int qr; 1537 if (L[4] <> 0) // qring? 1538 { 1539 print("// basering is qring:"); 1540 print("// discarding the quotient and proceeding..."); 1541 L[4] = 0; 1542 qr = 1; 1543 def save2 = ring(L); 1544 setring save2; 1545 poly f = imap(save,f); 1546 } 1428 1547 int noofvars = 2*n+4; 1429 1548 int i; … … 1454 1573 if (methodord == 0) // default: block ordering 1455 1574 { 1456 ring Dh = 0,(t,s,x(n..1),Dt,D(n..1),h),(a(@a),a(@a2),a(uv),dp(noofvars-1),lp(1));1575 ring @Dh = 0,(t,s,x(n..1),Dt,D(n..1),h),(a(@a),a(@a2),a(uv),dp(noofvars-1),lp(1)); 1457 1576 } 1458 1577 else // M() ordering … … 1465 1584 @Ord[2+i,noofvars - i] = -1; 1466 1585 } 1467 dbprint(ppl," weights for ordering:",transpose(@a));1468 dbprint(ppl," the ordering matrix:",@Ord);1469 ring Dh = 0,(t,s,x(n..1),Dt,D(n..1),h),(a(@a),a(@a2),M(@Ord));1470 } 1471 dbprint(ppl," the ring Dh:",Dh);1586 dbprint(ppl,"// weights for ordering: "+string(transpose(@a))); 1587 dbprint(ppl,"// the ordering matrix:",@Ord); 1588 ring @Dh = 0,(t,s,x(n..1),Dt,D(n..1),h),(a(@a),a(@a2),M(@Ord)); 1589 } 1590 dbprint(ppl,"// the ring Dh:",Dh); 1472 1591 // non-commutative relations 1473 1592 matrix @relD[noofvars][noofvars]; … … 1479 1598 @relD[i+2,n+3+i] = h^2; 1480 1599 } 1481 dbprint(ppl," nc relations:",@relD);1482 def D Dh = nc_algebra(1,@relD);1483 setring D Dh;1484 dbprint(ppl," computing in ring",DDh);1600 dbprint(ppl,"// nc relations:",@relD); 1601 def Dh = nc_algebra(1,@relD); 1602 setring Dh; 1603 dbprint(ppl,"// computing in ring",DDh); 1485 1604 ideal I; 1486 1605 poly f = imap(r,f); … … 1492 1611 I = I, D(i)+diff(f,x(i))*Dt; 1493 1612 } 1494 dbprint(ppl, " starting Groebner basis computation with engine:", whichengine);1613 dbprint(ppl, "// starting Groebner basis computation with engine: "+string(whichengine)); 1495 1614 I = engine(I, whichengine); 1496 dbprint(ppl, " finished Groebner basis computation");1497 dbprint(ppl, " I before dehomogenization is" ,I);1615 dbprint(ppl, "// finished Groebner basis computation"); 1616 dbprint(ppl, "// I before dehomogenization: "+string(I)); 1498 1617 I = subst(I,h,1); // dehomogenization 1499 dbprint(ppl, " I after dehomogenization is" ,I);1618 dbprint(ppl, "// I after dehomogenization: " +string(I)); 1500 1619 I = inForm(I,uv); // we are only interested in the initial form w.r.t. uv 1501 dbprint(ppl, " the initial ideal:", string(matrix(I)));1620 dbprint(ppl, "// the initial ideal:", string(matrix(I))); 1502 1621 intvec tonselect = 1; 1503 1622 for (i=3; i<=2*n+4; i++) { tonselect = tonselect,i; } 1504 1623 I = nselect(I,tonselect); 1505 dbprint(ppl, " generators containing only s:", string(matrix(I)));1624 dbprint(ppl, "// generators containing only s:", string(matrix(I))); 1506 1625 I = engine(I, whichengine); // is now a principal ideal; 1507 setring save; 1626 if (qr == 1) { setring save2; } 1627 else { setring save; } 1508 1628 ideal J; J[2] = var(1); 1509 map @m = D Dh,J;1629 map @m = Dh,J; 1510 1630 ideal I = @m(I); 1511 1631 poly p = I[1]; 1512 1632 list l = listofroots(p,1); 1633 if (qr == 1) 1634 { 1635 setring save; 1636 list l = imap(save2,l); 1637 } 1513 1638 return(l); 1514 1639 } … … 1525 1650 "USAGE: bfctAnn(f [,r]); f a poly, r an optional int 1526 1651 RETURN: list of ideal and intvec 1527 PURPOSE: computes the roots of the Bernstein-Sato polynomial b(s) 1528 @* for the hypersurface defined by f1529 ASSUME: The basering is a commutative polynomial ring in char0.1652 PURPOSE: computes the roots of the Bernstein-Sato polynomial b(s) for the 1653 @* hypersurface defined by f. 1654 ASSUME: The basering is commutative and of characteristic 0. 1530 1655 BACKGROUND: In this proc, ann(f^s) is computed and then a system of linear 1531 1656 @* equations is solved by linear reductions. 1532 NOTE: In the output list, the ideal contains all the roots 1533 @* and the intvectheir multiplicities.1657 NOTE: In the output list, the ideal contains all the roots and the intvec 1658 @* their multiplicities. 1534 1659 @* If r<>0, @code{std} is used for GB computations, 1535 1660 @* otherwise, and by default, @code{slimgb} is used. … … 1549 1674 } 1550 1675 } 1551 list b = bfctengine(f,1,whichengine,0, 1,0,0,0);1676 list b = bfctengine(f,1,whichengine,0,0,0,0,0); 1552 1677 return(b); 1553 1678 }
Note: See TracChangeset
for help on using the changeset viewer.