Changeset 565e866 in git for Singular/LIB/bfct.lib
- Timestamp:
- Dec 23, 2008, 10:39:31 PM (15 years ago)
- Branches:
- (u'spielwiese', 'fe61d9c35bf7c61f2b6cbf1b56e25e2f08d536cc')
- Children:
- 199ae72040d35b09813089e33464df761b5aad78
- Parents:
- 6045c31371ebacbf1acfc2f082225f05016f06b2
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
Singular/LIB/bfct.lib
r6045c3 r565e866 1 1 ////////////////////////////////////////////////////////////////////////////// 2 version="$Id: bfct.lib,v 1. 7 2008-12-09 16:50:21 levandov Exp $";2 version="$Id: bfct.lib,v 1.8 2008-12-23 21:39:31 levandov Exp $"; 3 3 category="Noncommutative"; 4 4 info=" 5 LIBRARY: bfct.lib M. Noro's Algorithm forBernstein-Sato polynomial5 LIBRARY: bfct.lib Algorithms for b-functions and Bernstein-Sato polynomial 6 6 AUTHORS: Daniel Andres, daniel.andres@math.rwth-aachen.de 7 7 @* Viktor Levandovskyy, levandov@math.rwth-aachen.de 8 8 9 9 THEORY: Given a polynomial ring R = K[x_1,...,x_n] and a polynomial F in R, 10 @* one is interested in the global Bernstein-Sato polynomial b(s) in K[s], 11 @* defined to be the monic polynomial, satisfying a functional identity 12 @* L * f^{s+1} = b(s) f^s, for some operator L in D[s]. 13 @* Here, D stands for an n-th Weyl algebra K<x_1,...,x_n,d_1,...,d_n | d_j x_j = x_j d_j +1> 14 @* One is interested in the following data: 15 @* global Bernstein-Sato polynomial in K[s] and 16 @* the list of all roots of b(s), which are known to be rational, with their multiplicities. 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>. 14 @* One is interested in the following data: 15 @* - Bernstein-Sato polynomial b(s) in K[s], 16 @* - the list of its roots, which are known to be rational 17 @* - the multiplicities of the roots. 18 @* References: Saito, Strurmfels, Takayama: Groebner Deformations of Hypergeometric 19 @* Differential Equations (2000), Noro: An Efficient Modular Algorithm for Computing 20 @* the Global b-function, (2002). 21 17 22 18 23 MAIN PROCEDURES: 19 24 20 bfct(f[,s,t,v]); compute the global Bernstein-Sato polynomial of a given poly21 bfct syz(f[,r,s,t,u,v]); compute the global Bernstein-Sato polynomial of a given poly22 bfct ann(f[,s]); compute the global Bernstein-Sato polynomial of a given poly23 bfct onestep(f[,s,t]); compute the global Bernstein-Sato polynomial of a given poly24 bfct ideal(I,w[,s,t]); compute the global b-function of a given ideal w.r.t. a given weight25 p intersect(f,I); compute the intersection of the ideal generated by a given poly with a given ideal26 p intersectsyz(f,I[,p,s,t]); compute the intersection of the ideal generated by a given poly with a given ideal27 lin reduce(f,I[,s]); reducea poly by linear reductions only28 ncsolve(I[,s]); find and compute a linear dependency of the elements of an ideal 25 bfct(f[,s,t,v]); computes the Bernstein-Sato polynomial of poly f 26 bfctSyz(f[,r,s,t,u,v]); computes the Bernstein-Sato polynomial of poly f 27 bfctAnn(f[,s]); computes the Bernstein-Sato polynomial of poly f 28 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 w 30 pIntersect(f,I); intersection of the ideal I with the subalgebra K[f] for a poly f 31 pIntersectSyz(f,I[,p,s,t]); intersection of the ideal I with the subalgebra K[f] for a poly f 32 linReduce(f,I[,s]); reduces a poly by linear reductions only 33 linSyzSolve(I[,s]); computes a linear dependency of the elements of ideal I 29 34 30 35 AUXILIARY PROCEDURES: 31 36 32 ispositive(v); check whether all entries of an intvec are positive 33 isin(l,i); check whether an element is a member of a list 34 scalarprod(v,w); compute the standard scalar product of two intvecs 35 vec2poly(v[,i]); convert a coefficient vector to a poly 37 allPositive(v); checks whether all entries of an intvec are positive 38 scalarProd(v,w); computes the standard scalar product of two intvecs 39 vec2poly(v[,i]); constructs an univariate poly with given coefficients 36 40 37 41 SEE ALSO: dmod_lib, dmodapp_lib, gmssing_lib … … 40 44 41 45 LIB "qhmoduli.lib"; // for Max 42 LIB "dmod.lib"; // for SannfsBFCT etc 43 LIB "dmodapp.lib"; // for initialideal etc 44 45 46 LIB "dmod.lib"; // for SannfsBFCT etc 47 LIB "dmodapp.lib"; // for initialIdeal etc 48 49 50 /////////////////////////////////////////////////////////////////////////////// 51 // testing for consistency of the library: 46 52 proc testbfctlib () 47 53 { 48 54 // tests all procs for consistency 49 55 "AUXILIARY PROCEDURES:"; 50 example ispositive; 51 example isin; 52 example scalarprod; 56 example allPositive; 57 example scalarProd; 53 58 example vec2poly; 54 59 "MAIN PROCEDURES:"; 55 60 example bfct; 56 example bfct syz;57 example bfct ann;58 example bfct onestep;59 example bfct ideal;60 example p intersect;61 example p intersectsyz;62 example lin reduce;63 example ncsolve;64 } 65 61 example bfctSyz; 62 example bfctAnn; 63 example bfctOneGB; 64 example bfctIdeal; 65 example pIntersect; 66 example pIntersectSyz; 67 example linReduce; 68 example linReduceIdeal; 69 example linSyzSolve; 70 } 66 71 67 72 //--------------- auxiliary procedures --------------------------------------------------------- … … 71 76 RETURN: a ring, the associated graded ring of the basering w.r.t. u and v 72 77 PURPOSE: compute the associated graded ring of the basering w.r.t. u and v 78 ASSUME: basering is a Weyl algebra 73 79 EXAMPLE: example gradedWeyl; shows examples 74 80 NOTE: u[i] is the weight of x(i), v[i] the weight of D(i). … … 122 128 { 123 129 "EXAMPLE:"; echo = 2; 124 LIB "bfct.lib";125 130 ring @D = 0,(x,y,z,Dx,Dy,Dz),dp; 126 131 def D = Weyl(); … … 132 137 133 138 134 proc ispositive (intvec v)135 "USAGE: ispositive(v); v an intvec136 RETURN: 1 if all components of v are positive, or 0 otherwise139 proc allPositive (intvec v) 140 "USAGE: allPositive(v); v an intvec 141 RETURN: int, 1 if all components of v are positive, or 0 otherwise 137 142 PURPOSE: check whether all components of an intvec are positive 138 EXAMPLE: example ispositive; shows an example143 EXAMPLE: example allPositive; shows an example 139 144 " 140 145 { … … 154 159 "EXAMPLE:"; echo = 2; 155 160 intvec v = 1,2,3; 156 ispositive(v);161 allPositive(v); 157 162 intvec w = 1,-2,3; 158 ispositive(w);159 } 160 161 proc isin(list l, i)162 "USAGE: isin(l,i); l a list, i an argument of any type163 RETURN: anint, the position of the first appearance of i in l, or 0 if i is not a member of l163 allPositive(w); 164 } 165 166 static proc findFirst (list l, i) 167 "USAGE: findFirst(l,i); l a list, i an argument of any type 168 RETURN: int, the position of the first appearance of i in l, or 0 if i is not a member of l 164 169 PURPOSE: check whether the second argument is a member of a list 165 EXAMPLE: example isin; shows an example170 EXAMPLE: example findFirst; shows an example 166 171 " 167 172 { … … 177 182 return(0); 178 183 } 184 // isin(list(1, 2, list(1)),2); // seems to be a bit buggy, 185 // isin(list(1, 2, list(1)),3); // but works for the purposes 186 // isin(list(1, 2, list(1)),list(1)); // of this library 187 // isin(l,list(2)); 179 188 example 180 189 { … … 182 191 ring r = 0,x,dp; 183 192 list l = 1,2,3; 184 isin(l,4);185 isin(l,2);186 } 187 188 proc scalar prod (intvec v, intvec w)189 "USAGE: scalar prod(v,w); v,w intvecs190 RETURN: anint, the standard scalar product of v and w191 PURPOSE: compute the scalar product of two intvecs192 NOTE: the arguments must havethe same size193 EXAMPLE: example scalar prod; shows examples193 findFirst(l,4); 194 findFirst(l,2); 195 } 196 197 proc scalarProd (intvec v, intvec w) 198 "USAGE: scalarProd(v,w); v,w intvecs 199 RETURN: int, the standard scalar product of v and w 200 PURPOSE: computes the scalar product of two intvecs 201 ASSUME: the arguments are of the same size 202 EXAMPLE: example scalarProd; shows examples 194 203 " 195 204 { … … 213 222 intvec v = 1,2,3; 214 223 intvec w = 4,5,6; 215 scalarprod(v,w); 216 } 217 224 scalarProd(v,w); 225 } 218 226 219 227 //-------------- main procedures ------------------------------------------------------- 220 228 221 222 proc linreduce(poly f, ideal I, list #) 223 "USAGE: linreduce(f, I [,s,t]); f a poly, I an ideal, s,t optional ints 224 RETURN: a poly obtained by linear reductions of the given poly with the given ideal 225 PURPOSE: reduce a poly only by linear reductions 226 NOTE: If s<>0, a list consisting of the reduced poly and the coefficient vector of the used 227 @* reductions is returned. 228 @* If t<>0, only leading monomials are reduced, otherwise, and by default, all monomials 229 @* are reduced, if possible. 230 EXAMPLE: example linreduce; shows examples 229 proc linReduceIdeal(ideal I, list #) 230 "USAGE: linReduceIdeal(I [,s,t]); I an ideal, s,t optional ints 231 RETURN: ideal/list, linear reductum (over field) of f by elements from I 232 PURPOSE: reduce a poly only by linear reductions (no monomial multiplications) 233 NOTE: If s<>0, a list consisting of the reduced ideal and the coefficient 234 @* vectors of the used reductions given as module is returned. 235 @* Otherwise (and by default), only the reduced ideal is returned. 236 @* If t=0 (and by default) all monomials are reduced (if possible), 237 @* otherwise, only leading monomials are reduced. 238 DISPLAY: If @code{printlevel}>=1, all debug messages will be printed. 239 EXAMPLE: example linReduceIdeal; shows examples 231 240 " 232 241 { 242 // #[1] = remembercoeffs 243 // #[2] = redtail 233 244 int ppl = printlevel - voice + 2; 234 245 int remembercoeffs = 0; // default 235 int red lm= 0; // default246 int redtail = 0; // default 236 247 if (size(#)>0) 237 248 { … … 244 255 if (typeof(#[2])=="int" || typeof(#[2])=="number") 245 256 { 246 redlm = #[2]; 257 redtail = #[2]; 258 } 259 } 260 } 261 int sI = ncols(I); 262 int sZeros = sI - size(I); 263 dbprint(ppl,"ideal contains "+string(sZeros)+" zero(s)"); 264 int i,j; 265 ideal J,lmJ,ordJ; 266 list lJ = sort(I); 267 module M; // for the coefficients 268 if (sZeros > 0) // I contains zeros 269 { 270 if (remembercoeffs <> 0) 271 { 272 j = 0; 273 for (i=1; i<=sI; i++) 274 { 275 if (I[i] == 0) 276 { 277 j++; 278 J[j] = 0; 279 ordJ[j] = -1; 280 M[j] = gen(i); 281 } 282 else 283 { 284 M[i+sZeros-j] = gen(lJ[2][i-j]+j); 285 } 286 } 287 } 288 else 289 { 290 for (i=1; i<=sZeros; i++) 291 { 292 J[i] = 0; 293 ordJ[i] = -1; 294 } 295 } 296 I = J,lJ[1]; 297 } 298 else 299 { 300 I = lJ[1]; 301 if (remembercoeffs <> 0) 302 { 303 for (i=1; i<=size(lJ[1]); i++) { M[i+sZeros] = gen(lJ[2][i]); } 304 } 305 } 306 dbprint(ppl,"initially sorted ideal:", I); 307 if (remembercoeffs <> 0) { dbprint(ppl," used permutations:", M); } 308 poly lm,c,redpoly,maxlmJ; 309 J[sZeros+1] = I[sZeros+1]; 310 lm = I[sZeros+1]; 311 maxlmJ = leadmonom(lm); 312 lmJ[sZeros+1] = maxlmJ; 313 int ordlm,reduction,maxordJ; 314 maxordJ = ord(lm); 315 ordJ[sZeros+1] = maxordJ; 316 vector v; 317 for (i=sZeros+2; i<=sI; i++) 318 { 319 redpoly = I[i]; 320 lm = leadmonom(redpoly); 321 ordlm = ord(lm); 322 reduction = 1; 323 if (remembercoeffs <> 0) { v = M[i]; } 324 while (reduction == 1) // while there was a reduction 325 { 326 reduction = 0; 327 for (j=sZeros+1; j<i; j++) 328 { 329 if (lm == 0) { break; } 330 if (ordlm > maxordJ) { break; } 331 if (ordlm == ordJ[j]) 332 { 333 if (lm > maxlmJ) { break; } 334 if (lm == lmJ[j]) 335 { 336 dbprint(ppl,"reducing " + string(redpoly)); 337 dbprint(ppl," with " + string(J[j])); 338 c = leadcoef(redpoly)/leadcoef(J[j]); 339 redpoly = redpoly - c*J[j]; 340 dbprint(ppl," to " + string(redpoly)); 341 lm = leadmonom(redpoly); 342 ordlm = ord(lm); 343 if (remembercoeffs <> 0) { M[i] = M[i] - c * M[j]; } 344 reduction = 1; 345 } 346 } 347 } 348 } 349 for (j=sZeros+1; j<i; j++) 350 { 351 if (redpoly < J[j]) { break; } 352 } 353 J = insertGenerator(J,redpoly,j); 354 lmJ = insertGenerator(lmJ,lm,j); 355 ordJ = insertGenerator(ordJ,poly(ordlm),j); 356 if (remembercoeffs <> 0) 357 { 358 v = M[i]; 359 M = deleteGenerator(M,i); 360 M = insertGenerator(M,v,j); 361 } 362 maxordJ = ord(J[i]); 363 maxlmJ = lmJ[i]; 364 } 365 if (redtail <> 0) 366 { 367 dbprint(ppl,"finished reducing leading monomials:",J); 368 if (remembercoeffs <> 0) { dbprint(ppl,"used reductions:",M); } 369 int k; 370 for (i=sZeros+1; i<=sI; i++) 371 { 372 lm = lmJ[i]; 373 for (j=i+1; j<=sI; j++) 374 { 375 for (k=2; k<=size(J[j]); k++) // run over all terms in J[j] 376 { 377 if (ordJ[i] == ord(J[j][k])) 378 { 379 if (lm == normalize(J[j][k])) 380 { 381 c = leadcoef(J[j][k])/leadcoef(J[i]); 382 dbprint(ppl,"reducing " + string(J[j])); 383 dbprint(ppl," with " + string(J[i])); 384 J[j] = J[j] - c*J[i]; 385 dbprint(ppl," to " + string(J[j])); 386 if (remembercoeffs <> 0) { M[j] = M[j] - c * M[i]; } 387 } 388 } 389 } 390 } 391 } 392 } 393 if (remembercoeffs <> 0) { return(list(J,M)); } 394 else { return(J); } 395 } 396 example 397 { 398 "EXAMPLE:"; echo = 2; 399 ring r = 0,(x,y),dp; 400 ideal I = 3,x+9,y4,y4+7x+2; 401 linReduceIdeal(I); 402 linReduceIdeal(I,0,1); 403 list l = linReduceIdeal(I,1,1); l; 404 module M = I; 405 l[1] - ideal(M*l[2]); 406 } 407 408 proc linReduce(poly f, ideal I, list #) 409 "USAGE: linReduce(f, I [,s,t]); f a poly, I an ideal, s,t optional ints 410 RETURN: poly/list, linear reductum (over field) of f by elements from I 411 PURPOSE: reduce a poly only by linear reductions (no monomial multiplications) 412 NOTE: If s<>0, a list consisting of the reduced poly and the coefficient 413 @* vector of the used reductions is returned, otherwise (and by default) 414 @* only reduced poly is returned. 415 @* If t=0 (and by default) all monomials are reduced (if possible), 416 @* otherwise, only leading monomials are reduced. 417 DISPLAY: If @code{printlevel}>=1, all debug messages will be printed. 418 EXAMPLE: example linReduce; shows examples 419 " 420 { 421 int ppl = printlevel - voice + 2; 422 int remembercoeffs = 0; // default 423 int redtail = 0; // default 424 int prepareideal = 1; // default 425 if (size(#)>0) 426 { 427 if (typeof(#[1])=="int" || typeof(#[1])=="number") 428 { 429 remembercoeffs = #[1]; 430 } 431 if (size(#)>1) 432 { 433 if (typeof(#[2])=="int" || typeof(#[2])=="number") 434 { 435 redtail = #[2]; 436 } 437 if (size(#)>2) 438 { 439 if (typeof(#[3])=="int" || typeof(#[3])=="number") 440 { 441 prepareideal = #[3]; 442 } 247 443 } 248 444 } … … 250 446 int i,j,k; 251 447 int sI = ncols(I); 252 ideal lmI,lcI; 448 // pre-reduce I: 449 module M; 450 if (prepareideal <> 0) 451 { 452 if (remembercoeffs <> 0) 453 { 454 list sortedI = linReduceIdeal(I,1,redtail); 455 I = sortedI[1]; 456 M = sortedI[2]; 457 dbprint(ppl,"prepared ideal:",I); 458 dbprint(ppl," with operations:",M); 459 } 460 else 461 { 462 I = linReduceIdeal(I,0,redtail); 463 } 464 } 465 else 466 { 467 if (remembercoeffs <> 0) 468 { 469 for (i=1; i<=sI; i++) 470 { 471 M[i] = gen(i); 472 } 473 } 474 } 475 ideal lmI,lcI,ordI; 253 476 for (i=1; i<=sI; i++) 254 477 { 255 478 lmI[i] = leadmonom(I[i]); 256 479 lcI[i] = leadcoef(I[i]); 480 ordI[i] = ord(lmI[i]); 257 481 } 258 482 vector v; 259 483 poly c; 260 int reduction = 1; 261 if (redlm == 0) 262 { 263 ideal monomf; 264 for (k=1; k<=size(f); k++) 265 { 266 monomf[k] = normalize(f[k]); 267 } 268 while (reduction == 1) // while there was a reduction 269 { 270 reduction = 0; 271 for (i=sI; i>=1; i--) 272 { 273 dbprint(ppl,"testing ideal entry:",i); 274 for (j=1; j<=size(f); j++) 484 // === reduce leading monomials === 485 poly lm = leadmonom(f); 486 int ordf = ord(lm); 487 for (i=sI; i>=1; i--) // I is sorted: smallest lm's on top 488 { 489 if (lm == 0) 490 { 491 break; 492 } 493 else 494 { 495 if (ordf == ordI[i]) 496 { 497 if (lm == lmI[i]) 275 498 { 276 if (monomf[j] == lmI[i]) 499 c = leadcoef(f)/lcI[i]; 500 f = f - c*I[i]; 501 lm = leadmonom(f); 502 ordf = ord(lm); 503 if (remembercoeffs <> 0) 504 { 505 v = v - c * M[i]; 506 } 507 } 508 } 509 } 510 } 511 // === reduce tails as well === 512 if (redtail <> 0) 513 { 514 dbprint(ppl,"poly after reduction of leading monomials:",f); 515 for (i=1; i<=sI; i++) 516 { 517 dbprint(ppl,"testing ideal entry:",i); 518 for (j=1; j<=size(f); j++) 519 { 520 if (ord(f[j]) == ordI[i]) 521 { 522 if (normalize(f[j]) == lmI[i]) 277 523 { 278 524 c = leadcoef(f[j])/lcI[i]; 279 525 f = f - c*I[i]; 280 526 dbprint(ppl,"reducing poly to ",f); 281 monomf = 0;282 for (k=1; k<=size(f); k++)283 {284 monomf[k] = normalize(f[k]);285 }286 reduction = 1;287 527 if (remembercoeffs <> 0) 288 528 { 289 v = v - c * gen(i);529 v = v - c * M[i]; 290 530 } 291 break;292 }293 }294 if (reduction == 1)295 {296 break;297 }298 }299 }300 }301 else // reduce only leading monomials302 {303 poly lm = leadmonom(f);304 while (reduction == 1) // while there was a reduction305 {306 reduction = 0;307 for (i=sI;i>=1;i--)308 {309 if (lm <> 0 && lm == lmI[i])310 {311 c = leadcoef(f)/lcI[i];312 f = f - c*I[i];313 lm = leadmonom(f);314 reduction = 1;315 if (remembercoeffs <> 0)316 {317 v = v - c * gen(i);318 531 } 319 532 } … … 338 551 poly f = 5xy+7y+3; 339 552 poly g = 7x+5y+3; 340 linreduce(g,I); 341 linreduce(g,I,0,1); 342 linreduce(f,I,1); 343 } 344 345 proc ncsolve (ideal I, list #) 346 "USAGE: ncsolve(I[,s]); I an ideal, s an optional int 347 RETURN: coefficient vector of a linear combination of 0 in the elements of I 348 PURPOSE: compute a linear dependency between the elements of an ideal if such one exists 553 linReduce(g,I); 554 linReduce(g,I,0,1); 555 linReduce(f,I,1); 556 f = x3 + y2 + x2 + y + x; 557 I = x3 - y3, y3 - x2, x3 - y2, x2 - y, y2-x; 558 list l = linReduce(f, I, 1); 559 l; 560 module M = I; 561 f - (l[1] - (M*l[2])[1,1]); 562 } 563 564 proc linSyzSolve (ideal I, list #) 565 "USAGE: linSyzSolve(I[,s]); I an ideal, s an optional int 566 RETURN: vector, coefficient vector of a linear combination of 0 in the elements of I 567 PURPOSE: compute a linear dependency between the elements of an ideal 568 @* if such one exists 349 569 NOTE: If s<>0, @code{std} is used for Groebner basis computations, 350 570 @* otherwise, @code{slimgb} is used. 351 571 @* By default, @code{slimgb} is used in char 0 and @code{std} in char >0. 352 @*If printlevel=1, progress debug messages will be printed,572 DISPLAY: If printlevel=1, progress debug messages will be printed, 353 573 @* if printlevel>=2, all the debug messages will be printed. 354 EXAMPLE: example ncsolve; shows examples574 EXAMPLE: example linSyzSolve; shows examples 355 575 " 356 576 { … … 374 594 else 375 595 { 376 // 1. introduce undefined coeffs596 // ------- 1. introduce undefined coeffs ------------------ 377 597 def save = basering; 378 598 int p = char(save); … … 386 606 ring @A = p,(@a(1..sI)),lp; 387 607 ring @aA = (p,@a(1..sI)), (@z),dp; 608 // TODO: BUG! WHAT IF THE ORIGINAL RING ALREADY HAS SUCH VARIABLES/PARAMETERS!!!? 609 // TODO: YOU CAN OVERCOME THIS BY MEANS SIMILAR TO "chooseSafeVarName" FROM NEW "matrix.lib" 388 610 def @B = save + @aA; 389 611 setring @B; 390 612 ideal I = imap(save,I); 391 // 2. form the linear system for the undef coeffs613 // ------- 2. form the linear system for the undef coeffs --- 392 614 int i; poly W; ideal QQ; 393 615 for (i=1; i<=sI; i++) … … 403 625 setring @A; 404 626 ideal QQ = imap(@B,QQ); 405 // 3. this QQ is a polynomial ideal, so "solve" the system406 dbprint(ppl, " ncsolve: starting Groebner basis computation with engine:", whichengine);627 // ------- 3. this QQ is a polynomial ideal, so "solve" the system ----- 628 dbprint(ppl, "linSyzSolve: starting Groebner basis computation with engine:", whichengine); 407 629 QQ = engine(QQ,whichengine); 408 630 dbprint(ppl, "QQ after engine:", QQ); 409 631 if (dim(QQ) == -1) 410 632 { 411 dbprint(ppl+1, "no solutions by ncsolve");633 dbprint(ppl+1, "no solutions by linSyzSolve"); 412 634 // output zeroes 413 635 setring save; … … 415 637 return(v); 416 638 } 417 // 4. in order to get the numeric values639 // ------- 4. in order to get the numeric values ------- 418 640 matrix AA = matrix(maxideal(1)); 419 641 module MQQ = std(module(QQ)); … … 439 661 ring r = 0,x,dp; 440 662 ideal I = x,2x; 441 ncsolve(I);663 linSyzSolve(I); 442 664 ideal J = x,x2; 443 ncsolve(J); 444 } 445 446 proc pintersect (poly s, ideal I) 447 "USAGE: pintersect(f, I); f a poly, I an ideal 448 RETURN: coefficient vector of the monic generator of the intersection of the ideal generated by f with I 449 PURPOSE: compute the intersection of an ideal with a principal ideal defined by f 665 linSyzSolve(J); 666 } 667 668 proc pIntersect (poly s, ideal I) 669 "USAGE: pIntersect(f, I); f a poly, I an ideal 670 RETURN: vector, coefficient vector of the monic polynomial 671 PURPOSE: compute the intersection of ideal I with the subalgebra K[f] 672 ASSUME: I is given as Groebner basis. 450 673 NOTE: If the intersection is zero, this proc might not terminate. 451 @* I should be given as standard basis. 452 @* If printlevel=1, progress debug messages will be printed, 674 DISPLAY: If printlevel=1, progress debug messages will be printed, 453 675 @* if printlevel>=2, all the debug messages will be printed. 454 EXAMPLE: example p intersect; shows examples676 EXAMPLE: example pIntersect; shows examples 455 677 " 456 678 { 457 679 // assume I is given in Groebner basis 458 attrib(I,"isSB",1); // set attribute for suppressing NF messages 680 if (attrib(I,"isSB") <> 1) 681 { 682 print("WARNING: The input has no SB attribute!"); 683 print(" Treating it as if it were a Groebner basis and proceeding..."); 684 attrib(I,"isSB",1); // set attribute for suppressing NF messages 685 } 459 686 int ppl = printlevel-voice+2; 460 687 // ---case 1: I = basering--- 461 688 if (size(I) == 1) 462 689 { 463 if (simplify(I, 1) == ideal(1))690 if (simplify(I,2)[1] == 1) 464 691 { 465 692 return(gen(2)); // = s … … 512 739 poly toNF,tobracket,newNF,rednewNF,oldNF,secNF; 513 740 i = 1; 514 dbprint(ppl+1,"p intersect starts...");741 dbprint(ppl+1,"pIntersect starts..."); 515 742 while (1) 516 743 { … … 535 762 secNF = newNF; 536 763 } 537 ll = lin reduce(newNF,redNI,1);764 ll = linReduce(newNF,redNI,1); 538 765 rednewNF = ll[1]; 539 766 l[i+1] = ll[2]; … … 578 805 v = imap(@R,v); 579 806 kill @R; 580 dbprint(ppl+1,"p intersect finished");807 dbprint(ppl+1,"pIntersect finished"); 581 808 return(v); 582 809 } … … 586 813 ring r = 0,(x,y),dp; 587 814 poly f = x^2+y^3+x*y^2; 588 def D = initial malgrange(f);815 def D = initialMalgrange(f); 589 816 setring D; 590 817 inF; 591 pintersect(t*Dt,inF); 592 } 593 594 proc pintersectsyz (poly s, ideal II, list #) 595 "USAGE: pintersectsyz(f, I [,p,s,t]); f a poly, I an ideal, p, t optial ints, p a prime number 596 RETURN: coefficient vector of the monic generator of the intersection of the ideal generated by f with I 597 PURPOSE: compute the intersection of an ideal with a principal ideal defined by f 598 NOTE: If the intersection is zero, this proc might not terminate. 599 @* I should be given as standard basis. 600 @* If p>0 is given, this proc computes the generator of the intersection in char p first and 601 @* then only searches for a generator of the obtained degree in the basering. 602 @* Otherwise, it searched for all degrees. 603 @* This is done by computing syzygies. 818 pIntersect(t*Dt,inF); 819 } 820 821 proc pIntersectSyz (poly s, ideal II, list #) 822 "USAGE: pIntersectSyz(f, I [,p,s,t]); f a poly, I an ideal, p, t optial ints, p a prime number 823 RETURN: vector, coefficient vector of the monic polynomial 824 PURPOSE: compute the intersection of an ideal I with the subalgebra K[f] 825 ASSUME: I is given as Groebner basis. 826 NOTE: If the intersection is zero, this procedure might not terminate. 827 @* If p>0 is given, this proc computes the generator of the intersection in char p first 828 @* and then only searches for a generator of the obtained degree in the basering. 829 @* Otherwise, it searched for all degrees by computing syzygies. 604 830 @* If s<>0, @code{std} is used for Groebner basis computations in char 0, 605 831 @* otherwise, and by default, @code{slimgb} is used. 606 832 @* If t<>0 and by default, @code{std} is used for Groebner basis computations in char >0, 607 833 @* otherwise, @code{slimgb} is used. 608 @*If printlevel=1, progress debug messages will be printed,834 DISPLAY: If printlevel=1, progress debug messages will be printed, 609 835 @* if printlevel>=2, all the debug messages will be printed. 610 EXAMPLE: example p intersectsyz; shows examples836 EXAMPLE: example pIntersectSyz; shows examples 611 837 " 612 838 { 613 839 // assume I is given in Groebner basis 614 840 ideal I = II; 615 attrib(I,"isSB",1); // set attribute for suppressing NF messages 841 if (attrib(I,"isSB") <> 1) 842 { 843 print("WARNING: The input has no SB attribute!"); 844 print(" Treating it as if it were a Groebner basis and proceeding..."); 845 attrib(I,"isSB",1); // set attribute for suppressing NF messages 846 } 616 847 int ppl = printlevel-voice+2; 617 848 int whichengine = 0; // default … … 668 899 } 669 900 i = 1; 670 dbprint(ppl+1,"p intersectsyz starts...");901 dbprint(ppl+1,"pIntersectSyz starts..."); 671 902 dbprint(ppl+1,"with ideal I=", I); 672 903 while (1) … … 688 919 } 689 920 // look for a solution 690 dbprint(ppl," ncsolve starts with: "+string(matrix(NI)));921 dbprint(ppl,"linSyzSolve starts with: "+string(matrix(NI))); 691 922 if (solveincharp<>0) // modular method 692 923 { 693 924 setring Rp; 694 925 NI[i+1] = phi(newNF); 695 v = ncsolve(NI,modengine);926 v = linSyzSolve(NI,modengine); 696 927 if (v!=0) // there is a modular solution 697 928 { 698 929 dbprint(ppl,"got solution in char ",solveincharp," of degree " ,i); 699 930 setring save; 700 v = ncsolve(NI,whichengine);931 v = linSyzSolve(NI,whichengine); 701 932 if (v==0) 702 933 { … … 712 943 else // non-modular method 713 944 { 714 v = ncsolve(NI,whichengine);945 v = linSyzSolve(NI,whichengine); 715 946 } 716 947 matrix MM[1][nrows(v)] = matrix(v); 717 dbprint(ppl," ncsolve ready with: "+string(MM));948 dbprint(ppl,"linSyzSolve ready with: "+string(MM)); 718 949 kill MM; 719 // " ncsolve ready with"; print(v);950 // "linSyzSolve ready with"; print(v); 720 951 if (v!=0) 721 952 { … … 729 960 if (p!=0) 730 961 { 731 dbprint(ppl," ncsolve: bad solution!");962 dbprint(ppl,"linSyzSolve: bad solution!"); 732 963 } 733 964 else 734 965 { 735 dbprint(ppl," ncsolve: got solution!");966 dbprint(ppl,"linSyzSolve: got solution!"); 736 967 // "got solution!"; 737 968 break; … … 741 972 i++; 742 973 } 743 dbprint(ppl+1,"p intersectsyz finished");974 dbprint(ppl+1,"pIntersectSyz finished"); 744 975 return(v); 745 976 } … … 749 980 ring r = 0,(x,y),dp; 750 981 poly f = x^2+y^3+x*y^2; 751 def D = initial malgrange(f);982 def D = initialMalgrange(f); 752 983 setring D; 753 984 inF; 754 985 poly s = t*Dt; 755 p intersectsyz(s,inF);986 pIntersectSyz(s,inF); 756 987 int p = prime(20000); 757 p intersectsyz(s,inF,p,0,0);988 pIntersectSyz(s,inF,p,0,0); 758 989 } 759 990 760 991 proc vec2poly (list #) 761 992 "USAGE: vec2poly(v [,i]); v a vector or an intvec, i an optional int 762 RETURN: a poly with coefficient vector v 763 PURPOSE: convert a coefficient vector to a poly 764 NOTE: If i>0 is given, the returned poly is an element of K[var(i)], 765 @* otherwise, and by default, @code{i=1} is used. 766 @* The first entry of v is the coefficient of 1. 993 RETURN: poly, an univariate poly in i-th variable with coefficients given by v 994 PURPOSE: constructs an univariate poly in K[var(i)] with given coefficients, 995 @* such that the coefficient at var(i)^{j-1} is v[j]. 996 NOTE: The optional argument i must be positive, by default i is 1. 767 997 EXAMPLE: example vec2poly; shows examples 768 998 " … … 858 1088 } 859 1089 860 static proc bfctengine (poly f, int inorann, int whichengine, int methodord, int methodp intersect, int pintersectchar, int modengine, intvec u0)1090 static proc bfctengine (poly f, int inorann, int whichengine, int methodord, int methodpIntersect, int pIntersectchar, int modengine, intvec u0) 861 1091 { 862 1092 int ppl = printlevel - voice +2; … … 866 1096 if (inorann == 0) // bfct using initial ideal 867 1097 { 868 def D = initial malgrange(f,whichengine,methodord,1,u0);1098 def D = initialMalgrange(f,whichengine,methodord,1,u0); 869 1099 setring D; 870 1100 ideal J = inF; … … 881 1111 vector b; 882 1112 // try it modular 883 if (methodp intersect <> 0) // pintersectsyz884 { 885 if (p intersectchar == 0) // pintersectsyz::modular1113 if (methodpIntersect <> 0) // pIntersectSyz 1114 { 1115 if (pIntersectchar == 0) // pIntersectSyz::modular 886 1116 { 887 1117 int lb = 30000; … … 893 1123 dbprint(ppl,"number of run in the loop: "+string(i)); 894 1124 int q = prime(random(lb,ub)); 895 if ( isin(usedprimes,q)==0) // if q was not already used1125 if (findFirst(usedprimes,q)==0) // if q was not already used 896 1126 { 897 1127 usedprimes = usedprimes,q; 898 1128 dbprint(ppl,"used prime is: "+string(q)); 899 b = p intersectsyz(s,J,q,whichengine,modengine);1129 b = pIntersectSyz(s,J,q,whichengine,modengine); 900 1130 } 901 1131 i++; 902 1132 } 903 1133 } 904 else // p intersectsyz::non-modular905 { 906 b = p intersectsyz(s,J,0,whichengine);907 } 908 } 909 else // p intersect: linreduce910 { 911 b = p intersect(s,J);1134 else // pIntersectSyz::non-modular 1135 { 1136 b = pIntersectSyz(s,J,0,whichengine); 1137 } 1138 } 1139 else // pIntersect: linReduce 1140 { 1141 b = pIntersect(s,J); 912 1142 } 913 1143 setring save; … … 926 1156 proc bfct (poly f, list #) 927 1157 "USAGE: bfct(f [,s,t,v]); f a poly, s,t optional ints, v an optional intvec 928 RETURN: list of roots of the Bernstein-Sato polynomial bs(f) and their multiplicies 929 PURPOSE: compute the global Bernstein-Sato polynomial for a hypersurface, defined by f, according to the algorithm by Masayuki Noro 930 NOTE: In this proc, the initial Malgrange ideal is computed. 931 @* Further, a system of linear equations is solved by linear reductions. 932 @* If s<>0, @code{std} is used for Groebner basis computations, 1158 RETURN: list of ideal and intvec 1159 PURPOSE: computes the roots of the Bernstein-Sato polynomial b(s) 1160 @* for the hypersurface defined by f. 1161 ASSUME: The basering is a commutative polynomial ring in char 0. 1162 BACKGROUND: In this proc, the initial Malgrange ideal is computed according to the algorithm 1163 @* by Masayuki Noro and then a system of linear equations is solved by linear reductions. 1164 NOTE: In the output list, the ideal contains all the roots 1165 @* and the intvec their multiplicities. 1166 @* If s<>0, @code{std} is used for GB computations, 933 1167 @* otherwise, and by default, @code{slimgb} is used. 934 1168 @* If t<>0, a matrix ordering is used for Groebner basis computations, 935 1169 @* otherwise, and by default, a block ordering is used. 936 @* If v is a positive weight vector, v is used for homogenization computations, 1170 @* If v is a positive weight vector, v is used for homogenization computations, 937 1171 @* otherwise and by default, no weights are used. 938 @*If printlevel=1, progress debug messages will be printed,1172 DISPLAY: If printlevel=1, progress debug messages will be printed, 939 1173 @* if printlevel>=2, all the debug messages will be printed. 940 1174 EXAMPLE: example bfct; shows examples … … 965 1199 if (size(#)>2) 966 1200 { 967 if (typeof(#[3])=="intvec" && size(#[3])==n && ispositive(#[3])==1)1201 if (typeof(#[3])=="intvec" && size(#[3])==n && allPositive(#[3])==1) 968 1202 { 969 1203 u0 = #[3]; … … 985 1219 } 986 1220 987 proc bfctsyz (poly f, list #) 988 "USAGE: bfctsyz(f [,r,s,t,u,v]); f a poly, r,s,t,u optional ints, v an optional intvec 989 RETURN: list of roots of the Bernstein-Sato polynomial bs(f) and its multiplicies 990 PURPOSE: compute the global Bernstein-Sato polynomial for a hypersurface, defined by f, according to the algorithm by Masayuki Noro 991 NOTE: In this proc, the initial Malgrange ideal is computed. 992 @* Further, a system of linear equations is solved by computing syzygies. 993 @* If r<>0, @code{std} is used for Groebner basis computations in characteristic 0, 1221 proc bfctSyz (poly f, list #) 1222 "USAGE: bfctSyz(f [,r,s,t,u,v]); f a poly, r,s,t,u optional ints, v an optional intvec 1223 RETURN: list of ideal and intvec 1224 PURPOSE: computes the roots of the Bernstein-Sato polynomial b(s) 1225 @* for the hypersurface defined by f 1226 ASSUME: The basering is a commutative polynomial ring in char 0. 1227 BACKGROUND: In this proc, the initial Malgrange ideal is computed according to the algorithm 1228 @* by Masayuki Noro and then a system of linear equations is solved by computing syzygies. 1229 NOTE: In the output list, the ideal contains all the roots 1230 @* and the intvec their multiplicities. 1231 @* If r<>0, @code{std} is used for GB computations in characteristic 0, 994 1232 @* otherwise, and by default, @code{slimgb} is used. 995 @* If s<>0, a matrix ordering is used for G roebner basis computations,996 @* otherwise,and by default, a block ordering is used.997 @* If t<>0, the computation of the intersection is solely performed over charasteristic 0,998 @* otherwise and by default, a modular method is used.999 @* If u<>0 and by default, @code{std} is used for G roebner basis computations in characteristic >0,1000 @* otherwise, @code{slimgb} is used.1001 @* If v is a positive weight vector, v is used for homogenization computations,1002 @* otherwise and by default, no weights are used.1003 @*If printlevel=1, progress debug messages will be printed,1233 @* If s<>0, a matrix ordering is used for GB computations, otherwise, 1234 @* and by default, a block ordering is used. 1235 @* If t<>0, the computation of the intersection is solely performed over 1236 @* charasteristic 0, otherwise and by default, a modular method is used. 1237 @* If u<>0 and by default, @code{std} is used for GB computations in 1238 @* characteristic >0, otherwise, @code{slimgb} is used. 1239 @* If v is a positive weight vector, v is used for homogenization 1240 @* computations, otherwise and by default, no weights are used. 1241 DISPLAY: If printlevel=1, progress debug messages will be printed, 1004 1242 @* if printlevel>=2, all the debug messages will be printed. 1005 1243 EXAMPLE: example bfct; shows examples … … 1018 1256 int whichengine = 0; // default 1019 1257 int methodord = 0; // default 1020 int p intersectchar = 0; // default1258 int pIntersectchar = 0; // default 1021 1259 int modengine = 1; // default 1022 1260 intvec u0 = 0; // default … … 1037 1275 if (typeof(#[3])=="int" || typeof(#[3])=="number") 1038 1276 { 1039 p intersectchar = int(#[3]);1277 pIntersectchar = int(#[3]); 1040 1278 } 1041 1279 if (size(#)>3) … … 1047 1285 if (size(#)>4) 1048 1286 { 1049 if (typeof(#[5])=="intvec" && size(#[5])==n && ispositive(#[5])==1)1287 if (typeof(#[5])=="intvec" && size(#[5])==n && allPositive(#[5])==1) 1050 1288 { 1051 1289 u0 = #[5]; … … 1056 1294 } 1057 1295 } 1058 list b = bfctengine(f,0,whichengine,methodord,1,p intersectchar,modengine,u0);1296 list b = bfctengine(f,0,whichengine,methodord,1,pIntersectchar,modengine,u0); 1059 1297 return(b); 1060 1298 } … … 1064 1302 ring r = 0,(x,y),dp; 1065 1303 poly f = x^2+y^3+x*y^2; 1066 bfct syz(f);1304 bfctSyz(f); 1067 1305 intvec v = 3,2; 1068 bfctsyz(f,0,1,1,0,v); 1069 } 1070 1071 proc bfctideal (ideal I, intvec w, list #) 1072 "USAGE: bfctideal(I,w[,s,t]); I an ideal, w an intvec, s,t optional ints 1073 RETURN: list of roots and their multiplicies of the global b-function of I w.r.t. the weight vector (-w,w) 1074 PURPOSE: compute the global b-function of an ideal according to the algorithm by M. Noro 1075 NOTE: Assume, I is an ideal in the n-th Weyl algebra where the sequence of the 1076 @* variables is x(1),...,x(n),D(1),...,D(n). 1077 @* If s<>0, @code{std} is used for Groebner basis computations in characteristic 0, 1306 bfctSyz(f,0,1,1,0,v); 1307 } 1308 1309 proc bfctIdeal (ideal I, intvec w, list #) 1310 "USAGE: bfctIdeal(I,w[,s,t]); I an ideal, w an intvec, s,t optional ints 1311 RETURN: list of ideal and intvec 1312 PURPOSE: computes the roots of the global b-function of I wrt the weight vector (-w,w). 1313 ASSUME: The basering is the n-th Weyl algebra in char 0, where the sequence of 1314 @* the variables is x(1),...,x(n),D(1),...,D(n). 1315 BACKGROUND: In this proc, the initial ideal of I is computed according to the algorithm by 1316 @* Masayuki Noro and then a system of linear equations is solved by linear reductions. 1317 NOTE: In the output list, the ideal contains all the roots 1318 @* and the intvec their multiplicities. 1319 @* If s<>0, @code{std} is used for GB computations in characteristic 0, 1078 1320 @* otherwise, and by default, @code{slimgb} is used. 1079 @* If t<>0, a matrix ordering is used for G roebner basis computations,1080 @* otherwise,and by default, a block ordering is used.1081 @*If printlevel=1, progress debug messages will be printed,1321 @* If t<>0, a matrix ordering is used for GB computations, otherwise, 1322 @* and by default, a block ordering is used. 1323 DISPLAY: If printlevel=1, progress debug messages will be printed, 1082 1324 @* if printlevel>=2, all the debug messages will be printed. 1083 1325 EXAMPLE: example bfctideal; shows examples … … 1104 1346 } 1105 1347 } 1106 ideal J = initial ideal(I,-w,w,whichengine,methodord);1348 ideal J = initialIdeal(I,-w,w,whichengine,methodord); 1107 1349 poly s; 1108 1350 for (i=1; i<=n; i++) … … 1110 1352 s = s + w[i]*var(i)*var(n+i); 1111 1353 } 1112 vector b = p intersect(s,J);1354 vector b = pIntersect(s,J); 1113 1355 list l = listofroots(b,0); 1114 1356 return(l); … … 1120 1362 def D = Weyl(); 1121 1363 setring D; 1122 ideal I = 3*x^2*Dy+2*y*Dx,2*x*Dx+3*y*Dy+6;1364 ideal I = std(3*x^2*Dy+2*y*Dx,2*x*Dx+3*y*Dy+6); I; 1123 1365 intvec w1 = 1,1; 1124 1366 intvec w2 = 1,2; 1125 1367 intvec w3 = 2,3; 1126 bfctideal(I,w1); 1127 bfctideal(I,w2,1); 1128 bfctideal(I,w3,0,1); 1129 } 1130 1131 1132 proc bfctonestep (poly f,list #) 1133 "USAGE: bfctonestep(f [,s,t]); f a poly, s,t optional ints 1134 RETURN: list of roots of the Bernstein-Sato polynomial bs(f) and its multiplicies 1135 PURPOSE: compute the global Bernstein-Sato polynomial for a hypersurface, defined by f, using only one Groebner basis computation 1136 NOTE: If s<>0, @code{std} is used for the Groebner basis computation, otherwise, 1368 bfctIdeal(I,w1); 1369 bfctIdeal(I,w2,1); 1370 bfctIdeal(I,w3,0,1); 1371 } 1372 1373 proc bfctOneGB (poly f,list #) 1374 "USAGE: bfctOneGB(f [,s,t]); f a poly, s,t optional ints 1375 RETURN: list of ideal and intvec 1376 PURPOSE: computes the roots of the Bernstein-Sato polynomial b(s) for the 1377 @* hypersurface defined by f, using only one GB computation 1378 ASSUME: The basering is a commutative polynomial ring in char 0. 1379 BACKGROUND: In this proc, the initial Malgrange ideal is computed based on the 1380 @* algorithm by Masayuki Noro and combined with an elimination ordering. 1381 NOTE: In the output list, the ideal contains all the roots 1382 @* and the intvec their multiplicities. 1383 @* If s<>0, @code{std} is used for the GB computation, otherwise, 1137 1384 @* and by default, @code{slimgb} is used. 1138 @* If t<>0, a matrix ordering is used for G roebner basiscomputations,1385 @* If t<>0, a matrix ordering is used for GB computations, 1139 1386 @* otherwise, and by default, a block ordering is used. 1140 @*If printlevel=1, progress debug messages will be printed,1387 DISPLAY: If printlevel=1, progress debug messages will be printed, 1141 1388 @* if printlevel>=2, all the debug messages will be printed. 1142 EXAMPLE: example bfct onestep; shows examples1389 EXAMPLE: example bfctOneGB; shows examples 1143 1390 " 1144 1391 { … … 1146 1393 def save = basering; 1147 1394 int n = nvars(save); 1395 int noofvars = 2*n+4; 1148 1396 int i; 1149 1397 int whichengine = 0; // default … … 1163 1411 } 1164 1412 } 1165 def DDh = initialidealengine("bfctonestep", whichengine, methodord, f); 1413 intvec uv; 1414 uv[n+3] = 1; 1415 ring r = 0,(x(1..n)),dp; 1416 poly f = fetch(save,f); 1417 uv[1] = -1; uv[noofvars] = 0; 1418 // for the ordering 1419 intvec @a; @a = 1:noofvars; @a[2] = 2; 1420 intvec @a2 = @a; @a2[2] = 0; @a2[2*n+4] = 0; 1421 if (methodord == 0) // default: block ordering 1422 { 1423 ring Dh = 0,(t,s,x(n..1),Dt,D(n..1),h),(a(@a),a(@a2),a(uv),dp(noofvars-1),lp(1)); 1424 } 1425 else // M() ordering 1426 { 1427 intmat @Ord[noofvars][noofvars]; 1428 @Ord[1,1..noofvars] = uv; 1429 @Ord[2,1..noofvars] = 1:(noofvars-1); 1430 for (i=1; i<=noofvars-2; i++) 1431 { 1432 @Ord[2+i,noofvars - i] = -1; 1433 } 1434 dbprint(ppl,"weights for ordering:",transpose(@a)); 1435 dbprint(ppl,"the ordering matrix:",@Ord); 1436 ring Dh = 0,(t,s,x(n..1),Dt,D(n..1),h),(a(@a),a(@a2),M(@Ord)); 1437 } 1438 dbprint(ppl,"the ring Dh:",Dh); 1439 // non-commutative relations 1440 matrix @relD[noofvars][noofvars]; 1441 @relD[1,2] = t*h^2;// s*t = t*s+t*h^2 1442 @relD[2,n+3] = Dt*h^2;// Dt*s = s*Dt+h^2 1443 @relD[1,n+3] = h^2; 1444 for (i=1; i<=n; i++) 1445 { 1446 @relD[i+2,n+3+i] = h^2; 1447 } 1448 dbprint(ppl,"nc relations:",@relD); 1449 def DDh = nc_algebra(1,@relD); 1166 1450 setring DDh; 1167 dbprint(ppl, "the initial ideal:", string(matrix(inF))); 1451 dbprint(ppl,"computing in ring",DDh); 1452 ideal I; 1453 poly f = imap(r,f); 1454 kill r; 1455 f = homog(f,h); 1456 I = t - f, t*Dt - s; // defining the Malgrange ideal 1457 for (i=1; i<=n; i++) 1458 { 1459 I = I, D(i)+diff(f,x(i))*Dt; 1460 } 1461 dbprint(ppl, "starting Groebner basis computation with engine:", whichengine); 1462 I = engine(I, whichengine); 1463 dbprint(ppl, "finished Groebner basis computation"); 1464 dbprint(ppl, "I before dehomogenization is" ,I); 1465 I = subst(I,h,1); // dehomogenization 1466 dbprint(ppl, "I after dehomogenization is" ,I); 1467 I = inForm(I,uv); // we are only interested in the initial form w.r.t. uv 1468 dbprint(ppl, "the initial ideal:", string(matrix(I))); 1168 1469 intvec tonselect = 1; 1169 for (i=3; i<=2*n+4; i++) 1170 { 1171 tonselect = tonselect,i; 1172 } 1173 inF = nselect(inF,tonselect); 1174 dbprint(ppl, "generators containing only s:", string(matrix(inF))); 1175 inF = engine(inF, whichengine); // is now a principal ideal; 1470 for (i=3; i<=2*n+4; i++) { tonselect = tonselect,i; } 1471 I = nselect(I,tonselect); 1472 dbprint(ppl, "generators containing only s:", string(matrix(I))); 1473 I = engine(I, whichengine); // is now a principal ideal; 1176 1474 setring save; 1177 1475 ideal J; J[2] = var(1); 1178 1476 map @m = DDh,J; 1179 ideal inF = @m(inF);1180 poly p = inF[1];1477 ideal I = @m(I); 1478 poly p = I[1]; 1181 1479 list l = listofroots(p,1); 1182 1480 return(l); … … 1187 1485 ring r = 0,(x,y),dp; 1188 1486 poly f = x^2+y^3+x*y^2; 1189 bfctonestep(f); 1190 bfctonestep(f,1,1); 1191 } 1192 1193 proc bfctann (poly f, list #) 1194 "USAGE: bfctann(f [,r]); f a poly, r an optional int 1195 RETURN: list of roots of the Bernstein-Sato polynomial bs(f) and their multiplicies 1196 PURPOSE: compute the global Bernstein-Sato polynomial for a hypersurface, defined by f 1197 NOTE: In this proc, ann(f^s) is computed. 1198 @* If r<>0, @code{std} is used for Groebner basis computations, 1487 bfctOneGB(f); 1488 bfctOneGB(f,1,1); 1489 } 1490 1491 proc bfctAnn (poly f, list #) 1492 "USAGE: bfctAnn(f [,r]); f a poly, r an optional int 1493 RETURN: list of ideal and intvec 1494 PURPOSE: computes the roots of the Bernstein-Sato polynomial b(s) 1495 @* for the hypersurface defined by f 1496 ASSUME: The basering is a commutative polynomial ring in char 0. 1497 BACKGROUND: In this proc, ann(f^s) is computed and then a system of linear 1498 @* equations is solved by linear reductions. 1499 NOTE: In the output list, the ideal contains all the roots 1500 @* and the intvec their multiplicities. 1501 @* If r<>0, @code{std} is used for GB computations, 1199 1502 @* otherwise, and by default, @code{slimgb} is used. 1200 @*If printlevel=1, progress debug messages will be printed,1503 DISPLAY: If printlevel=1, progress debug messages will be printed, 1201 1504 @* if printlevel>=2, all the debug messages will be printed. 1202 1505 EXAMPLE: example bfctann; shows examples … … 1221 1524 ring r = 0,(x,y),dp; 1222 1525 poly f = x^2+y^3+x*y^2; 1223 bfctann(f); 1224 } 1225 1226 static proc hardexamples () 1526 bfctAnn(f); 1527 } 1528 1529 /* 1530 //static proc hardexamples () 1227 1531 { 1228 1532 // some hard examples … … 1246 1550 bfct(xyzreiffen45); 1247 1551 } 1248 1552 */
Note: See TracChangeset
for help on using the changeset viewer.