Changeset 968ddc in git
- Timestamp:
- Mar 11, 2019, 6:07:33 PM (5 years ago)
- Branches:
- (u'spielwiese', '8e0ad00ce244dfd0756200662572aef8402f13d5')
- Children:
- 6c29eecfbf047db4b40d753db27927ecd270d83e
- Parents:
- 5cceb108968680f9d49ff4570d6b0dd1ac9c5f80
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
Singular/LIB/VecField.lib
r5cceb1 r968ddc 298 298 299 299 proc applyVecField(VecField V,p,list #) 300 301 302 300 " 301 USAGE: applyVecField(VecField V, poly/ideal p [,int n]) 302 RETURN: if p is a polynomial, return a polynomial V(p), if p is an ideal, the ideal V(p). 303 303 If an optional n is given, only the parts of V up to and including degree n are 304 304 applied to p. 305 306 305 EXAMPLE: example applyVecField 306 " 307 307 { 308 308 int n = -1; … … 362 362 363 363 proc changeCoordinates(VecField V, map psi) 364 365 364 " 365 USAGE: changeCoordinates(vecField V, map psi), where psi is an algebra morphism 366 366 k[x1,...,xn]->k[y1,...,ym] expressing the new basis in terms of the old. 367 368 367 RETURN: A new vecfield in the new coordinates. 368 NOTE: the coordinate change necessitates inverting psi. 369 369 The inversion will be correct up to the precision of V. 370 371 370 EXAMPLE: example changeCoordinates 371 " 372 372 { 373 373 … … 422 422 423 423 proc jordanVecField(VecField V) 424 425 426 424 " 425 USAGE: jordanVecField(VecField V) 426 RETURN: new vecfield W in coordinates s.t. W.lin is in Jordan normal 427 427 form. 428 429 430 428 ASSUME: eigenvalues of V.lin in basefield. 429 EXAMPLE: example jordanVecField 430 " 431 431 { 432 432 list l = jordanbasis(V.lin); // l[1] is the transformation matrix … … 458 458 459 459 proc diagonalizeVecFieldLin(list #) 460 461 462 460 " 461 USAGE: diagonalizeVecFieldLin(list l), where l is a list of VecFields 462 RETURN: list W of the same VecFields in new coords s.t. the linear parts are diagonal, 463 463 all in the same coordinates 464 465 466 464 ASSUME: All linear parts of the entries of l are simultaneously diagonalizable. 465 EXAMPLE: example diagonalizeVecFieldLin 466 " 467 467 { 468 468 list l = #; … … 506 506 507 507 proc SaitoBase(VecField V) 508 509 510 508 " 509 USAGE: SaitoBase(VecField V) 510 RETURN: new VecField W in the base from [1] thm. 3.1, where semisimple and 511 511 nilpotent components are easily read off. 512 512 NOTE: the algorithm requires inversions of algebra morphisms. These will be 513 513 exact to the precision of V. Warning: The algorithm assumes 514 514 standard coordinates. If V is not given in standard coordinates, it will … … 520 520 Note that weight vectors only take Int64, 521 521 making the algorithm fail for very large entries in V.vec. 522 523 522 EXAMPLE: example SaitoBase 523 " 524 524 { 525 525 … … 619 619 620 620 return(W); 621 622 623 621 } 624 622 example … … 638 636 639 637 proc diagonalizeVecField(list #) 640 641 642 643 644 638 " 639 USAGE: diagonalizeVecField(list l), l a list of VecFields 640 RETURN: list of VecFields W such that they are all simultaneously diagonal. 641 ASSUME: all input VecFields have to be simultaneously diagonalizable. 642 NOTE: the algorithm requires inversions of algebra morphisms. These will be 645 643 exact to the precision of l[1]. Warning: The algorithm assumes 646 644 standard coordinates. If V is not given in standard coordinates, it will … … 652 650 Note that weight vectors only take Int64, 653 651 making the algorithm fail for very large entries in V.vec. 654 655 652 EXAMPLE: example diagonalizeVecField 653 " 656 654 { 657 655 // note: comments are sparse in this procedure as it is essentially the same as SaitoBase(), … … 821 819 822 820 proc vecFieldToMatrix(VecField V,ideal W) 823 824 825 826 " 827 EXAMPLE: example vecFieldToMatrix 821 " 822 USAGE: vecFieldToMatrix(VecField V,ideal W) 823 RETURN: the matrix representation of V restricted to span(W), in the basis specified by W. 824 EXAMPLE: example vecFieldToMatrix 825 " 828 826 { 829 827 matrix D[ncols(W)][ncols(W)]; // this will hold the matrix representation … … 875 873 876 874 proc decomposeVecField(list #) 877 878 879 875 " 876 USAGE: decomposeVecField(VecField V) or decomposeVecField(list s), s a list of VecFields 877 RETURN: list l containing two VecFields, where l[1] is the semisimple part of V, l[2] the 880 878 nilpotent part. If called with a list, l[2n-1] is the semisimple part of the 881 879 n-th VecField, l[2n] its nilpotent part. 882 880 ASSUME: The algorithm assumes standard coordinates. If V is not given in standard 883 881 coordinates, it will be converted to standard coordinates, but not converted back 884 882 at the end, so the resulting transformation is from standard coordinates to the 885 883 new coordinates. If you want the entire transformation from your original coordinates 886 884 to the new ones, add the inverse of your original coordinate transformation manually. 887 888 885 EXAMPLE: example decomposeVecField 886 " 889 887 { 890 888 if(size(#) == 1) … … 934 932 935 933 proc invertAlgebraMorphism(p,int n) 936 937 934 " 935 USAGE: invertAlgebraMorphism(map p,int n), where p is an algebra 938 936 morphism k[x1,...,xn]->k[y1,...,ym], 939 937 or invertAlgebraMorphism(ideal p,int n) if you represent the map as an ideal 940 938 RETURN: the inverse of p mod (maxideal)^n. 941 939 If n=-1, try for infinite precision. If input was an ideal, return an ideal. 942 943 944 940 NOTE: the algorithm used is described in [1], chapter 3.2 941 EXAMPLE: example invertAlgebraMorphism 942 " 945 943 { 946 944 if(typeof(p) == "map") … … 1070 1068 1071 1069 proc diagonalizeMatrixSimul(list l) 1072 1073 1070 " 1071 USAGE: diagonalizeMatrixSimul(list l), where l is a list of quadratic matrices 1074 1072 of same dimensions 1075 1076 1077 1078 1073 RETURN: trafo matrix U s.t. U*A*inv(U) is diagonal for each A in l 1074 ASSUME: matrices are simultaneously diagonalizable, nvars(basering)>=dimension of the matrices 1075 EXAMPLE: example diagonalizeMatrixSimul 1076 " 1079 1077 { 1080 1078 if(size(l)==0) … … 1189 1187 1190 1188 static proc homogeneousPolyToVec(poly p,ideal W) 1191 1192 1193 1189 " 1190 USAGE: homogeneousPolyToVec(poly p, ideal W) 1191 ASSUME: p homogeneous and contained in the space spanned by W, 1194 1192 e.g. p quasihomogeneous and W is the result of weaklyHomogeneousSpace(...) 1195 1196 1193 RETURN: nx1 matrix containing the coefficients of p in the order given by W 1194 " 1197 1195 { 1198 1196 matrix v[ncols(W)][1]; … … 1212 1210 1213 1211 static proc vecToHomogeneousPoly(matrix v,ideal W) 1214 1215 1216 1217 1218 1212 " 1213 USAGE: vecToHomogeneousPoly(vec v,ideal W) 1214 ASSUME: v is a nx1 matrix, where n=ncols(W) 1215 RETURN: the polynomial in W whose coefficients are v (W represents the basis) 1216 " 1219 1217 { 1220 1218 poly p; … … 1227 1225 1228 1226 static proc weaklyHomogeneousSpace(int n, int lambda, intvec weights) 1229 1230 1231 1227 " 1228 USAGE: weaklyHomogeneousSpace(int n, int lambda, intvec weights) 1229 RETURN: ideal of all monomials which are homogeneous of degree n 1232 1230 AND weakly homogeneous of degree lambda with the given weights 1233 1234 1231 ASSUME: weights has exactly as many entries as nvars(basering) 1232 NOTE: if no such monomials exist, the zero ideal is returned. 1235 1233 The monomials in the returned ideal are sorted according to the basering's ordering. 1236 1234 " 1237 1235 { 1238 1236 ideal H = maxideal(n); // contains all homogeneous monomials of degree n … … 1266 1264 1267 1265 static proc weaklyHomogeneousSpaceComplement(int n, int lambda, intvec weights) 1268 1269 1270 1266 " 1267 USAGE: weaklyHomogeneousSpaceComplement(int n, int lambda, intvec weights) 1268 RETURN: ideal of all monomials which are homogeneous of degree n 1271 1269 but NOT weakly homogeneous of degree lambda with the given weights 1272 1273 1270 ASSUME: size(weights)==nvars(basering) 1271 NOTE: if no such monomials exist, the zero ideal is returned. 1274 1272 The monomials in the returned ideal are sorted according to the ring ordering. 1275 1273 " 1276 1274 { 1277 1275 // for documentation see weaklyHomogeneousSpace(); … … 1301 1299 1302 1300 static proc extendMatrix(matrix A,int rows,int cols) 1303 1304 1305 1306 1307 1301 " 1302 USAGE: extendMatrix(matrix A,int rows,int cols) 1303 RETURN: A extended with zeroes s.t. it is now a rowsxcols matrix 1304 ASSUME: nrows(A) <= rows, ncols(A) <= cols 1305 " 1308 1306 { 1309 1307 matrix B[rows][cols]; … … 1319 1317 1320 1318 static proc eqIdeal(ideal I,ideal J) 1321 1322 1323 1324 1319 " 1320 USAGE: eqIdeal(ideal I, ideal J) 1321 RETURN: 1 if ideals are equal, 0 otherwise 1322 " 1325 1323 { 1326 1324 J = std(J); … … 1342 1340 1343 1341 static proc eqMap(map f, map g) 1344 1345 1346 1347 1348 1342 " 1343 USAGE: eqMap(map f,map g) 1344 ASSUME: domain of f,g are the same, codomain of f, g are the same, domain is current basering 1345 RETURN: 1 if maps are equal, 0 otherwise 1346 " 1349 1347 { 1350 1348 // note: maps are equal iff they are equal on each ring variable … … 1364 1362 1365 1363 static proc identityMap() // this does not yet exist in SINGULAR ... 1366 1367 1368 1369 1364 " 1365 USAGE: identityMap() 1366 RETURN: a map basering -> basering which is the identity map 1367 " 1370 1368 { 1371 1369 ideal P = maxideal(1); … … 1375 1373 1376 1374 static proc pvector() 1377 1378 1379 1380 1375 " 1376 USAGE: pvector() 1377 RETURN: a nvars x 1 matrix consisting of the ring variables in order 1378 " 1381 1379 { 1382 1380 ideal I = maxideal(1); … … 1400 1398 1401 1399 static proc mirrorMatrixVertictal(matrix m) 1402 1403 1404 1405 1400 " 1401 USAGE: mirrorMatrixVertical(matrix m) 1402 RETURN: m mirrored about the horizontal axis 1403 " 1406 1404 { 1407 1405 matrix n[nrows(m)][ncols(m)]; … … 1437 1435 1438 1436 static proc homogeneousPart(poly f, int n) 1439 1440 1441 1442 1437 " 1438 USAGE: homogeneousPart(poly f, int n) 1439 RETURN: the homogeneous part of f of degree n 1440 " 1443 1441 { 1444 1442 poly g = jet(f,n); … … 1460 1458 1461 1459 static proc diagEntries(matrix A) 1462 1463 1464 1465 1466 1460 " 1461 USAGE: diagEntries(matrix A) 1462 ASSUME: A is quadratic 1463 RETURN: nx1 matrix containing the diagonal entries of A 1464 " 1467 1465 { 1468 1466 matrix v[ncols(A)][1]; … … 1475 1473 1476 1474 static proc productOfRingVars() 1477 1478 1479 1480 1475 " 1476 USAGE: productOfRingVars() 1477 RETURN: poly which is the product of all ring variables 1478 " 1481 1479 { 1482 1480 poly p = 1; … … 1490 1488 1491 1489 static proc vecToIntvec(matrix v) 1492 1493 1494 1495 1496 1490 " 1491 USAGE: vecToIntVec(matrix v) 1492 RETURN: an intvec containing the entries of v 1493 ASSUME: v is mx1 and contains only integers 1494 " 1497 1495 { 1498 1496 intvec ret = (0:nrows(v)); … … 1505 1503 1506 1504 static proc matrixRow(matrix m, int n) 1507 1508 1509 1510 1505 " 1506 USAGE: matrixRow(matrix m, int n) 1507 RETURN: the n-th row of m (as a matrix with one row). If n>nrows(m), returns a zero row. 1508 " 1511 1509 { 1512 1510 matrix ret[1][ncols(m)]; … … 1523 1521 1524 1522 static proc matrixCol(matrix m, int n) 1525 1526 1527 1523 " 1524 USAGE: matrixCol(matrix m, int n) 1525 RETURN: the n-th column of m (as a matrix with one column). 1528 1526 If n>ncols(m), returns a zero column. 1529 1527 " 1530 1528 { 1531 1529 matrix ret[nrows(m)][1];
Note: See TracChangeset
for help on using the changeset viewer.