Changeset 9e7006 in git
- Timestamp:
- Jun 13, 2008, 7:56:31 PM (16 years ago)
- Branches:
- (u'spielwiese', '17f1d200f27c5bd38f5dfc6e8a0879242279d1d8')
- Children:
- ca4a07322f31d377c0c316a145437504fb8e6be0
- Parents:
- 07f307dc1e4a8fd679ddd3901344873242b79c3a
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
Singular/LIB/dmod.lib
r07f307d r9e7006 1 1 ////////////////////////////////////////////////////////////////////////////// 2 version="$Id: dmod.lib,v 1.2 6 2008-02-20 15:56:57 SingularExp $";2 version="$Id: dmod.lib,v 1.27 2008-06-13 17:56:31 levandov Exp $"; 3 3 category="Noncommutative"; 4 4 info=" … … 32 32 33 33 GUIDE: 34 @* - Ann F^s = I = I(F^s) = LD in D(R)[s] can be computed by SannfsBM ,SannfsOT, SannfsLOT34 @* - Ann F^s = I = I(F^s) = LD in D(R)[s] can be computed by SannfsBM SannfsOT, SannfsLOT 35 35 @* - Ann^(1) F^s in D(R)[s] can be computed by Sannfslog 36 36 @* - global Bernstein polynomial bs resp. BS in K[s] can be computed by bernsteinBM … … 75 75 "; 76 76 77 LIB "matrix.lib"; // for submat 77 78 LIB "nctools.lib"; 78 79 LIB "elim.lib"; … … 1386 1387 poly F = imap(r,F); 1387 1388 def B = annfs2(LD,F); 1389 setring B; 1390 LD; 1391 BS; 1392 } 1393 1394 1395 // try to replace s with -s-1 => data is shorter as in annfs2 1396 // and use Macaulay's reduceB strategy, that is add 1397 // not F but <F,dF/dx1,...,dF/dxN>; the resulting B-function 1398 // has to be multiplied with (s+1) at the very end 1399 proc annfsRB(ideal I, poly F, list #) 1400 "USAGE: annfsRB(I, F [,eng]); I an ideal, F a poly, eng an optional int 1401 RETURN: ring 1402 PURPOSE: compute the annihilator ideal of f^s in the Weyl Algebra, based on the 1403 output of Sannfs like procedure 1404 NOTE: activate this ring with the @code{setring} command. In this ring, 1405 @* - the ideal LD (which is a Groebner basis) is the annihilator of f^s, 1406 @* - the list BS contains the roots with multiplicities of a Bernstein polynomial of f. 1407 @* If eng <>0, @code{std} is used for Groebner basis computations, 1408 @* otherwise and by default @code{slimgb} is used. 1409 @* Uses the shorter form of expressions in the variable s (the idea of Noro). 1410 @* If printlevel=1, progress debug messages will be printed, 1411 @* if printlevel>=2, all the debug messages will be printed. 1412 EXAMPLE: example annfsRB; shows examples 1413 " 1414 { 1415 int eng = 0; 1416 if ( size(#)>0 ) 1417 { 1418 if ( typeof(#[1]) == "int" ) 1419 { 1420 eng = int(#[1]); 1421 } 1422 } 1423 def @R2 = basering; 1424 int ppl = printlevel-voice+2; 1425 // we're in D_n[s], where the elim ord for s is set 1426 // switch to comm. ring in X's and compute the GB of Tjurina ideal 1427 dbprint(ppl,"// -1-0- creating K[x] and Tjurina ideal"); 1428 list nL = ringlist(@R2); 1429 list temp,t2; 1430 temp[1] = nL[1]; 1431 temp[4] = nL[4]; 1432 int @n = int((nvars(@R2)-1)/2); // # of x's 1433 int i; 1434 for (i=1; i<=@n; i++) 1435 { 1436 t2[i] = nL[2][i]; 1437 } 1438 temp[2] = t2; 1439 t2 = 0; 1440 t2[1] = nL[3][1]; // more weights than vars? 1441 t2[2] = nL[3][3]; 1442 temp[3] = t2; 1443 def @R22 = ring(temp); 1444 setring @R22; 1445 poly F = imap(@R2,F); 1446 ideal J = F; 1447 for (i=1; i<=@n; i++) 1448 { 1449 J = J, diff(F,var(i)); 1450 } 1451 J = engine(J,eng); 1452 dbprint(ppl,"// -1-1- finished computing the GB of Tjurina ideal"); 1453 dbprint(ppl-1, J); 1454 setring @R2; 1455 ideal JF = imap(@R22,J); 1456 kill @R22; 1457 attrib(JF,"isSB",1); // embedded comm ring is used 1458 ideal J = NF(I,JF); 1459 dbprint(ppl,"// -1-2- finished computing the NF of I wrt Tjurina ideal"); 1460 dbprint(ppl-1, J2); 1461 // make leadcoeffs positive 1462 J = subst(J,s,-s-1); 1463 for (i=1; i<= ncols(J); i++) 1464 { 1465 if (leadcoef(J[i]) <0 ) 1466 { 1467 J[i] = -J[i]; 1468 } 1469 } 1470 J = J,JF; 1471 ideal M = engine(J,eng); 1472 int Nnew = nvars(@R2); 1473 ideal K2 = nselect(M,1,Nnew-1); 1474 dbprint(ppl,"// -2-0- _x,_Dx are eliminated in basering"); 1475 dbprint(ppl-1, K2); 1476 // the ring @R3 and the search for minimal negative int s 1477 ring @R3 = 0,s,dp; 1478 dbprint(ppl,"// -2-1- the ring @R3 i.e. K[s] is ready"); 1479 ideal K3 = imap(@R2,K2); 1480 poly p = K3[1]; 1481 p = s*p; // mult with the lost (s+1) factor 1482 dbprint(ppl,"// -2-2- factorization"); 1483 // ideal P = factorize(p,1); //without constants and multiplicities 1484 // "--------- b-function factorizes into ---------"; P; 1485 // convert factors to the list of their roots with mults 1486 // assume all factors are linear 1487 // ideal BS = normalize(P); 1488 // BS = subst(BS,s,0); 1489 // BS = -BS; 1490 list P = factorize(p); //with constants and multiplicities 1491 ideal bs; intvec m; //the Bernstein polynomial is monic, so we are not interested in constants 1492 for (i=2; i<= size(P[1]); i++) //we delete P[1][1] and P[2][1] 1493 { 1494 bs[i-1] = P[1][i]; bs[i-1] = subst(bs[i-1],s,-s-1); 1495 m[i-1] = P[2][i]; 1496 } 1497 int sP = minIntRoot(bs,1); 1498 bs = normalize(bs); 1499 bs = -subst(bs,s,0); 1500 dbprint(ppl,"// -2-3- minimal integer root found"); 1501 dbprint(ppl-1, sP); 1502 //TODO: sort BS! 1503 // --------- substitute s found in the ideal --------- 1504 // --------- going back to @R and substitute --------- 1505 setring @R2; 1506 K2 = subst(I,s,sP); 1507 // create the ordinary Weyl algebra and put the result into it, 1508 // thus creating the ring @R5 1509 // keep: N, i,j,s, tmp, RL 1510 Nnew = Nnew - 1; // former 2*N; 1511 // list RL = ringlist(save); // is defined earlier 1512 // kill Lord, tmp, iv; 1513 list L = 0; 1514 list Lord, tmp; 1515 intvec iv; 1516 list RL = ringlist(basering); 1517 L[1] = RL[1]; 1518 L[4] = RL[4]; //char, minpoly 1519 // check whether vars have admissible names -> done earlier 1520 // list Name = RL[2]M 1521 // DName is defined earlier 1522 list NName; // = RL[2]; // skip the last var 's' 1523 for (i=1; i<=Nnew; i++) 1524 { 1525 NName[i] = RL[2][i]; 1526 } 1527 L[2] = NName; 1528 // dp ordering; 1529 string s = "iv="; 1530 for (i=1; i<=Nnew; i++) 1531 { 1532 s = s+"1,"; 1533 } 1534 s[size(s)] = ";"; 1535 execute(s); 1536 tmp = 0; 1537 tmp[1] = "dp"; // string 1538 tmp[2] = iv; // intvec 1539 Lord[1] = tmp; 1540 kill s; 1541 tmp[1] = "C"; 1542 iv = 0; 1543 tmp[2] = iv; 1544 Lord[2] = tmp; 1545 tmp = 0; 1546 L[3] = Lord; 1547 // we are done with the list 1548 // Add: Plural part 1549 def @R4@ = ring(L); 1550 setring @R4@; 1551 int N = Nnew/2; 1552 matrix @D[Nnew][Nnew]; 1553 for (i=1; i<=N; i++) 1554 { 1555 @D[i,N+i]=1; 1556 } 1557 def @R4 = nc_algebra(1,@D); 1558 setring @R4; 1559 kill @R4@; 1560 dbprint(ppl,"// -3-1- the ring @R4 is ready"); 1561 dbprint(ppl-1, @R4); 1562 ideal K4 = imap(@R2,K2); 1563 option(redSB); 1564 dbprint(ppl,"// -3-2- the final cosmetic std"); 1565 K4 = engine(K4,eng); // std does the job too 1566 // total cleanup 1567 ideal bs = imap(@R3,bs); 1568 kill @R3; 1569 list BS = bs,m; 1570 export BS; 1571 ideal LD = K4; 1572 export LD; 1573 return(@R4); 1574 } 1575 example 1576 { "EXAMPLE:"; echo = 2; 1577 ring r = 0,(x,y,z),Dp; 1578 poly F = x^3+y^3+z^3; 1579 printlevel = 0; 1580 def A = SannfsBM(F); 1581 setring A; 1582 LD; 1583 poly F = imap(r,F); 1584 def B = annfsRB(LD,F); 1388 1585 setring B; 1389 1586 LD; … … 4950 5147 } 4951 5148 5149 proc annRat(poly g, poly f) 5150 "USAGE: annRat (g,f); f, g polynomials 5151 RETURN: ring 5152 PURPOSE: compute the ideal in Weyl algebra, annihilating the rational function g/f 5153 NOTE: activate the output ring with the @code{setring} command. 5154 @* In the output ring: 5155 @* - the ideal RLD (which is given in a Groebner basis) is the annihilator. 5156 @* If @code{printlevel}=1, progress debug messages will be printed, 5157 @* if @code{printlevel}>=2, all the debug messages will be printed. 5158 EXAMPLE: example annRat; shows examples 5159 { 5160 // computes the annihilator of g/f 5161 def save = basering; 5162 int ppl = printlevel-voice+2; 5163 dbprint(ppl,"// -1-[annRat] computing the ann f^s"); 5164 def @R1 = SannfsBM(f); 5165 setring @R1; 5166 poly f = imap(save,f); 5167 int i,mir; 5168 int isr = 0; // checkRoot1(LD,f,1); // roots are negative, have to enter positive int 5169 if (!isr) 5170 { 5171 // -1 is not the root 5172 // find the m.i.r iteratively 5173 mir = 0; 5174 for(i=nvars(save)+1; i>=1; i--) 5175 { 5176 isr = checkRoot1(LD,f,i); 5177 if (isr) { mir =-i; break; } 5178 } 5179 if (mir ==0) 5180 { 5181 "No integer root found! Aborting computations, inform the authors!"; 5182 return(0); 5183 } 5184 // now mir == i is m.i.r. 5185 } 5186 else 5187 { 5188 // -1 is the m.i.r 5189 mir = -1; 5190 } 5191 dbprint(ppl,"// -2-[annRat] the minimal integer root is "); 5192 dbprint(ppl-1, mir); 5193 // use annfspecial 5194 dbprint(ppl,"// -3-[annRat] running annfspecial "); 5195 ideal AF = annfspecial(LD,f,mir,-1); // ann f^{-1} 5196 // LD = subst(LD,s,j); 5197 // LD = engine(LD,0); 5198 // modify the ring: throw s away 5199 // output ring comes from SannfsBM 5200 list U = ringlist(@R1); 5201 list tmp; // variables 5202 for(i=1; i<=size(U[2])-1; i++) 5203 { 5204 tmp[i] = U[2][i]; 5205 } 5206 U[2] = tmp; 5207 tmp = 0; 5208 tmp[1] = U[3][1]; // x,Dx block 5209 tmp[2] = U[3][3]; // module block 5210 U[3] = tmp; 5211 tmp = 0; 5212 tmp = U[1],U[2],U[3],U[4]; 5213 def @R2 = ring(tmp); 5214 setring @R2; 5215 // now supply with Weyl algebra relations 5216 int N = nvars(@R2)/2; 5217 matrix @D[2*N][2*N]; 5218 for(i=1; i<=N; i++) 5219 { 5220 @D[i,N+i]=1; 5221 } 5222 def @R3 = nc_algebra(1,@D); 5223 setring @R3; 5224 dbprint(ppl,"// - -[annRat] ring without s is ready:"); 5225 dbprint(ppl-1,@R3); 5226 poly g = imap(save,g); 5227 matrix G[1][1] = g; 5228 matrix LL = matrix(imap(@R1,AF)); 5229 kill @R1; kill @R2; 5230 dbprint(ppl,"// -4-[annRat] running modulo"); 5231 ideal RLD = modulo(G,LL); 5232 dbprint(ppl,"// -4-[annRat] running GB on the final result"); 5233 RLD = engine(RLD,0); 5234 export RLD; 5235 return(@R3); 5236 } 5237 example 5238 { 5239 "EXAMPLE:"; echo = 2; 5240 ring r = 0,(x,y),dp; 5241 poly g = 2*x*y; 5242 poly f = x^2 - y^3; 5243 def B = annRat(g,f); 5244 setring B; 5245 RLD; 5246 // Now, compare with the output of Macaulay2: 5247 ideal tst = 3*x*Dx + 2*y*Dy + 1, y^3*Dy^2 - x^2*Dy^2 + 6*y^2*Dy + 6*y, 9*y^2*Dx^2*Dy - 4*y*Dy^3 + 27*y*Dx^2 + 2*Dy^2, 9*y^3*Dx^2 - 4*y^2*Dy^2 + 10*y*Dy -10; 5248 option(redSB); 5249 option(redTail); 5250 RLD = groebner(RLD); 5251 tst = groebner(tst); 5252 print(matrix(NF(RLD,tst))); print(matrix(NF(tst,RLD))); 5253 } 5254 5255 static proc ex_annRat() 5256 { 5257 // more complicated example 5258 ring r = 0,(x,y,z),dp; 5259 poly f = x3+y3+z3; // mir = -2 5260 poly g = x*y*z; 5261 def A = annRat(g,f); 5262 setring A; 5263 } 5264 5265 proc annPoly(poly f) 5266 { 5267 // computes a system of linear PDEs with polynomial coeffs for f 5268 } 5269 5270 4952 5271 static proc exCheckGenericity() 4953 5272 {
Note: See TracChangeset
for help on using the changeset viewer.