Changeset ac38de1 in git for Singular/LIB
- Timestamp:
- Oct 11, 2010, 2:48:14 PM (14 years ago)
- Branches:
- (u'spielwiese', 'fe61d9c35bf7c61f2b6cbf1b56e25e2f08d536cc')
- Children:
- 32378f5bd525032b437ebb1823d9c2430b3665a4
- Parents:
- 3b81b813dd9fe8524513396ba07bb5ed8fbbae92
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
Singular/LIB/ncfactor.lib
r3b81b81 rac38de1 6 6 AUTHORS: Albert Heinle, albert.heinle@rwth-aachen.de 7 7 @* Viktor Levandovskyy, levandov@math.rwth-aachen.de 8 OVERVIEW: In this library, new methods for factorization on polynomials 9 10 are implemented for two algebras over a field K. Recall, that 11 12 the first Weyl algebra over K is generated by x,d obeying the relation d*x=x*d+1. 13 14 The first shift algebra over K is generated by x,s obeying the relation s*x=x*s+s. 8 OVERVIEW: In this library, new methods for factorization on polynomials 9 are implemented for two algebras over a field K. Recall, that 10 the first Weyl algebra over K is generated by x,d obeying the relation d*x=x*d+1. 11 The first shift algebra over K is generated by x,s obeying the relation s*x=x*s+s. 15 12 16 13 PROCEDURES: 17 facFirstWeyl(h); factorization in the first Weyl algebra18 testNCfac(l[,h]); tests factorizations from a given list for correctness19 facSubWeyl(h,X,D); factorization in the first Weyl algebra as a subalgebra20 facFirstShift(h); factorization in the first shift algebra14 facFirstWeyl(h); factorization in the first Weyl algebra 15 testNCfac(l[,h]); tests factorizations from a given list for correctness 16 facSubWeyl(h,X,D); factorization in the first Weyl algebra as a subalgebra 17 facFirstShift(h); factorization in the first shift algebra 21 18 "; 22 19 … … 50 47 if (size(l[i])!= size(l[j])) 51 48 {//different sizes => not equal 52 53 49 j++; 50 continue; 54 51 }//different sizes => not equal 55 52 is_equal = 1; 56 53 for (k = 1; k <= size(l[i]);k++) 57 54 {//Compare every entry 58 59 60 61 62 55 if (l[i][k]!=l[j][k]) 56 { 57 is_equal = 0; 58 break; 59 } 63 60 }//Compare every entry 64 61 if (is_equal == 1) 65 62 {//Delete this entry, because there is another equal one int the list 66 67 68 63 result = delete(result, i-deleted); 64 deleted = deleted+1; 65 break; 69 66 }//Delete this entry, because there is another equal one int the list 70 67 }//Compare the i'th factorization to the j'th … … 88 85 if (product(result[i]) == product(result[j])) 89 86 {//There are two equal results; throw away that one with the smaller size 90 91 92 93 94 95 96 97 98 99 100 87 if (size(result[i])>=size(result[j])) 88 {//result[i] has more entries 89 result = delete(result,j); 90 continue; 91 }//result[i] has more entries 92 else 93 {//result[j] has more entries 94 result = delete(result,i); 95 i--; 96 break; 97 }//result[j] has more entries 101 98 }//There are two equal results; throw away that one with the smaller size 102 99 }//comparing with the other elements … … 146 143 {//shifting the window of combinable factors to the left 147 144 //fc below stands for "factors combined" 148 fc = combinekfinlf(list(g[(j)..(j+nofgl - i)]),nof - i + 1,limits); 145 fc = combinekfinlf(list(g[(j)..(j+nofgl - i)]),nof - i + 1,limits); 149 146 for (k = 1; k<=size(fc); k++) 150 147 {//iterating over the different solutions of the smaller problem 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 148 if (j>1) 149 {//There are g_i before the combination 150 if (j+nofgl -i < nofgl) 151 {//There are g_i after the combination 152 temp = list(g[1..(j-1)]) + fc[k] + list(g[(j+nofgl-i+1)..nofgl]); 153 }//There are g_i after the combination 154 else 155 {//There are no g_i after the combination 156 temp = list(g[1..(j-1)]) + fc[k]; 157 }//There are no g_i after the combination 158 }//There are g_i before the combination 159 if (j==1) 160 {//There are no g_i before the combination 161 if (j+ nofgl -i <nofgl) 162 {//There are g_i after the combination 163 temp = fc[k]+ list(g[(j + nofgl - i +1)..nofgl]); 164 }//There are g_i after the combination 165 }//There are no g_i before the combination 166 if (limitcheck(temp,limits)) 167 { 168 result = result + list(temp); 169 } 173 170 }//iterating over the different solutions of the smaller problem 174 171 }//shifting the window of combinable factors to the left … … 263 260 if (f[i] == g[j]) 264 261 {//we have an equal pair 265 262 M = M + list(list(i,j)); 266 263 }//we have an equal pair 267 264 }//... with g … … 284 281 if (M[i][1]<=temp[1]) 285 282 {//a possible candidate that is smaller than temp could have been found 286 287 288 289 290 291 292 293 294 295 296 297 298 283 if (M[i][1]==temp[1]) 284 {//In this case we must look at the second number 285 if (M[i][2]< temp[2]) 286 {//the candidate is smaller 287 temp = M[i]; 288 temppos = i; 289 }//the candidate is smaller 290 }//In this case we must look at the second number 291 else 292 {//The candidate is definately smaller 293 temp = M[i]; 294 temppos = i; 295 }//The candidate is definately smaller 299 296 }//a possible candidate that is smaller than temp could have been found 300 297 }//finding the minimal element of M … … 304 301 if (temp[1]<size(f)) 305 302 {//The most common case 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 303 //first the combinations ignoring common factors 304 pre = merge_icf(list(f[1..(temp[1]-1)]),list(g[1..(temp[2]-1)]),limits); 305 post = merge_icf(list(f[(temp[1]+1)..size(f)]),list(g[(temp[2]+1..size(g))]),limits); 306 for (i = 1; i <= size(pre); i++) 307 {//all possible pre's... 308 for (j = 1; j<= size(post); j++) 309 {//...combined with all possible post's 310 candidate = pre[i]+list(f[temp[1]])+post[j]; 311 if (limitcheck(candidate,limits)) 312 { 313 result = result + list(candidate); 314 } 315 }//...combined with all possible post's 316 }//all possible pre's... 317 //Now the combinations with respect to common factors 318 post = merge_cf(list(f[(temp[1]+1)..size(f)]),list(g[(temp[2]+1..size(g))]),limits); 319 if (size(post)>0) 320 {//There are factors to combine 321 for (i = 1; i <= size(pre); i++) 322 {//all possible pre's... 323 for (j = 1; j<= size(post); j++) 324 {//...combined with all possible post's 325 candidate= pre[i]+list(f[temp[1]])+post[j]; 326 if (limitcheck(candidate,limits)) 327 { 328 result = result + list(candidate); 329 } 330 }//...combined with all possible post's 331 }//all possible pre's... 332 }//There are factors to combine 336 333 }//The most common case 337 334 else 338 335 {//the last factor is the common one 339 340 341 342 343 344 345 346 347 336 pre = merge_icf(list(f[1..(temp[1]-1)]),list(g[1..(temp[2]-1)]),limits); 337 for (i = 1; i<= size(pre); i++) 338 {//iterating over the possible pre-factors 339 candidate = pre[i]+list(f[temp[1]]); 340 if (limitcheck(candidate,limits)) 341 { 342 result = result + list(candidate); 343 } 344 }//iterating over the possible pre-factors 348 345 }//the last factor is the common one 349 346 }//There are factors to combine before the equal factor … … 352 349 if (temp[1]<size(f)) 353 350 {//Just a check for security 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 351 //first without common factors 352 post=merge_icf(list(f[(temp[1]+1)..size(f)]),list(g[(temp[2]+1..size(g))]),limits); 353 for (i = 1; i<=size(post); i++) 354 { 355 candidate = list(f[temp[1]])+post[i]; 356 if (limitcheck(candidate,limits)) 357 { 358 result = result + list(candidate); 359 } 360 } 361 //Now with common factors 362 post = merge_cf(list(f[(temp[1]+1)..size(f)]),list(g[(temp[2]+1..size(g))]),limits); 363 if(size(post)>0) 364 {//we could find other combinations 365 for (i = 1; i<=size(post); i++) 366 { 367 candidate = list(f[temp[1]])+post[i]; 368 if (limitcheck(candidate,limits)) 369 { 370 result = result + list(candidate); 371 } 372 } 373 }//we could find other combinations 377 374 }//Just a check for security 378 375 }//There are no factors to combine before the equal factor … … 477 474 for (i = 1; i<=-m; i++) 478 475 { 479 476 result = result + list(var(1)); 480 477 } 481 478 }//There are more x than y … … 485 482 for (i = 1; i<=m;i++) 486 483 { 487 484 result = result + list(var(2)); 488 485 } 489 486 }//There are more y than x … … 600 597 if (list_azero[i+1]==var(2)) 601 598 { 602 603 599 list_azero[i] = var(1)*var(2); 600 list_azero = delete(list_azero,i+1); 604 601 } 605 602 } … … 608 605 if (list_azero[i+1]==var(1)) 609 606 { 610 611 607 list_azero[i] = var(2)*var(1); 608 list_azero = delete(list_azero,i+1); 612 609 } 613 610 } … … 615 612 if(deg(h,intvec(-1,1))!=0) 616 613 {//list_not_azero is not empty 617 list_not_azero = 614 list_not_azero = 618 615 one_hom_fac[(size(one_hom_fac)-absValue(deg(h,intvec(-1,1)))+1)..size(one_hom_fac)]; 619 616 is_list_not_azero_empty = 0; … … 625 622 map thetamap = r,x,y; 626 623 if(!is_list_not_azero_empty) 627 {//Mapping in Singular is only possible, if the list before 624 {//Mapping in Singular is only possible, if the list before 628 625 //contained at least one element of the other ring 629 626 list list_not_azero = thetamap(list_not_azero); 630 }//Mapping in Singular is only possible, if the list before 627 }//Mapping in Singular is only possible, if the list before 631 628 //contained at least one element of the other ring 632 629 if(!is_list_azero_empty) 633 {//Mapping in Singular is only possible, if the list before 630 {//Mapping in Singular is only possible, if the list before 634 631 //contained at least one element of the other ring 635 632 list list_azero= thetamap(list_azero); 636 }//Mapping in Singular is only possible, if the list before 633 }//Mapping in Singular is only possible, if the list before 637 634 //contained at least one element of the other ring 638 635 list k_factor = thetamap(k_factor); … … 650 647 for (k = 0; k < leadexp(tempmons[j])[2];k++) 651 648 { 652 649 entry = entry*(theta-k); 653 650 } 654 651 tempmons[j] = entry; … … 679 676 for (j=1; j<=size(result[i]);j++) 680 677 { 681 682 683 684 685 686 687 688 678 if (result[i][j]==shiftvar) 679 { 680 shift = shift + shift_sign; 681 } 682 else 683 { 684 result[i][j] = subst(result[i][j],theta,theta + shift); 685 } 689 686 } 690 687 }//adjust the a_0-parts … … 714 711 if (result[i][j]==theta) 715 712 {//the jth entry is theta and can be written as x*y 716 717 718 719 720 721 713 thetapos = j; 714 result[i]= insert(result[i],x,j-1); 715 j++; 716 result[i][j] = y; 717 found_theta = 1; 718 break; 722 719 }//the jth entry is theta and can be written as x*y 723 720 if(result[i][j] == theta +1) 724 721 { 725 726 727 728 729 730 722 thetapos = j; 723 result[i] = insert(result[i],y,j-1); 724 j++; 725 result[i][j] = x; 726 found_theta = 1; 727 break; 731 728 } 732 729 } … … 742 739 if (leftpart[thetapos] == x) 743 740 { 744 745 741 shift_sign = 1; 742 shiftvar = x; 746 743 } 747 744 else 748 745 { 749 750 746 shift_sign = -1; 747 shiftvar = y; 751 748 } 752 749 for (j = size(leftpart); j>1;j--) 753 750 {//drip x resp. y 754 755 756 757 758 759 760 761 762 763 764 765 766 751 if (leftpart[j-1]==shiftvar) 752 {//commutative 753 j--; 754 continue; 755 }//commutative 756 if (deg(leftpart[j-1],intvec(-1,1,0))!=0) 757 {//stop here 758 break; 759 }//stop here 760 //Here, we can only have a a0- part 761 leftpart[j] = subst(leftpart[j-1],theta, theta + shift_sign); 762 leftpart[j-1] = shiftvar; 763 lparts = lparts + list(leftpart); 767 764 }//drip x resp. y 768 765 //and now deal with the right part 769 766 if (rightpart[1] == x) 770 767 { 771 772 768 shift_sign = 1; 769 shiftvar = x; 773 770 } 774 771 else 775 772 { 776 777 773 shift_sign = -1; 774 shiftvar = y; 778 775 } 779 776 for (j = 1 ; j < size(rightpart); j++) 780 777 { 781 782 783 784 785 786 787 788 789 790 791 792 778 if (rightpart[j+1] == shiftvar) 779 { 780 j++; 781 continue; 782 } 783 if (deg(rightpart[j+1],intvec(-1,1,0))!=0) 784 { 785 break; 786 } 787 rightpart[j] = subst(rightpart[j+1], theta, theta - shift_sign); 788 rightpart[j+1] = shiftvar; 789 rparts = rparts + list(rightpart); 793 790 } 794 791 //And now, we put all possibilities together … … 796 793 for (j = 1; j<=size(lparts); j++) 797 794 { 798 799 800 801 795 for (k = 1; k<=size(rparts);k++) 796 { 797 tempadd = tempadd + list(lparts[j]+rparts[k]); 798 } 802 799 } 803 800 tempadd = delete(tempadd,1); // The first entry is already in the list … … 880 877 if (l_without_double[j] == l[i]) 881 878 { 882 883 879 double_entry = 1; 880 break; 884 881 } 885 882 } … … 934 931 { 935 932 def r = basering; 936 ring tempRing = ringlist(r)[1][1],(x,y),Ws(-1,1); // very strange: 933 ring tempRing = ringlist(r)[1][1],(x,y),Ws(-1,1); // very strange: 937 934 // setting Wp(-1,1) leads to SegFault; to clarify why!!! 938 935 def NTR = nc_algebra(1,1); … … 952 949 for (j=2;j<=size(result[i]);j++) 953 950 {//Factorize every factor 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 951 recursivetemp = facFirstWeyl(result[i][j]); 952 if(size(recursivetemp)>1) 953 {//we have a nontrivial factorization 954 for(k=1; k<=size(recursivetemp);k++) 955 {//insert factorized factors 956 if(size(recursivetemp[k])>2) 957 {//nontrivial 958 result = insert(result,result[i],i); 959 for(l = size(recursivetemp[k]);l>=2;l--) 960 { 961 result[i+1] = insert(result[i+1],recursivetemp[k][l],j); 962 } 963 result[i+1] = delete(result[i+1],j); 964 }//nontrivial 965 }//insert factorized factors 966 }//we have a nontrivial factorization 970 967 }//Factorize every factor 971 968 }//Nontrivial factorization … … 1039 1036 if (deg(h,intvec(-1,1))<=deg(h-product(M[i]),intvec(-1,1))) 1040 1037 { 1041 1042 1038 M = delete(M,i); 1039 continue; 1043 1040 } 1044 1041 if (deg(h,intvec(1,-1))<=deg(h-product(M[i]),intvec(1,-1))) 1045 1042 { 1046 1047 1043 M = delete(M,i); 1044 continue; 1048 1045 } 1049 1046 } … … 1060 1057 if (involution(NF(involution(hath,invo), std(involution(ideal(M[i][1]),invo))),invo)==0) 1061 1058 {//hath and h have a common factor on the left 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1059 j = 1; 1060 f1 = M[i]; 1061 if (j+1<=size(f1)) 1062 {//Checking for more than one common factor 1063 while(involution(NF(involution(hath,invo),std(involution(ideal(product(f1[1..(j+1)])),invo))),invo)==0) 1064 { 1065 if (j+1<size(f1)) 1066 { 1067 j++; 1068 } 1069 else 1070 { 1071 break; 1072 } 1073 } 1074 }//Checking for more than one common factor 1075 f2 = list(f1[1..j])+list(involution(lift(involution(product(f1[1..j]),invo),involution(hath,invo))[1,1],invo)); 1076 temp = temp + merge_cf(f2,f1,limits); 1080 1077 }//hath and h have a common factor on the left 1081 1078 if (reduce(hath, std(ideal(M[i][size(M[i])])))==0) 1082 1079 {//hath and h have a common factor on the right 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1080 j = size(M[i]); 1081 f1 = M[i]; 1082 if (j-1>0) 1083 {//Checking for more than one factor 1084 while(reduce(hath,std(ideal(product(f1[(j-1)..size(f1)]))))==0) 1085 { 1086 if (j-1>1) 1087 { 1088 j--; 1089 } 1090 else 1091 { 1092 break; 1093 } 1094 } 1095 }//Checking for more than one factor 1096 f2 = list(lift(product(f1[j..size(f1)]),hath)[1,1])+list(f1[j..size(f1)]); 1097 temp = temp + merge_cf(f2,M[i],limits); 1101 1098 }//hath and h have a common factor on the right 1102 1099 //and now the homogeneous … … 1107 1104 for (j = 1; j<=size(f1);j++) 1108 1105 { 1109 1110 1111 1112 1106 for (k=1; k<=size(f2);k++) 1107 { 1108 homogtemp = mergence(f1[j],f2[k],limits); 1109 } 1113 1110 } 1114 1111 for (j = 1; j<= size(homogtemp); j++) 1115 1112 { 1116 1113 temp = temp + mergence(homogtemp[j],M[i],limits); 1117 1114 } 1118 1115 for (j = 1; j<=size(temp); j++) 1119 1116 {//filtering invalid entries in temp 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1117 if(product(temp[j])==h) 1118 {//This is already a result 1119 result = result + list(temp[j]); 1120 temp = delete(temp,j); 1121 continue; 1122 }//This is already a result 1123 if (deg(hath,intvec(-1,1))<=deg(hath-product(temp[j]),intvec(-1,1))) 1124 { 1125 temp = delete(temp,j); 1126 continue; 1127 } 1131 1128 }//filtering invalid entries in temp 1132 1129 hatM = hatM + temp; … … 1137 1134 if (h == product(M[i])) 1138 1135 { 1139 1140 1141 1136 result = result + list(M[i]); 1137 M = delete(M,i); 1138 continue; 1142 1139 } 1143 1140 }//checking for complete factorizations … … 1229 1226 if (size(result)>0) 1230 1227 { 1231 1232 1233 1234 1235 1228 if (product(l[i])!=result[size(l)-i]) 1229 { 1230 valid = 0; 1231 break; 1232 } 1236 1233 } 1237 1234 result = insert(result, product(l[i])); … … 1250 1247 if (product(l[i])!=#[1]) 1251 1248 { 1252 1249 valid = 0; 1253 1250 } 1254 1251 result = insert(result, product(l[i])); … … 1293 1290 "USAGE: facSubWeyl(h,x,y); h, X, D polynomials 1294 1291 RETURN: list 1295 ASSUME: X and D are variables of a basering, which satisfy DX = XD +1. 1292 ASSUME: X and D are variables of a basering, which satisfy DX = XD +1. 1296 1293 @* That is, they generate the copy of the first Weyl algebra in a basering. 1297 1294 @* Moreover, h is a polynomial in X and D only. … … 1313 1310 poly w = D*X-X*D-1; // [D,X]=1 1314 1311 poly u = D*X-X*D+1; // [X,D]=1 1315 if (u*w!=0) 1312 if (u*w!=0) 1316 1313 { 1317 1314 // that is no combination gives Weyl … … 1324 1321 // hence w != 0, swap X<->D later 1325 1322 isReverted = 1; 1326 // w = D; D=X; X=w; 1323 // w = D; D=X; X=w; 1327 1324 } 1328 1325 // else: do nothing 1329 // DONE with assumptions 1326 // DONE with assumptions 1330 1327 //Input successfuy checked 1331 1328 intvec lexpofX = leadexp(X); … … 1354 1351 { 1355 1352 ring firstweyl = 0,(var(varnumD),var(varnumX)),dp; 1356 def Firstweyl = nc_algebra(1,1); 1353 def Firstweyl = nc_algebra(1,1); 1357 1354 setring Firstweyl; 1358 1355 ideal M = 0:nvars(@r); … … 1371 1368 list result = facFirstWeyl(h); 1372 1369 setring @r; 1373 list result; 1370 list result; 1374 1371 if (isReverted) 1375 1372 { … … 1394 1391 setring R; 1395 1392 poly h = (x^2*z^2+x)*x; 1396 list fact1 = facSubWeyl(h,x,z); 1393 list fact1 = facSubWeyl(h,x,z); 1397 1394 // compare with facFirstWeyl: 1398 1395 ring s = 0,(z,x),dp; … … 1408 1405 //================================================== 1409 1406 //************From here: Shift-Algebra************** 1410 1411 1412 1413 1414 1407 //================================================== 1408 1409 //==================================================* 1410 //one factorization of a homogeneous polynomial 1411 //in the first Shift Algebra 1415 1412 static proc homogfacFirstShift(poly h) 1416 1413 {//proc homogfacFirstShift … … 1487 1484 if (result[i][j]==var(2)) 1488 1485 { 1489 1486 shiftcounter++; 1490 1487 } 1491 1488 else 1492 1489 { 1493 1490 result[i][j] = subst(result[i][j], var(1), var(1)-shiftcounter); 1494 1491 } 1495 1492 } … … 1544 1541 // result = transfback(resulttemp); 1545 1542 } 1546 else 1543 else 1547 1544 { 1548 1545 if ( @p == var(2)) // usual shift algebra 1549 { 1546 { 1550 1547 setring(tempRingnc); 1551 1548 map transf = r, var(1), var(2); … … 1573 1570 for (j=2;j<=size(result[i]);j++) 1574 1571 {//Factorize every factor 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1572 recursivetemp = facFirstShift(result[i][j]); 1573 if(size(recursivetemp)>1) 1574 {//we have a nontrivial factorization 1575 for(k=1; k<=size(recursivetemp);k++) 1576 {//insert factorized factors 1577 if(size(recursivetemp[k])>2) 1578 {//nontrivial 1579 result = insert(result,result[i],i); 1580 for(l = size(recursivetemp[k]);l>=2;l--) 1581 { 1582 result[i+1] = insert(result[i+1],recursivetemp[k][l],j); 1583 } 1584 result[i+1] = delete(result[i+1],j); 1585 }//nontrivial 1586 }//insert factorized factors 1587 }//we have a nontrivial factorization 1591 1588 }//Factorize every factor 1592 1589 }//Nontrivial factorization … … 1655 1652 if (deg(h,intvec(0,1))<=deg(h-product(M[i]),intvec(0,1))) 1656 1653 { 1657 1658 1654 M = delete(M,i); 1655 continue; 1659 1656 } 1660 1657 if (deg(h,intvec(0,-1))<=deg(h-product(M[i]),intvec(0,-1))) 1661 1658 { 1662 1663 1659 M = delete(M,i); 1660 continue; 1664 1661 } 1665 1662 } … … 1676 1673 if (involution(NF(involution(hath,invo), std(involution(ideal(M[i][1]),invo))),invo)==0) 1677 1674 {//hath and h have a common factor on the left 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1675 j = 1; 1676 f1 = M[i]; 1677 if (j+1<=size(f1)) 1678 {//Checking for more than one common factor 1679 while(involution(NF(involution(hath,invo),std(involution(ideal(product(f1[1..(j+1)])),invo))),invo)==0) 1680 { 1681 if (j+1<size(f1)) 1682 { 1683 j++; 1684 } 1685 else 1686 { 1687 break; 1688 } 1689 } 1690 }//Checking for more than one common factor 1691 if (deg(product(f1[1..j]),intvec(1,1))!=0) 1692 { 1693 f2 = list(f1[1..j])+list(involution(lift(involution(product(f1[1..j]),invo),involution(hath,invo))[1,1],invo)); 1694 } 1695 else 1696 { 1697 f2 = list(f1[1..j])+list(involution(lift(product(f1[1..j]),involution(hath,invo))[1,1],invo)); 1698 } 1699 temp = temp + merge_cf(f2,f1,limits); 1703 1700 }//hath and h have a common factor on the left 1704 1701 if (reduce(hath, std(ideal(M[i][size(M[i])])))==0) 1705 1702 {//hath and h have a common factor on the right 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1703 j = size(M[i]); 1704 f1 = M[i]; 1705 if (j-1>0) 1706 {//Checking for more than one factor 1707 while(reduce(hath,std(ideal(product(f1[(j-1)..size(f1)]))))==0) 1708 { 1709 if (j-1>1) 1710 { 1711 j--; 1712 } 1713 else 1714 { 1715 break; 1716 } 1717 } 1718 }//Checking for more than one factor 1719 f2 = list(lift(product(f1[j..size(f1)]),hath)[1,1])+list(f1[j..size(f1)]); 1720 temp = temp + merge_cf(f2,M[i],limits); 1724 1721 }//hath and h have a common factor on the right 1725 1722 //and now the homogeneous … … 1730 1727 for (j = 1; j<=size(f1);j++) 1731 1728 { 1732 1733 1734 1735 1729 for (k=1; k<=size(f2);k++) 1730 { 1731 homogtemp = mergence(f1[j],f2[k],limits); 1732 } 1736 1733 } 1737 1734 for (j = 1; j<= size(homogtemp); j++) 1738 1735 { 1739 1736 temp = temp + mergence(homogtemp[j],M[i],limits); 1740 1737 } 1741 1738 for (j = 1; j<=size(temp); j++) 1742 1739 {//filtering invalid entries in temp 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1740 if(product(temp[j])==h) 1741 {//This is already a result 1742 result = result + list(temp[j]); 1743 temp = delete(temp,j); 1744 continue; 1745 }//This is already a result 1746 if (deg(hath,intvec(0,1))<=deg(hath-product(temp[j]),intvec(0,1))) 1747 { 1748 temp = delete(temp,j); 1749 continue; 1750 } 1754 1751 }//filtering invalid entries in temp 1755 1752 hatM = hatM + temp; … … 1760 1757 if (h == product(M[i])) 1761 1758 { 1762 1763 1764 1759 result = result + list(M[i]); 1760 M = delete(M,i); 1761 continue; 1765 1762 } 1766 1763 }//checking for complete factorizations … … 1803 1800 } 1804 1801 1805 /* very hard things from Martin Lee: 1802 /* very hard things from Martin Lee: 1806 1803 // ex1, ex2 1807 1804 ring s = 0,(z,x),Ws(-1,1); … … 1817 1814 ring r = 0,(x,y,z),dp; 1818 1815 matrix D[3][3]; D[1,3]=-1; 1819 def R = nc_algebra(1,D); 1816 def R = nc_algebra(1,D); 1820 1817 setring R; 1821 1818 poly g= 7*z4*x+62*z3+26*z;
Note: See TracChangeset
for help on using the changeset viewer.