Changeset f75297 in git for Singular/LIB
- Timestamp:
- Mar 4, 2011, 1:01:27 AM (13 years ago)
- Branches:
- (u'spielwiese', 'fe61d9c35bf7c61f2b6cbf1b56e25e2f08d536cc')
- Children:
- 8eea069dd83d32f7e8b90cd5e5ec75124c7d7903
- Parents:
- a8f29f505ce6c0d6ff17e0e4d9637d320299deee
- Location:
- Singular/LIB
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
Singular/LIB/bfun.lib
ra8f29f rf75297 41 41 PROCEDURES: 42 42 bfct(f[,s,t,v]); compute the BS polynomial of f with linear reductions 43 bfctSyz(f[,r,s,t,u,v]); compute the BS polynomial of f with syzygy-solver44 bfctAnn(f[,s]); compute the BS polynomial of f via Ann f^s + f45 bfctOneGB(f[,s,t]); compute the BS polynomial of f by just one GB computation46 bfctIdeal(I,w[,s,t]); compute the b-function of ideal w.r.t. weight47 pIntersect(f,I[,s]); intersection of ideal with subalgebra K[f] for a polynomial f43 bfctSyz(f[,r,s,t,u,v]); compute the BS polynomial of f with syzygy-solver 44 bfctAnn(f[,s]); compute the BS polynomial of f via Ann f^s + f 45 bfctOneGB(f[,s,t]); compute the BS polynomial of f by just one GB computation 46 bfctIdeal(I,w[,s,t]); compute the b-function of ideal w.r.t. weight 47 pIntersect(f,I[,s]); intersection of ideal with subalgebra K[f] for a polynomial f 48 48 pIntersectSyz(f,I[,p,s,t]); intersection of ideal with subalgebra K[f] with syz-solver 49 49 linReduce(f,I[,s]); reduce a polynomial by linear reductions w.r.t. ideal 50 linReduceIdeal(I,[s,t]); interreduce generators of ideal by linear reductions50 linReduceIdeal(I,[s,t]); interreduce generators of ideal by linear reductions 51 51 linSyzSolve(I[,s]); compute a linear dependency of elements of ideal I 52 53 allPositive(v); checks whether all entries of an intvec are positive 54 scalarProd(v,w); computes the standard scalar product of two intvecs 55 vec2poly(v[,i]); constructs an univariate polynomial with given coefficients 56 52 57 53 58 SEE ALSO: dmod_lib, dmodapp_lib, dmodvar_lib, gmssing_lib … … 58 63 "; 59 64 60 //AUXILIARY PROCEDURES: 61 // 62 //allPositive(v); checks whether all entries of an intvec are positive 63 //scalarProd(v,w); computes the standard scalar product of two intvecs 64 //vec2poly(v[,i]); constructs an univariate polynomial with given coefficients 65 66 67 /* 68 CHANGELOG 69 70 03.03.11: 71 - simplified scalarProd 72 - fixed bug in bfct when user used vars t,Dt 73 - now bFactor is used by bfct, bfctAnn, i.e. the static procs 74 addRoot, listofroots are superfluous 75 - fixed printlevel/debug message issue in bfct, bfctAnn 76 - fixed small issue for zero ideal input in linReduceIdeal 77 */ 78 65 79 66 80 … … 242 256 " 243 257 { 244 int i; int sp;245 258 if (size(v)!=size(w)) 246 259 { … … 249 262 else 250 263 { 251 for (i=1; i<=size(v);i++) 252 { 253 sp = sp + v[i]*w[i]; 254 } 255 } 256 return(sp); 264 intvec u = transpose(v)*w; 265 } 266 return(u[1]); 257 267 } 258 268 example … … 456 466 } 457 467 } 468 if (sI == sZeros) // if I=0,0,...,0, we now have one too much by construction due to sort 469 { 470 J = J[1..sZeros]; 471 } 458 472 if (remembercoeffs <> 0) { return(list(J,M)); } 459 473 else { return(J); } … … 1206 1220 } 1207 1221 1208 static proc listofroots (list #) 1209 { 1210 def save = basering; 1211 int n = nvars(save); 1212 int i; 1213 poly p; 1214 if (typeof(#[1])=="vector") 1215 { 1216 vector b = #[1]; 1217 for (i=1; i<=nrows(b); i++) 1218 { 1219 p = p + b[i]*(var(1))^(i-1); 1220 } 1221 } 1222 else 1223 { 1224 p = #[1]; 1225 } 1226 int substitution = int(#[2]); 1227 string s = safeVarName("s"); 1228 list RL = ringlist(save); RL = RL[1..4]; 1229 RL[2] = list(s); RL[3] = list(list("dp",intvec(1)),list("C",0)); 1230 def S = ring(RL); setring S; 1231 ideal J; 1232 for (i=1; i<=n; i++) 1233 { 1234 J[i] = var(1); 1235 } 1236 map @m = save,J; 1237 poly p = @m(p); 1238 if (substitution == 1) 1239 { 1240 p = subst(p,var(1),-var(1)-1); 1241 } 1242 // the rest of this proc is nicked from bernsteinBM from dmod.lib 1243 list P = factorize(p);//with constants and multiplicities 1244 ideal bs; intvec m; //the BS polynomial is monic, so we are not interested in constants 1245 for (i=2; i<= size(P[1]); i++) //we delete P[1][1] and P[2][1] 1246 { 1247 bs[i-1] = P[1][i]; 1248 m[i-1] = P[2][i]; 1249 } 1250 bs = normalize(bs); 1251 bs = -subst(bs,var(1),0); 1252 setring save; 1253 ideal bs = imap(S,bs); 1254 kill S; 1255 list BS = bs,m; 1256 return(BS); 1257 } 1258 1259 static proc addRoot(number q, list L) 1260 { 1261 // add root to list in bFactor format 1262 int i,qInL; 1263 ideal I = L[1]; 1264 intvec v = L[2]; 1265 list LL; 1266 if (v == 0) 1267 { 1268 I = poly(q); 1269 v = 1; 1270 LL = I,v; 1271 } 1272 else 1273 { 1274 for (i=1; i<=ncols(I); i++) 1275 { 1276 if (I[i] == q) 1277 { 1278 qInL = i; 1279 break; 1280 } 1281 } 1282 if (qInL) 1283 { 1284 v[qInL] = v[qInL] + 1; 1285 } 1286 else 1287 { 1288 I = q,I; 1289 v = 1,v; 1290 } 1291 } 1292 LL = I,v; 1293 if (size(L) == 3) // irreducible factor 1294 { 1295 if (L[3] <> "0" && L[3] <> "1") 1296 { 1297 LL = LL + list(L[3]); 1298 } 1299 } 1300 return(LL); 1301 } 1222 /* 1223 // // listofroots and addRoots aren't needed anymore due to some modifications 1224 // 1225 // static proc listofroots (list #) 1226 // { 1227 // def save = basering; 1228 // int n = nvars(save); 1229 // int i; 1230 // poly p; 1231 // if (typeof(#[1])=="vector") 1232 // { 1233 // vector b = #[1]; 1234 // for (i=1; i<=nrows(b); i++) 1235 // { 1236 // p = p + b[i]*(var(1))^(i-1); 1237 // } 1238 // } 1239 // else 1240 // { 1241 // p = #[1]; 1242 // } 1243 // int substitution = int(#[2]); 1244 // string s = safeVarName("s"); 1245 // list RL = ringlist(save); RL = RL[1..4]; 1246 // RL[2] = list(s); RL[3] = list(list("dp",intvec(1)),list("C",0)); 1247 // def S = ring(RL); setring S; 1248 // ideal J; 1249 // for (i=1; i<=n; i++) 1250 // { 1251 // J[i] = var(1); 1252 // } 1253 // map @m = save,J; 1254 // poly p = @m(p); 1255 // if (substitution == 1) 1256 // { 1257 // p = subst(p,var(1),-var(1)-1); 1258 // } 1259 // // the rest of this proc is nicked from bernsteinBM from dmod.lib 1260 // list P = factorize(p);//with constants and multiplicities 1261 // ideal bs; intvec m; //the BS polynomial is monic, so we are not interested in constants 1262 // for (i=2; i<= size(P[1]); i++) //we delete P[1][1] and P[2][1] 1263 // { 1264 // bs[i-1] = P[1][i]; 1265 // m[i-1] = P[2][i]; 1266 // } 1267 // bs = normalize(bs); 1268 // bs = -subst(bs,var(1),0); 1269 // setring save; 1270 // ideal bs = imap(S,bs); 1271 // kill S; 1272 // list BS = bs,m; 1273 // return(BS); 1274 // } 1275 // 1276 // 1277 // static proc addRoot(number q, list L) 1278 // { 1279 // // add root to list in bFactor format 1280 // int i,qInL; 1281 // ideal I = L[1]; 1282 // intvec v = L[2]; 1283 // list LL; 1284 // if (v == 0) 1285 // { 1286 // I = poly(q); 1287 // v = 1; 1288 // LL = I,v; 1289 // } 1290 // else 1291 // { 1292 // for (i=1; i<=ncols(I); i++) 1293 // { 1294 // if (I[i] == q) 1295 // { 1296 // qInL = i; 1297 // break; 1298 // } 1299 // } 1300 // if (qInL) 1301 // { 1302 // v[qInL] = v[qInL] + 1; 1303 // } 1304 // else 1305 // { 1306 // I = q,I; 1307 // v = 1,v; 1308 // } 1309 // } 1310 // LL = I,v; 1311 // if (size(L) == 3) // irreducible factor 1312 // { 1313 // if (L[3] <> "0" && L[3] <> "1") 1314 // { 1315 // LL = LL + list(L[3]); 1316 // } 1317 // } 1318 // return(LL); 1319 // } 1320 */ 1302 1321 1303 1322 static proc bfctengine (poly f, int inorann, int whichengine, int addPD, int stdsum, int methodord, int methodpIntersect, int pIntersectchar, int modengine, intvec u0) 1304 1323 { 1305 int ppl = printlevel - voice +2; 1324 int printlevelsave = printlevel; 1325 printlevel = printlevel + 1; 1326 int ppl = printlevel - voice + 2; 1306 1327 int i; 1307 1328 def save = basering; … … 1335 1356 setring newr; 1336 1357 poly f = imap(save,f); 1358 dbprint(ppl,"// starting computation of the initial ideal of the Malgrange ideal..."); 1337 1359 def D = initialMalgrange(f,whichengine,methodord,u0); 1360 dbprint(ppl,"// ...done"); 1338 1361 setring D; 1339 1362 ideal J = inF; 1340 1363 kill inF; 1341 poly s = t*Dt;1364 poly s = var(1)*var(n+2); 1342 1365 } 1343 1366 else // bfct using Ann(f^s) 1344 1367 { 1368 dbprint(ppl,"// starting computation of the s-parametric annihilator..."); 1345 1369 def D = SannfsBFCT(f,addPD,whichengine,stdsum); 1370 dbprint(ppl,"// ...done"); 1346 1371 setring D; 1347 1372 ideal J = LD; … … 1350 1375 } 1351 1376 vector b; 1377 dbprint(ppl,"// starting to intersect with subalgebra..."); 1352 1378 // try it modular 1353 1379 if (methodpIntersect <> 0) // pIntersectSyz … … 1413 1439 b = pIntersect(s,J); 1414 1440 } 1415 if (inorann == 0) { list l = listofroots(b,1); } 1441 dbprint(ppl,"// ...done"); // with the intersection 1442 poly pb = vec2poly(b); 1443 if (inorann == 0) 1444 { 1445 pb = subst(pb,var(1),-var(1)-1); 1446 } 1416 1447 else // bfctAnn 1417 1448 { 1418 list l = listofroots(b,0);1419 1449 if (addPD) 1420 1450 { 1421 l = addRoot(-1,l); 1422 } 1423 } 1451 pb = pb*(var(1)+1); 1452 } 1453 } 1454 list l = bFactor(pb); 1424 1455 setring save; 1425 1456 list l = imap(D,l); 1457 printlevel = printlevelsave; 1426 1458 return(l); 1427 1459 } … … 1530 1562 int whichengine = 0; // default 1531 1563 int methodord = 0; // default 1532 int pIntersectchar 1564 int pIntersectchar = 0; // default 1533 1565 int modengine = 1; // default 1534 1566 intvec u0 = 0; // default … … 1821 1853 ideal I = @m(I); 1822 1854 poly p = I[1]; 1823 list l = listofroots(p,1); 1855 p = subst(p,var(1),-var(1)-1); 1856 list l = bFactor(p); 1824 1857 if (qr == 1) 1825 1858 { -
Singular/LIB/fpadim.lib
ra8f29f rf75297 38 38 @* on. The monomial x_1*x_3*x_2 for example will be stored as (1,3,2). 39 39 @* Multiplication is concatenation. Note that there is no algorithm for 40 @* computing the normal form yet, but for our case it is not needed.40 @* computing the normal form needed for our case. 41 41 @* 42 42 … … 64 64 ivHilbert(L,n[,d]); computes the Hilbert series of A/<L> in intvec format 65 65 ivKDim(L,n[,d]); computes the K-dimension of A/<L> in intvec format 66 ivMis2Base(M); computes a K-basis of the factor algebra 66 67 ivMis2Dim(M); computes the K-dimension of the factor algebra 67 68 ivOrdMisLex(M); orders a list of intvecs lexicographically … … 74 75 lpDimCheck(G); checks if the K-dimension of A/<G> is infinite 75 76 lpKDim(G[,d,n]); computes the K-dimension of A/<G> in lp format 77 lpMis2Base(M); computes a K-basis of the factor algebra 76 78 lpMis2Dim(M); computes the K-dimension of the factor algebra 77 79 lpOrdMisLex(M); orders an ideal of lp-monomials lexicographically … … 164 166 "PURPOSE:checks, if all entries in M are variable-related 165 167 " 166 {int i,j; 168 {if ((nrows(M) == 1) && (ncols(M) == 1)) {if (M[1,1] == 0){return(0);}} 169 int i,j; 167 170 for (i = 1; i <= nrows(M); i++) 168 171 {for (j = 1; j <= ncols(M); j++) … … 1229 1232 } 1230 1233 1234 proc ivMis2Base(list M) 1235 "USAGE: ivMis2Base(M); M a list of intvecs 1236 RETURN: ideal, a K-base of the given algebra 1237 PURPOSE:Computing the K-base out of given mistletoes 1238 ASSUME: - The mistletoes have to be ordered lexicographically -> OrdMisLex. 1239 @* Otherwise there might some elements missing. 1240 @* - basering is a Letterplace ring. 1241 EXAMPLE: example ivMis2Base; shows examples 1242 " 1243 { 1244 //checkAssumptions(0,M); 1245 intvec L,A; 1246 if (size(M) == 0){ERROR("There are no mistletoes, so it appears your dimension is infinite!");} 1247 if (isInList(L,M) > 0) {print("1 is a mistletoe, therefore 1 is the only basis element"); return(list(intvec(0)));} 1248 int i,j,d,s; 1249 list Rt; 1250 Rt[1] = intvec(0); 1251 L = M[1]; 1252 for (i = size(L); 1 <= i; i--) {Rt = insert(Rt,intvec(L[1..i]));} 1253 for (i = 2; i <= size(M); i++) 1254 {A = M[i]; L = M[i-1]; 1255 s = size(A); 1256 if (s > size(L)) 1257 {d = size(L); 1258 for (j = s; j > d; j--) {Rt = insert(Rt,intvec(A[1..j]));} 1259 A = A[1..d]; 1260 } 1261 if (size(L) > s){L = L[1..s];} 1262 while (A <> L) 1263 {Rt = insert(Rt, intvec(A)); 1264 if (size(A) > 1) 1265 {A = A[1..(size(A)-1)]; 1266 L = L[1..(size(L)-1)]; 1267 } 1268 else {break;} 1269 } 1270 } 1271 return(Rt); 1272 } 1273 example 1274 { 1275 "EXAMPLE:"; echo = 2; 1276 ring r = 0,(x,y),dp; 1277 def R = makeLetterplaceRing(5); // constructs a Letterplace ring 1278 R; 1279 setring R; // sets basering to Letterplace ring 1280 intvec i1 = 1,2; intvec i2 = 2,1,2; 1281 // the mistletoes are xy and yxy, which are already ordered lexicographically 1282 list L = i1,i2; 1283 ivMis2Base(L); // returns the basis of the factor algebra 1284 } 1285 1286 1231 1287 proc ivMis2Dim(list M) 1232 1288 "USAGE: ivMis2Dim(M); M a list of intvecs … … 1595 1651 @* degbound <= attrib(basering,uptodeg) holds. 1596 1652 NOTE: - If L is the list returned, then L[1] is an integer, the K-dimension, 1597 @* L[2] is an intvec, the Hilbert series and L[3] is an ideal, 1653 @* L[2] is an intvec, the Hilbert series and L[3] is an ideal, 1598 1654 @* the mistletoes 1599 1655 @* - If degbound is set, there will be a degree bound added. 0 means no … … 1729 1785 // ring is not necessary 1730 1786 lpKDim(G,0); // procedure without any degree bound 1787 } 1788 1789 proc lpMis2Base(ideal M) 1790 "USAGE: lpMis2Base(M); M an ideal 1791 RETURN: ideal, a K-basis of the factor algebra 1792 PURPOSE:Computing a K-basis out of given mistletoes 1793 ASSUME: - basering is a Letterplace ring. 1794 @* - M contains only monomials 1795 NOTE: - The mistletoes have to be ordered lexicographically -> OrdMisLex. 1796 EXAMPLE: example lpMis2Base; shows examples 1797 " 1798 {list L; 1799 L = lpId2ivLi(M); 1800 return(ivL2lpI(ivMis2Base(L))); 1801 } 1802 example 1803 { 1804 "EXAMPLE:"; echo = 2; 1805 ring r = 0,(x,y),dp; 1806 def R = makeLetterplaceRing(5); // constructs a Letterplace ring 1807 setring R; // sets basering to Letterplace ring 1808 ideal L = x(1)*y(2),y(1)*x(2)*y(3); 1809 // ideal containing the mistletoes 1810 lpMis2Base(L); // returns the K-basis of the factor algebra 1731 1811 } 1732 1812 … … 1968 2048 example ivHilbert; 1969 2049 example ivKDim; 2050 example ivMis2Base; 1970 2051 example ivMis2Dim; 1971 2052 example ivOrdMisLex; … … 1978 2059 example lpDimCheck; 1979 2060 example lpKDim; 2061 example lpMis2Base; 1980 2062 example lpMis2Dim; 1981 2063 example lpOrdMisLex; -
Singular/LIB/ncfactor.lib
ra8f29f rf75297 1894 1894 dbprint(p,"==> Deleting double entries in the resulting list."); 1895 1895 result = delete_dublicates_noteval(result); 1896 if (size(result)==0) 1897 {//only the trivial factorization could be found 1898 result = list(list(1,h)); 1899 }//only the trivial factorization could be found 1896 1900 return(result); 1897 1901 }//proc facshift … … 1968 1972 isEqualList(m,l); 1969 1973 } 1974 1975 1976 ////////////////////////////////////////////////// 1977 // Q-WEYL-SECTION 1978 ////////////////////////////////////////////////// 1979 1980 //================================================== 1981 //A function to get the i'th triangular number 1982 proc triangNum(int n) 1983 { 1984 if (n == 0) 1985 { 1986 return(0); 1987 } 1988 return (n*(n+1)/2); 1989 } 1990 1991 //==================================================* 1992 //one factorization of a homogeneous polynomial 1993 //in the first Q Weyl Algebra 1994 proc homogfacFirstQWeyl(poly h) 1995 "USAGE: homogfacFirstQWeyl(h); h is a homogeneous polynomial in the 1996 first q-Weyl algebra with respect to the weight vector [-1,1] 1997 RETURN: list 1998 PURPOSE: Computes a factorization of a homogeneous polynomial h with 1999 respect to the weight vector [-1,1] in the first q-Weyl algebra 2000 THEORY: @code{homogfacFirstQWeyl} returns a list with a factorization of the given, 2001 [-1,1]-homogeneous polynomial. If the degree of the polynomial is k with 2002 k positive, the last k entries in the output list are the second 2003 variable. If k is positive, the last k entries will be x. The other 2004 entries will be irreducible polynomials of degree zero or 1 resp. -1. 2005 SEE ALSO: homogfacFirstWeyl 2006 "{//proc homogfacFirstQWeyl 2007 int p = printlevel-voice+2;//for dbprint 2008 def r = basering; 2009 poly hath; 2010 int i; int j; 2011 intvec ivm11 = intvec(-1,1); 2012 if (!homogwithorder(h,ivm11)) 2013 {//The given polynomial is not homogeneous 2014 ERROR("Given polynomial was not [-1,1]-homogeneous"); 2015 return(list()); 2016 }//The given polynomial is not homogeneous 2017 if (h==0) 2018 { 2019 return(list(0)); 2020 } 2021 list result; 2022 int m = deg(h,ivm11); 2023 dbprint(p,"==> Splitting the polynomial in A_0 and A_k-Part"); 2024 if (m!=0) 2025 {//The degree is not zero 2026 if (m <0) 2027 {//There are more x than y 2028 hath = lift(var(1)^(-m),h)[1,1]; 2029 for (i = 1; i<=-m; i++) 2030 { 2031 result = result + list(var(1)); 2032 } 2033 }//There are more x than y 2034 else 2035 {//There are more y than x 2036 hath = lift(var(2)^m,h)[1,1]; 2037 for (i = 1; i<=m;i++) 2038 { 2039 result = result + list(var(2)); 2040 } 2041 }//There are more y than x 2042 }//The degree is not zero 2043 else 2044 {//The degree is zero 2045 hath = h; 2046 }//The degree is zero 2047 dbprint(p,"==> Done"); 2048 //beginning to transform x^i*y^i in theta(theta-1)...(theta-i+1) 2049 list mons; 2050 dbprint(p,"==> Putting the monomials in the A_0-part in a list."); 2051 for(i = 1; i<=size(hath);i++) 2052 {//Putting the monomials in a list 2053 mons = mons+list(hath[i]); 2054 }//Putting the monomials in a list 2055 dbprint(p,"==> Done"); 2056 dbprint(p,"==> Mapping this monomials to K(q)[theta]"); 2057 def characteristic = ringlist(r)[1][1]; 2058 def qparameter = ringlist(r)[1][2][1]; 2059 ring tempRing = (characteristic,q),(x,y,theta),dp; //TODO: How to map a parameter? 2060 setring tempRing; 2061 map thetamap = r,x,y; 2062 list mons = thetamap(mons); 2063 poly entry; 2064 poly tempSummand; 2065 for (i = 1; i<=size(mons);i++) 2066 {//transforming the monomials as monomials in theta 2067 entry = 1; //leadcoef(mons[i]) * q^(-triangNum(leadexp(mons[i])[2]-1)); 2068 for (j = 0; j<leadexp(mons[i])[2];j++) 2069 { 2070 //"j:";j; 2071 tempSummand = (q^j-1)/(q-1); 2072 entry = entry * theta-tempSummand*entry; 2073 } 2074 //~; 2075 mons[i] = entry*leadcoef(mons[i]) * q^(-triangNum(leadexp(mons[i])[2]-1)); 2076 }//transforming the monomials as monomials in theta 2077 dbprint(p,"==> Done"); 2078 dbprint(p,"==> Factorize the A_0-Part in K[theta]"); 2079 list azeroresult = factorize(sum(mons)); 2080 dbprint(p,"==> Successful"); 2081 list azeroresult_return_form; 2082 for (i = 1; i<=size(azeroresult[1]);i++) 2083 {//rewrite the result of the commutative factorization 2084 for (j = 1; j <= azeroresult[2][i];j++) 2085 { 2086 azeroresult_return_form = azeroresult_return_form + list(azeroresult[1][i]); 2087 } 2088 }//rewrite the result of the commutative factorization 2089 dbprint(p,"==> Mapping back to A_0."); 2090 setring(r); 2091 map finalmap = tempRing,var(1),var(2),var(1)*var(2); 2092 list tempresult = finalmap(azeroresult_return_form); 2093 dbprint(p,"Successful."); 2094 for (i = 1; i<=size(tempresult);i++) 2095 {//factorizations of theta resp. theta +1 2096 if(tempresult[i]==var(1)*var(2)) 2097 { 2098 tempresult = insert(tempresult,var(1),i-1); 2099 i++; 2100 tempresult[i]=var(2); 2101 } 2102 if(tempresult[i]==var(2)*var(1)) 2103 { 2104 tempresult = insert(tempresult,var(2),i-1); 2105 i++; 2106 tempresult[i]=var(1); 2107 } 2108 }//factorizations of theta resp. theta +1 2109 result = tempresult+result; 2110 //Correction of the result in the special q-Case: 2111 for (j = 2 ; j<= size(result);j++) 2112 {//Divide the whole Term by the leading coefficient and multiply it to the first entry in result[i] 2113 result[1] = result[1] * leadcoef(result[j]); 2114 result[j] = 1/leadcoef(result[j]) * result[j]; 2115 }//Divide the whole Term by the leading coefficient and multiply it to the first entry in result[i] 2116 return(result); 2117 }//proc homogfacFirstQWeyl 2118 2119 2120 2121 //================================================== 2122 //Computes all possible homogeneous factorizations for an element in the first Q-Weyl Algebra 2123 proc homogfacFirstQWeyl_all(poly h) 2124 "USAGE: homogfacFirstWWeyl_all(h); h is a homogeneous polynomial in the first q-Weyl algebra 2125 with respect to the weight vector [-1,1] 2126 RETURN: list 2127 PURPOSE: Computes all factorizations of a homogeneous polynomial h with respect 2128 to the weight vector [-1,1] in the first q-Weyl algebra 2129 THEORY: @code{homogfacFirstQWeyl} returns a list with all factorization of the given, 2130 homogeneous polynomial. It uses the output of homogfacFirstQWeyl and permutes 2131 its entries with respect to the commutation rule. Furthermore, if a 2132 factor of degree zero is irreducible in K[\theta], but reducible in 2133 the first q-Weyl algebra, the permutations of this element with the other 2134 entries will also be computed. 2135 SEE ALSO: homogfacFirstWeyl 2136 "{//proc HomogfacFirstQWeylAll 2137 int p=printlevel-voice+2;//for dbprint 2138 intvec iv11= intvec(1,1); 2139 if (deg(h,iv11) <= 0 ) 2140 {//h is a constant 2141 dbprint(p,"Given polynomial was not homogeneous"); 2142 return(list(list(h))); 2143 }//h is a constant 2144 def r = basering; 2145 list one_hom_fac; //stands for one homogeneous factorization 2146 int i; int j; int k; 2147 intvec ivm11 = intvec(-1,1); 2148 dbprint(p,"==> Calculate one homogeneous factorization using homogfacFirstQWeyl"); 2149 //Compute again a homogeneous factorization 2150 one_hom_fac = homogfacFirstQWeyl(h); 2151 dbprint(p,"Successful"); 2152 if (size(one_hom_fac) == 0) 2153 {//there is no homogeneous factorization or the polynomial was not homogeneous 2154 return(list()); 2155 }//there is no homogeneous factorization or the polynomial was not homogeneous 2156 //divide list in A0-Part and a list of x's resp. y's 2157 list list_not_azero = list(); 2158 list list_azero; 2159 list k_factor; 2160 int is_list_not_azero_empty = 1; 2161 int is_list_azero_empty = 1; 2162 k_factor = list(one_hom_fac[1]); 2163 if (absValue(deg(h,ivm11))<size(one_hom_fac)-1) 2164 {//There is a nontrivial A_0-part 2165 list_azero = one_hom_fac[2..(size(one_hom_fac)-absValue(deg(h,ivm11)))]; 2166 is_list_azero_empty = 0; 2167 }//There is a nontrivial A_0 part 2168 dbprint(p,"==> Combine x,y to xy in the factorization again."); 2169 for (i = 1; i<=size(list_azero)-1;i++) 2170 {//in homogfacFirstQWeyl, we factorized theta, and this will be made undone 2171 if (list_azero[i] == var(1)) 2172 { 2173 if (list_azero[i+1]==var(2)) 2174 { 2175 list_azero[i] = var(1)*var(2); 2176 list_azero = delete(list_azero,i+1); 2177 } 2178 } 2179 if (list_azero[i] == var(2)) 2180 { 2181 if (list_azero[i+1]==var(1)) 2182 { 2183 list_azero[i] = var(2)*var(1); 2184 list_azero = delete(list_azero,i+1); 2185 } 2186 } 2187 }//in homogfacFirstQWeyl, we factorized theta, and this will be made undone 2188 dbprint(p,"==> Done"); 2189 if(deg(h,ivm11)!=0) 2190 {//list_not_azero is not empty 2191 list_not_azero = 2192 one_hom_fac[(size(one_hom_fac)-absValue(deg(h,ivm11))+1)..size(one_hom_fac)]; 2193 is_list_not_azero_empty = 0; 2194 }//list_not_azero is not empty 2195 //Map list_azero in K[theta] 2196 dbprint(p,"==> Map list_azero to K[theta]"); 2197 def characteristic = ringlist(r)[1][1]; 2198 def qparameter = ringlist(r)[1][2][1]; 2199 ring tempRing = (characteristic,q),(x,y,theta),dp; //TODO: How to map a parameter? 2200 setring(tempRing); 2201 poly entry; 2202 map thetamap = r,x,y; 2203 if(!is_list_not_azero_empty) 2204 {//Mapping in Singular is only possible, if the list before 2205 //contained at least one element of the other ring 2206 list list_not_azero = thetamap(list_not_azero); 2207 }//Mapping in Singular is only possible, if the list before 2208 //contained at least one element of the other ring 2209 if(!is_list_azero_empty) 2210 {//Mapping in Singular is only possible, if the list before 2211 //contained at least one element of the other ring 2212 list list_azero= thetamap(list_azero); 2213 }//Mapping in Singular is only possible, if the list before 2214 //contained at least one element of the other ring 2215 list k_factor = thetamap(k_factor); 2216 list tempmons; 2217 dbprint(p,"==> Done"); 2218 for(i = 1; i<=size(list_azero);i++) 2219 {//rewrite the polynomials in A1 as polynomials in K[theta] 2220 tempmons = list(); 2221 for (j = 1; j<=size(list_azero[i]);j++) 2222 { 2223 tempmons = tempmons + list(list_azero[i][j]); 2224 } 2225 for (j = 1 ; j<=size(tempmons);j++) 2226 { 2227 //entry = leadcoef(tempmons[j]); 2228 entry = leadcoef(tempmons[j]) * q^(-triangNum(leadexp(tempmons[j])[2]-1)); 2229 for (k = 0; k < leadexp(tempmons[j])[2];k++) 2230 { 2231 entry = entry*(theta-(q^k-1)/(q-1)); 2232 } 2233 tempmons[j] = entry; 2234 } 2235 list_azero[i] = sum(tempmons); 2236 }//rewrite the polynomials in A1 as polynomials in K[theta] 2237 //Compute all permutations of the A0-part 2238 dbprint(p,"==> Compute all permutations of the A_0-part with the first resp. the snd. variable"); 2239 list result; 2240 int shift_sign; 2241 int shift; 2242 poly shiftvar; 2243 if (size(list_not_azero)!=0) 2244 {//Compute all possibilities to permute the x's resp. the y's in the list 2245 if (list_not_azero[1] == x) 2246 {//h had a negative weighted degree 2247 shift_sign = 1; 2248 shiftvar = x; 2249 }//h had a negative weighted degree 2250 else 2251 {//h had a positive weighted degree 2252 shift_sign = -1; 2253 shiftvar = y; 2254 }//h had a positive weighted degree 2255 result = permpp(list_azero + list_not_azero); 2256 for (i = 1; i<= size(result); i++) 2257 {//adjust the a_0-parts 2258 shift = 0; 2259 for (j=1; j<=size(result[i]);j++) 2260 { 2261 if (result[i][j]==shiftvar) 2262 { 2263 shift = shift + shift_sign; 2264 } 2265 else 2266 { 2267 if (shift < 0) 2268 {//We have two distict formulas for x and y. In this case use formula for y 2269 if (shift == -1) 2270 { 2271 result[i][j] = subst(result[i][j],theta,1/q*(theta - 1)); 2272 } 2273 else 2274 { 2275 result[i][j] = subst(result[i][j],theta,1/q*((theta - 1)/q^(absValue(shift)-1) - (q^(shift +2)-q)/(1-q))); 2276 } 2277 }//We have two distict formulas for x and y. In this case use formula for y 2278 if (shift > 0) 2279 {//We have two distict formulas for x and y. In this case use formula for x 2280 if (shift == 1) 2281 { 2282 result[i][j] = subst(result[i][j],theta,q*theta + 1); 2283 } 2284 else 2285 { 2286 result[i][j] = subst(result[i][j],theta,q^shift*theta+(q^shift-1)/(q-1)); 2287 } 2288 }//We have two distict formulas for x and y. In this case use formula for x 2289 } 2290 } 2291 }//adjust the a_0-parts 2292 }//Compute all possibilities to permute the x's resp. the y's in the list 2293 else 2294 {//The result is just all the permutations of the a_0-part 2295 result = permpp(list_azero); 2296 }//The result is just all the permutations of the a_0 part 2297 if (size(result)==0) 2298 { 2299 return(result); 2300 } 2301 dbprint(p,"==> Done"); 2302 dbprint(p,"==> Searching for theta resp. theta + 1 in the list and factorize them"); 2303 //Now we are going deeper and search for theta resp. theta + 1, substitute 2304 //them by xy resp. yx and go on permuting 2305 int found_theta; 2306 int thetapos; 2307 list leftpart; 2308 list rightpart; 2309 list lparts; 2310 list rparts; 2311 list tempadd; 2312 for (i = 1; i<=size(result) ; i++) 2313 {//checking every entry of result for theta or theta +1 2314 found_theta = 0; 2315 for(j=1;j<=size(result[i]);j++) 2316 { 2317 if (result[i][j]==theta) 2318 {//the jth entry is theta and can be written as x*y 2319 thetapos = j; 2320 result[i]= insert(result[i],x,j-1); 2321 j++; 2322 result[i][j] = y; 2323 found_theta = 1; 2324 break; 2325 }//the jth entry is theta and can be written as x*y 2326 if(result[i][j] == q*theta +1) 2327 { 2328 thetapos = j; 2329 result[i] = insert(result[i],y,j-1); 2330 j++; 2331 result[i][j] = x; 2332 found_theta = 1; 2333 break; 2334 } 2335 } 2336 if (found_theta) 2337 {//One entry was theta resp. theta +1 2338 leftpart = result[i]; 2339 leftpart = leftpart[1..thetapos]; 2340 rightpart = result[i]; 2341 rightpart = rightpart[(thetapos+1)..size(rightpart)]; 2342 lparts = list(leftpart); 2343 rparts = list(rightpart); 2344 //first deal with the left part 2345 if (leftpart[thetapos] == x) 2346 { 2347 shift_sign = 1; 2348 shiftvar = x; 2349 } 2350 else 2351 { 2352 shift_sign = -1; 2353 shiftvar = y; 2354 } 2355 for (j = size(leftpart); j>1;j--) 2356 {//drip x resp. y 2357 if (leftpart[j-1]==shiftvar) 2358 {//commutative 2359 j--; 2360 continue; 2361 }//commutative 2362 if (deg(leftpart[j-1],intvec(-1,1,0))!=0) 2363 {//stop here 2364 break; 2365 }//stop here 2366 //Here, we can only have a a0- part 2367 if (shift_sign<0) 2368 { 2369 leftpart[j] = subst(leftpart[j-1],theta, 1/q*(theta +shift_sign)); 2370 } 2371 if (shift_sign>0) 2372 { 2373 leftpart[j] = subst(leftpart[j-1],theta, q*theta + shift_sign); 2374 } 2375 leftpart[j-1] = shiftvar; 2376 lparts = lparts + list(leftpart); 2377 }//drip x resp. y 2378 //and now deal with the right part 2379 if (rightpart[1] == x) 2380 { 2381 shift_sign = 1; 2382 shiftvar = x; 2383 } 2384 else 2385 { 2386 shift_sign = -1; 2387 shiftvar = y; 2388 } 2389 for (j = 1 ; j < size(rightpart); j++) 2390 { 2391 if (rightpart[j+1] == shiftvar) 2392 { 2393 j++; 2394 continue; 2395 } 2396 if (deg(rightpart[j+1],intvec(-1,1,0))!=0) 2397 { 2398 break; 2399 } 2400 if (shift_sign<0) 2401 { 2402 rightpart[j] = subst(rightpart[j+1], theta, q*theta - shift_sign); 2403 } 2404 if (shift_sign>0) 2405 { 2406 rightpart[j] = subst(rightpart[j+1], theta, 1/q*(theta - shift_sign)); 2407 } 2408 rightpart[j+1] = shiftvar; 2409 rparts = rparts + list(rightpart); 2410 } 2411 //And now, we put all possibilities together 2412 tempadd = list(); 2413 for (j = 1; j<=size(lparts); j++) 2414 { 2415 for (k = 1; k<=size(rparts);k++) 2416 { 2417 tempadd = tempadd + list(lparts[j]+rparts[k]); 2418 } 2419 } 2420 tempadd = delete(tempadd,1); // The first entry is already in the list 2421 result = result + tempadd; 2422 continue; //We can may be not be done already with the ith entry 2423 }//One entry was theta resp. theta +1 2424 }//checking every entry of result for theta or theta +1 2425 dbprint(p,"==> Done"); 2426 //map back to the basering 2427 dbprint(p,"==> Mapping back everything to the basering"); 2428 setring(r); 2429 map finalmap = tempRing, var(1), var(2),var(1)*var(2); 2430 list result = finalmap(result); 2431 for (i=1; i<=size(result);i++) 2432 {//adding the K factor 2433 result[i] = k_factor + result[i]; 2434 }//adding the k-factor 2435 dbprint(p,"==> Done"); 2436 dbprint(p,"==> Delete double entries in the list."); 2437 result = delete_dublicates_noteval(result); 2438 dbprint(p,"==> Done"); 2439 return(result); 2440 }//proc HomogfacFirstQWeylAll 2441 2442 //TODO: FirstQWeyl check the parameters... 1970 2443 1971 2444 /*
Note: See TracChangeset
for help on using the changeset viewer.