Changeset 3f4e52 in git
- Timestamp:
- Jul 28, 2009, 12:34:56 PM (15 years ago)
- Branches:
- (u'spielwiese', 'fe61d9c35bf7c61f2b6cbf1b56e25e2f08d536cc')
- Children:
- 663baa085095bc4743611bd73380eb8c5d952985
- Parents:
- ae9fd9360b24aab77a82322cff14a56f1ba835fa
- Location:
- Singular/LIB
- Files:
-
- 14 edited
Legend:
- Unmodified
- Added
- Removed
-
Singular/LIB/algebra.lib
rae9fd9 r3f4e52 3 3 //new proc nonZeroEntry(id), used to fix a bug in proc finitenessTest 4 4 /////////////////////////////////////////////////////////////////////////////// 5 version="$Id: algebra.lib,v 1.2 3 2009-04-15 11:07:30 seelischExp $";5 version="$Id: algebra.lib,v 1.24 2009-07-28 10:34:54 Singular Exp $"; 6 6 category="Commutative Algebra"; 7 7 info=" … … 254 254 NOTE: the proc algebra_containment tests the same using a different 255 255 algorithm, which is often faster 256 if l[1] == 0 then l[2] may contain more than one relation h(y(0),y(1),...,y(k)), 256 if l[1] == 0 then l[2] may contain more than one relation h(y(0),y(1),...,y(k)), 257 257 separated by comma 258 258 EXAMPLE: example inSubring; shows an example -
Singular/LIB/bfun.lib
rae9fd9 r3f4e52 1 1 ////////////////////////////////////////////////////////////////////////////// 2 version="$Id: bfun.lib,v 1.1 1 2009-07-28 10:19:59Singular Exp $";2 version="$Id: bfun.lib,v 1.12 2009-07-28 10:34:54 Singular Exp $"; 3 3 category="Noncommutative"; 4 4 info=" … … 10 10 @* one is interested in the global b-function (also known as Bernstein-Sato 11 11 @* polynomial) b(s) in K[s], defined to be the non-zero monic polynomial of minimal 12 @* degree, satisfying a functional identity L * F^{s+1} = b(s) F^s, 12 @* degree, satisfying a functional identity L * F^{s+1} = b(s) F^s, 13 13 @* for some operator L in D[s] (* stands for the action of differential operator) 14 14 @* By D one denotes the n-th Weyl algebra … … 22 22 @* (that is, an ideal I in a Weyl algebra D, such that D/I is holonomic module) 23 23 @* with respect to the given weight vector w: For a polynomial p in D, its initial 24 @* form w.r.t. (-w,w) is defined as the sum of all terms of p which have 24 @* form w.r.t. (-w,w) is defined as the sum of all terms of p which have 25 25 @* maximal weighted total degree where the weight of x_i is -w_i and the weight 26 @* of d_i is w_i. Let J be the initial ideal of I w.r.t. (-w,w), i.e. the 26 @* of d_i is w_i. Let J be the initial ideal of I w.r.t. (-w,w), i.e. the 27 27 @* K-vector space generated by all initial forms w.r.t (-w,w) of elements of I. 28 28 @* Put s = w_1 x_1 d_1 + ... + w_n x_n d_n. Then the monic generator b_w(s) of … … 31 31 @* arbitrary weights need not have rational roots at all. However, b-function 32 32 @* of a holonomic ideal is known to be non-zero as well. 33 @* 34 @* References: [SST] Saito, Sturmfels, Takayama: Groebner Deformations of 33 @* 34 @* References: [SST] Saito, Sturmfels, Takayama: Groebner Deformations of 35 35 @* Hypergeometric Differential Equations (2000), 36 36 @* Noro: An Efficient Modular Algorithm for Computing the Global b-function, … … 53 53 AUXILIARY PROCEDURES: 54 54 55 allPositive(v); checks whether all entries of an intvec are positive 55 allPositive(v); checks whether all entries of an intvec are positive 56 56 scalarProd(v,w); computes the standard scalar product of two intvecs 57 57 vec2poly(v[,i]); constructs an univariate polynomial with given coefficients … … 361 361 for (i=1; i<=ncols(I); i++) { M[i] = gen(i); } 362 362 } 363 } 363 } 364 364 dbprint(ppl-1,"// initially sorted ideal:", I); 365 365 if (remembercoeffs <> 0) { dbprint(ppl-1,"// used permutations:", M); } … … 477 477 @* If t<>0 (and by default) all monomials are reduced (if possible), 478 478 @* otherwise, only leading monomials are reduced. 479 @* If u<>0 (and by default), the ideal is linearly pre-reduced, i.e. 479 @* If u<>0 (and by default), the ideal is linearly pre-reduced, i.e. 480 480 @* instead of the given ideal, the output of @code{linReduceIdeal} is used. 481 481 @* If u is set to 0 and the given ideal does not equal the output of … … 921 921 NOTE: If the intersection is zero, this procedure might not terminate. 922 922 @* If p>0 is given, this proc computes the generator of the intersection in 923 @* char p first and then only searches for a generator of the obtained 924 @* degree in the basering. Otherwise, it searches for all degrees by 923 @* char p first and then only searches for a generator of the obtained 924 @* degree in the basering. Otherwise, it searches for all degrees by 925 925 @* computing syzygies. 926 926 @* If s<>0, @code{std} is used for Groebner basis computations in char 0, 927 927 @* otherwise, and by default, @code{slimgb} is used. 928 @* If t<>0 and by default, @code{std} is used for Groebner basis 928 @* If t<>0 and by default, @code{std} is used for Groebner basis 929 929 @* computations in char >0, otherwise, @code{slimgb} is used. 930 930 DISPLAY: If printlevel=1, progress debug messages will be printed, … … 1134 1134 } 1135 1135 dbprint(ppl,"// pIntersectSyz finished"); 1136 if (solveincharp) { short = shortSave; } 1136 if (solveincharp) { short = shortSave; } 1137 1137 return(v); 1138 1138 } … … 1289 1289 if (size(L) == 3) // irreducible factor 1290 1290 { 1291 if (L[3] <> "0" && L[3] <> "1") 1291 if (L[3] <> "0" && L[3] <> "1") 1292 1292 { 1293 1293 LL = LL + list(L[3]); … … 1427 1427 RETURN: list of ideal and intvec 1428 1428 PURPOSE: computes the roots of the Bernstein-Sato polynomial b(s) 1429 @* for the hypersurface defined by f. 1429 @* for the hypersurface defined by f. 1430 1430 ASSUME: The basering is commutative and of characteristic 0. 1431 1431 BACKGROUND: In this proc, the initial Malgrange ideal is computed according to 1432 1432 @* the algorithm by Masayuki Noro and then a system of linear equations is 1433 1433 @* solved by linear reductions. 1434 NOTE: In the output list, the ideal contains all the roots 1434 NOTE: In the output list, the ideal contains all the roots 1435 1435 @* and the intvec their multiplicities. 1436 1436 @* If s<>0, @code{std} is used for GB computations, 1437 @* otherwise, and by default, @code{slimgb} is used. 1437 @* otherwise, and by default, @code{slimgb} is used. 1438 1438 @* If t<>0, a matrix ordering is used for Groebner basis computations, 1439 1439 @* otherwise, and by default, a block ordering is used. … … 1498 1498 @* the algorithm by Masayuki Noro and then a system of linear equations is 1499 1499 @* solved by computing syzygies. 1500 NOTE: In the output list, the ideal contains all the roots and the intvec 1500 NOTE: In the output list, the ideal contains all the roots and the intvec 1501 1501 @* their multiplicities. 1502 1502 @* If r<>0, @code{std} is used for GB computations in characteristic 0, … … 1583 1583 ASSUME: The basering is the n-th Weyl algebra in characteristic 0 and for all 1584 1584 @* 1<=i<=n the identity var(i+n)*var(i)=var(i)*var(i+1)+1 holds, i.e. the 1585 @* sequence of variables is given by x(1),...,x(n),D(1),...,D(n), 1585 @* sequence of variables is given by x(1),...,x(n),D(1),...,D(n), 1586 1586 @* where D(i) is the differential operator belonging to x(i). 1587 1587 @* Further we assume that I is holonomic. … … 1596 1596 @* L[3] is 1 (for nonzero constant) or 0 (for zero b-function). 1597 1597 @* If s<>0, @code{std} is used for GB computations in characteristic 0, 1598 @* otherwise, and by default, @code{slimgb} is used. 1598 @* otherwise, and by default, @code{slimgb} is used. 1599 1599 @* If t<>0, a matrix ordering is used for GB computations, otherwise, 1600 1600 @* and by default, a block ordering is used. … … 1685 1685 @* their multiplicities. 1686 1686 @* If s<>0, @code{std} is used for the GB computation, otherwise, 1687 @* and by default, @code{slimgb} is used. 1687 @* and by default, @code{slimgb} is used. 1688 1688 @* If t<>0, a matrix ordering is used for GB computations, 1689 1689 @* otherwise, and by default, a block ordering is used. … … 1697 1697 def save = basering; 1698 1698 int n = nvars(save); 1699 if (char(save) <> 0) 1699 if (char(save) <> 0) 1700 1700 { 1701 1701 ERROR("characteristic of basering has to be 0"); … … 1734 1734 // create names for vars 1735 1735 list Lvar; 1736 Lvar[1] = safeVarName("t"); 1736 Lvar[1] = safeVarName("t"); 1737 1737 Lvar[2] = safeVarName("s"); 1738 1738 Lvar[n+3] = safeVarName("D"+Lvar[1]); … … 1747 1747 intvec @a = 1:N; @a[2] = 2; 1748 1748 intvec @a2 = @a; @a2[2] = 0; @a2[2*n+4] = 0; 1749 list Lord; 1749 list Lord; 1750 1750 Lord[1] = list("a",@a); Lord[2] = list("a",@a2); 1751 1751 if (methodord == 0) // default: block ordering … … 1848 1848 @* If a<>0, only f is appended to Ann(f^s), otherwise, and by default, 1849 1849 @* f and all its partial derivatives are appended. 1850 @* If b<>0, @code{std} is used for GB computations, otherwise, and by 1850 @* If b<>0, @code{std} is used for GB computations, otherwise, and by 1851 1851 @* default, @code{slimgb} is used. 1852 1852 @* If c<>0, @code{std} is used for Groebner basis computations of ideals -
Singular/LIB/crypto.lib
rae9fd9 r3f4e52 1 1 //GP, last modified 28.6.06 2 2 /////////////////////////////////////////////////////////////////////////////// 3 version="$Id: crypto.lib,v 1. 9 2009-04-15 11:11:20 seelischExp $";3 version="$Id: crypto.lib,v 1.10 2009-07-28 10:34:54 Singular Exp $"; 4 4 category="Teaching"; 5 5 info=" … … 1575 1575 "USAGE: generateG(a,b,m); 1576 1576 RETURN: m-th division polynomial 1577 NOTE: generate the so-called division polynomials, i.e., the recursively defined 1577 NOTE: generate the so-called division polynomials, i.e., the recursively defined 1578 1578 polynomials p_m=generateG(a,b,m) in Z[x, y] such that, for a point (x:y:1) on the 1579 1579 elliptic curve defined by y^2=x^3+a*x+b over Z/N the point@* -
Singular/LIB/dmod.lib
rae9fd9 r3f4e52 1 1 ////////////////////////////////////////////////////////////////////////////// 2 version="$Id: dmod.lib,v 1.4 6 2009-07-27 07:49:53Singular Exp $";2 version="$Id: dmod.lib,v 1.47 2009-07-28 10:34:54 Singular Exp $"; 3 3 category="Noncommutative"; 4 4 info=" … … 7 7 @* Jorge Martin Morales, jorge@unizar.es 8 8 9 THEORY: Let K be a field of characteristic 0. Given a polynomial ring 9 THEORY: Let K be a field of characteristic 0. Given a polynomial ring 10 10 @* R = K[x_1,...,x_n] and a polynomial F in R, 11 @* one is interested in the R[1/F]-module of rank one, generated by 11 @* one is interested in the R[1/F]-module of rank one, generated by 12 12 @* the symbol F^s for a symbolic discrete variable s. 13 13 @* In fact, the module R[1/F]*F^s has a structure of a D(R)[s]-module, where D(R) … … 19 19 @* One is interested in the following data: 20 20 @* - Ann F^s = I = I(F^s) in D(R)[s], denoted by LD in the output 21 @* - global Bernstein polynomial in K[s], denoted by bs, 21 @* - global Bernstein polynomial in K[s], denoted by bs, 22 22 @* - its minimal integer root s0, the list of all roots of bs, which are known 23 23 @* to be rational, with their multiplicities, which is denoted by BS 24 @* - Ann F^s0 = I(F^s0) in D(R), denoted by LD0 in the output 24 @* - Ann F^s0 = I(F^s0) in D(R), denoted by LD0 in the output 25 25 @* (LD0 is a holonomic ideal in D(R)) 26 26 @* - Ann^(1) F^s in D(R)[s], denoted by LD1 (logarithmic derivations) … … 28 28 @* PS*F^(s+1) = bs*F^s holds in K[x_1,...,x_n,1/F]*F^s. 29 29 30 REFERENCES: 30 REFERENCES: 31 31 @* We provide the following implementations of algorithms: 32 @* (OT) the classical Ann F^s algorithm from Oaku and Takayama (Journal of 32 @* (OT) the classical Ann F^s algorithm from Oaku and Takayama (Journal of 33 33 @* Pure and Applied Math., 1999), 34 34 @* (LOT) Levandovskyy's modification of the Oaku-Takayama algorithm (ISSAC 2007) … … 36 36 @* l'ideal de Bernstein associe a des polynomes, preprint, 2002) 37 37 @* (LM08) V. Levandovskyy and J. Martin-Morales, ISSAC 2008 38 @* (C) Countinho, A Primer of Algebraic D-Modules, 39 @* (SST) Saito, Sturmfels, Takayama 'Groebner Deformations of Hypergeometric 38 @* (C) Countinho, A Primer of Algebraic D-Modules, 39 @* (SST) Saito, Sturmfels, Takayama 'Groebner Deformations of Hypergeometric 40 40 @* Differential Equations', Springer, 2000 41 41 … … 146 146 "USAGE: annfs(f [,S,eng]); f a poly, S a string, eng an optional int 147 147 RETURN: ring 148 PURPOSE: compute the D-module structure of basering[1/f]*f^s with the algorithm 148 PURPOSE: compute the D-module structure of basering[1/f]*f^s with the algorithm 149 149 @* given in S and with the Groebner basis engine given in ''eng'' 150 150 NOTE: activate the output ring with the @code{setring} command. … … 270 270 "USAGE: Sannfs(f [,S,eng]); f a poly, S a string, eng an optional int 271 271 RETURN: ring 272 PURPOSE: compute the D-module structure of basering[f^s] with the algorithm 272 PURPOSE: compute the D-module structure of basering[f^s] with the algorithm 273 273 @* given in S and with the Groebner basis engine given in eng 274 274 NOTE: activate the output ring with the @code{setring} command. … … 391 391 PURPOSE: compute the D-module structure of basering[1/f]*f^s 392 392 NOTE: activate the output ring with the @code{setring} command. 393 @* In the output ring D[s], the ideal LD1 is generated by the elements 393 @* In the output ring D[s], the ideal LD1 is generated by the elements 394 394 @* in Ann F^s in D[s], coming from logarithmic derivations. 395 395 @* If eng <>0, @code{std} is used for Groebner basis computations, … … 539 539 "USAGE: ALTannfsBM(f [,eng]); f a poly, eng an optional int 540 540 RETURN: ring 541 PURPOSE: compute the annihilator ideal of f^s in D[s], where D is the Weyl 541 PURPOSE: compute the annihilator ideal of f^s in D[s], where D is the Weyl 542 542 @* algebra, according to the algorithm by Briancon and Maisonobe 543 543 NOTE: activate the output ring with the @code{setring} command. In this ring, … … 731 731 "USAGE: bernsteinBM(f [,eng]); f a poly, eng an optional int 732 732 RETURN: list (of roots of the Bernstein polynomial b and their multiplicies) 733 PURPOSE: compute the global Bernstein-Sato polynomial for a hypersurface, 733 PURPOSE: compute the global Bernstein-Sato polynomial for a hypersurface, 734 734 @* defined by f, according to the algorithm by Briancon and Maisonobe 735 735 NOTE: If eng <>0, @code{std} is used for Groebner basis computations, … … 1254 1254 "USAGE: annfs2(I, F [,eng]); I an ideal, F a poly, eng an optional int 1255 1255 RETURN: ring 1256 PURPOSE: compute the annihilator ideal of f^s in the Weyl Algebra, 1256 PURPOSE: compute the annihilator ideal of f^s in the Weyl Algebra, 1257 1257 @* based on the output of Sannfs-like procedure 1258 1258 @* annfs2 uses shorter expressions in the variable s (the idea of Noro). … … 1415 1415 "USAGE: annfsRB(I, F [,eng]); I an ideal, F a poly, eng an optional int 1416 1416 RETURN: ring 1417 PURPOSE: compute the annihilator ideal of f^s in the Weyl Algebra, 1417 PURPOSE: compute the annihilator ideal of f^s in the Weyl Algebra, 1418 1418 @* based on the output of Sannfs like procedure 1419 1419 NOTE: activate the output ring with the @code{setring} command. In this ring, … … 1604 1604 "USAGE: operatorBM(f [,eng]); f a poly, eng an optional int 1605 1605 RETURN: ring 1606 PURPOSE: compute the B-operator and other relevant data for Ann F^s, 1606 PURPOSE: compute the B-operator and other relevant data for Ann F^s, 1607 1607 @* using e.g. algorithm by Briancon and Maisonobe for Ann F^s and BS. 1608 1608 NOTE: activate the output ring with the @code{setring} command. In the output ring D[s] … … 1921 1921 "USAGE: operatorModulo(f,I,b); f a poly, I an ideal, b a poly 1922 1922 RETURN: poly 1923 PURPOSE: compute the B-operator from the polynomial f, 1924 @* ideal I = Ann f^s and Bernstein-Sato polynomial b 1923 PURPOSE: compute the B-operator from the polynomial f, 1924 @* ideal I = Ann f^s and Bernstein-Sato polynomial b 1925 1925 @* using modulo i.e. kernel of module homomorphism 1926 NOTE: The computations take place in the ring, similar to the one 1926 NOTE: The computations take place in the ring, similar to the one 1927 1927 @* returned by Sannfs procedure. 1928 @* Note, that operator is not completely reduced wrt Ann f^{s+1}. 1928 @* Note, that operator is not completely reduced wrt Ann f^{s+1}. 1929 1929 @* If printlevel=1, progress debug messages will be printed, 1930 1930 @* if printlevel>=2, all the debug messages will be printed. … … 1953 1953 // module GMT = transpose(G); 1954 1954 // GMT = GMT[2],GMT[3]; // modulo matrix 1955 // module K = GMT[2]; 1955 // module K = GMT[2]; 1956 1956 // GMT = transpose(GMT); 1957 1957 // K = transpose(K); … … 1986 1986 return(t); 1987 1987 } 1988 dbprint(ppl,"no explicit constant. Start one more GB computation"); 1988 dbprint(ppl,"no explicit constant. Start one more GB computation"); 1989 1989 // else: compute GB and do the same 1990 1990 L = L[2..ncols(L)]; … … 2049 2049 LD = groebner(LD); 2050 2050 PS = NF(PS,subst(LD,s,s+1));; // reduction modulo Ann s^{s+1} 2051 size(PS); 2051 size(PS); 2052 2052 lead(PS); 2053 2053 reduce(PS*F-bs,LD); // check the defining property of PS … … 2300 2300 "USAGE: annfsBMI(F [,eng]); F an ideal, eng an optional int 2301 2301 RETURN: ring 2302 PURPOSE: compute the D-module structure of basering[1/f]*f^s where 2302 PURPOSE: compute the D-module structure of basering[1/f]*f^s where 2303 2303 @* f = F[1]*..*F[P], according to the algorithm by Briancon and Maisonobe. 2304 2304 NOTE: activate the output ring with the @code{setring} command. In this ring, … … 2629 2629 "USAGE: annfsOT(f [,eng]); f a poly, eng an optional int 2630 2630 RETURN: ring 2631 PURPOSE: compute the D-module structure of basering[1/f]*f^s, 2631 PURPOSE: compute the D-module structure of basering[1/f]*f^s, 2632 2632 @* according to the algorithm by Oaku and Takayama 2633 2633 NOTE: activate the output ring with the @code{setring} command. In this ring, … … 3011 3011 "USAGE: SannfsOT(f [,eng]); f a poly, eng an optional int 3012 3012 RETURN: ring 3013 PURPOSE: compute the D-module structure of basering[1/f]*f^s, according to the 3013 PURPOSE: compute the D-module structure of basering[1/f]*f^s, according to the 3014 3014 @* 1st step of the algorithm by Oaku and Takayama in the ring D[s] 3015 3015 NOTE: activate the output ring with the @code{setring} command. 3016 @* In the output ring D[s], the ideal LD (which is NOT a Groebner basis) 3016 @* In the output ring D[s], the ideal LD (which is NOT a Groebner basis) 3017 3017 @* is the needed D-module structure. 3018 3018 @* If eng <>0, @code{std} is used for Groebner basis computations, … … 3295 3295 "USAGE: SannfsBM(f [,eng]); f a poly, eng an optional int 3296 3296 RETURN: ring 3297 PURPOSE: compute the D-module structure of basering[1/f]*f^s, according to the 3297 PURPOSE: compute the D-module structure of basering[1/f]*f^s, according to the 3298 3298 @* 1st step of the algorithm by Briancon and Maisonobe in the ring D[s]. 3299 3299 NOTE: activate the output ring with the @code{setring} command. 3300 @* In the output ring D[s], the ideal LD (which is NOT a Groebner basis) is 3300 @* In the output ring D[s], the ideal LD (which is NOT a Groebner basis) is 3301 3301 @* the needed D-module structure. 3302 3302 @* If eng <>0, @code{std} is used for Groebner basis computations, … … 3665 3665 // ----- keep char, minpoly 3666 3666 L[1] = RL[1]; 3667 L[4] = RL[4]; 3667 L[4] = RL[4]; 3668 3668 // ----- create vars 3669 3669 string newVar@t = safeVarName("t"); … … 3720 3720 { 3721 3721 I = J,I; 3722 I = engine(I,eng); 3722 I = engine(I,eng); 3723 3723 } 3724 3724 kill J; … … 3773 3773 { 3774 3774 LD = LD,J; 3775 LD = engine(LD,eng); 3775 LD = engine(LD,eng); 3776 3776 } 3777 3777 if (addPD) { dbprint(ppl,"// -4-4- Finished GB computations for Ann f^s + <f, f_i>"); } … … 3811 3811 PURPOSE: compute Ann f^s and Groebner basis of Ann f^s+f in D[s] 3812 3812 NOTE: activate the output ring with the @code{setring} command. 3813 @* This procedure, unlike SannfsBM, returns a ring with the degrevlex 3813 @* This procedure, unlike SannfsBM, returns a ring with the degrevlex 3814 3814 @* ordering in all variables. 3815 3815 @* In the ring D[s], the ideal LD (which IS a Groebner basis) is the needed ideal. … … 3820 3820 " 3821 3821 { 3822 // DEBUG INFO: ordering on the output ring = dp, 3822 // DEBUG INFO: ordering on the output ring = dp, 3823 3823 // use std(K,F); for reusing the std property of K 3824 3824 … … 4032 4032 "USAGE: SannfsLOT(f [,eng]); f a poly, eng an optional int 4033 4033 RETURN: ring 4034 PURPOSE: compute the D-module structure of basering[1/f]*f^s, according to the 4034 PURPOSE: compute the D-module structure of basering[1/f]*f^s, according to the 4035 4035 @* Levandovskyy's modification of the algorithm by Oaku and Takayama in D[s] 4036 4036 NOTE: activate the output ring with the @code{setring} command. 4037 @* In the ring D[s], the ideal LD (which is NOT a Groebner basis) is 4037 @* In the ring D[s], the ideal LD (which is NOT a Groebner basis) is 4038 4038 @* the needed D-module structure. 4039 4039 @* If eng <>0, @code{std} is used for Groebner basis computations, … … 4489 4489 "USAGE: annfsLOT(F [,eng]); F a poly, eng an optional int 4490 4490 RETURN: ring 4491 PURPOSE: compute the D-module structure of basering[1/f]*f^s, according to 4491 PURPOSE: compute the D-module structure of basering[1/f]*f^s, according to 4492 4492 @* the Levandovskyy's modification of the algorithm by Oaku and Takayama 4493 4493 NOTE: activate the output ring with the @code{setring} command. In this ring, … … 4534 4534 "USAGE: annfs0(I, F [,eng]); I an ideal, F a poly, eng an optional int 4535 4535 RETURN: ring 4536 PURPOSE: compute the annihilator ideal of f^s in the Weyl Algebra, based 4536 PURPOSE: compute the annihilator ideal of f^s in the Weyl Algebra, based 4537 4537 @* on the output of Sannfs-like procedure 4538 4538 NOTE: activate the output ring with the @code{setring} command. In this ring, … … 5023 5023 "USAGE: annfspecial(I,F,mir,n); I an ideal, F a poly, int mir, number n 5024 5024 RETURN: ideal 5025 PURPOSE: compute the annihilator ideal of F^n in the Weyl Algebra 5025 PURPOSE: compute the annihilator ideal of F^n in the Weyl Algebra 5026 5026 @* for the given rational number n 5027 5027 ASSUME: The basering is D[s] and contains 's' explicitly as a variable, … … 5029 5029 @* the integer 'mir' is the minimal integer root of the BS polynomial of F, 5030 5030 @* and the number n is rational. 5031 NOTE: We compute the real annihilator for any rational value of n (both 5032 @* generic and exceptional). The implementation goes along the lines of 5033 @* the Algorithm 5.3.15 from Saito-Sturmfels-Takayama. 5031 NOTE: We compute the real annihilator for any rational value of n (both 5032 @* generic and exceptional). The implementation goes along the lines of 5033 @* the Algorithm 5.3.15 from Saito-Sturmfels-Takayama. 5034 5034 DISPLAY: If printlevel=1, progress debug messages will be printed, 5035 5035 @* if printlevel>=2, all the debug messages will be printed. … … 5355 5355 RETURN: int 5356 5356 ASSUME: Basering is a commutative ring, alpha is a rational number. 5357 PURPOSE: check whether a rational number alpha is a root of the global 5357 PURPOSE: check whether a rational number alpha is a root of the global 5358 5358 @* Bernstein-Sato polynomial of f and compute its multiplicity, 5359 5359 @* with the algorithm given by S and with the Groebner basis engine given by eng. 5360 NOTE: The annihilator of f^s in D[s] is needed and hence it is computed with the 5360 NOTE: The annihilator of f^s in D[s] is needed and hence it is computed with the 5361 5361 @* algorithm by Briancon and Maisonobe. The value of a string S can be 5362 5362 @* 'alg1' (default) - for the algorithm 1 of [LM08] … … 5605 5605 proc checkRoot2 (ideal I, poly F, number a, list #) 5606 5606 "USAGE: checkRoot2(I,f,a [,eng]); I an ideal, f a poly, alpha a number, eng an optional int 5607 ASSUME: I is the annihilator of f^s in D[s], basering is D[s], 5607 ASSUME: I is the annihilator of f^s in D[s], basering is D[s], 5608 5608 @* that is basering and I are the output os Sannfs-like procedure, 5609 5609 @* f is a polynomial in K[_x] and alpha is a rational number. 5610 RETURN: int, the multiplicity of -alpha as a root of the BS polynomial of f. 5610 RETURN: int, the multiplicity of -alpha as a root of the BS polynomial of f. 5611 5611 PURPOSE: check whether a rational number alpha is a root of the global Bernstein- 5612 5612 @* Sato polynomial of f and compute its multiplicity from the known Ann F^s in D[s] … … 5620 5620 { 5621 5621 5622 5622 5623 5623 // to check: alpha is rational (has char 0 check inside) 5624 5624 if (!isRational(a)) … … 5755 5755 ASSUME: checkFactor is called from the basering, created by Sannfs-like proc, 5756 5756 @* that is, from the Weyl algebra in x1,..,xN,d1,..,dN tensored with K[s]. 5757 @* The ideal I is the annihilator of f^s in D[s], that is the ideal, computed 5757 @* The ideal I is the annihilator of f^s in D[s], that is the ideal, computed 5758 5758 @* by Sannfs-like procedure (usually called LD there). 5759 5759 @* Moreover, f is a polynomial in K[x1,..,xN] and qs is a polynomial in K[s]. 5760 5760 RETURN: int, 1 if qs is a factor of the global Bernstein polynomial of f and 0 otherwise 5761 PURPOSE: check whether a univariate polynomial qs is a factor of the 5761 PURPOSE: check whether a univariate polynomial qs is a factor of the 5762 5762 @* Bernstein-Sato polynomial of f without explicit knowledge of the latter. 5763 5763 NOTE: If eng <>0, @code{std} is used for Groebner basis computations, … … 5856 5856 "USAGE: indAR(L,n); list L, int n 5857 5857 RETURN: list 5858 PURPOSE: computes arrangement inductively, using L and 5858 PURPOSE: computes arrangement inductively, using L and 5859 5859 @* var(n) as the next variable 5860 5860 ASSUME: L has a structure of an arrangement … … 5904 5904 5905 5905 proc isRational(number n) 5906 "USAGE: isRational(n); n number 5906 "USAGE: isRational(n); n number 5907 5907 RETURN: int 5908 5908 PURPOSE: determine whether n is a rational number, -
Singular/LIB/dmodapp.lib
rae9fd9 r3f4e52 1 1 ////////////////////////////////////////////////////////////////////////////// 2 version="$Id: dmodapp.lib,v 1.3 2 2009-07-28 10:13:06Singular Exp $";2 version="$Id: dmodapp.lib,v 1.33 2009-07-28 10:34:55 Singular Exp $"; 3 3 category="Noncommutative"; 4 4 info=" … … 7 7 @* Daniel Andres, daniel.andres@math.rwth-aachen.de 8 8 9 GUIDE: Let K be a field of characteristic 0, R = K[x1,..xN] and 9 GUIDE: Let K be a field of characteristic 0, R = K[x1,..xN] and 10 10 @* D be the Weyl algebra in variables x1,..xN,d1,..dN. 11 11 @* In this library there are the following procedures for algebraic D-modules: 12 12 @* - localization of a holonomic module D/I with respect to a mult. closed set 13 @* of all powers of a given polynomial F from R. Our aim is to compute an 14 @* ideal L in D, such that D/L is a presentation of a localized module. Such L 15 @* always exists, since such localizations are known to be holonomic and thus 13 @* of all powers of a given polynomial F from R. Our aim is to compute an 14 @* ideal L in D, such that D/L is a presentation of a localized module. Such L 15 @* always exists, since such localizations are known to be holonomic and thus 16 16 @* cyclic modules. The procedures for the localization are DLoc,SDLoc and DLoc0. 17 17 @* 18 18 @* - annihilator in D of a given polynomial F from R as well as 19 @* of a given rational function G/F from Quot(R). These can be computed via 19 @* of a given rational function G/F from Quot(R). These can be computed via 20 20 @* procedures annPoly resp. annRat. 21 21 @* 22 @* - initial form and initial ideals in Weyl algebras with respect to a given 22 @* - initial form and initial ideals in Weyl algebras with respect to a given 23 23 @* weight vector can be computed with inForm, initialMalgrange, initialIdealW. 24 24 @* 25 @* - appelF1, appelF2 and appelF4 return ideals in parametric Weyl algebras, 25 @* - appelF1, appelF2 and appelF4 return ideals in parametric Weyl algebras, 26 26 @* which annihilate corresponding Appel hypergeometric functions. 27 27 28 REFERENCES: 29 @* (SST) Saito, Sturmfels, Takayama 'Groebner Deformations of Hypergeometric 28 REFERENCES: 29 @* (SST) Saito, Sturmfels, Takayama 'Groebner Deformations of Hypergeometric 30 30 @* Differential Equations', Springer, 2000 31 31 @* (ONW) Oaku, Takayama, Walther 'A Localization Algorithm for D-modules', 2000 … … 279 279 "USAGE: appelF1(); 280 280 RETURN: ring (and exports an ideal into it) 281 PURPOSE: define the ideal in a parametric Weyl algebra, 281 PURPOSE: define the ideal in a parametric Weyl algebra, 282 282 @* which annihilates Appel F1 hypergeometric function 283 283 NOTE: the ideal called IAppel1 is exported to the output ring … … 307 307 } 308 308 309 proc appelF2() 309 proc appelF2() 310 310 "USAGE: appelF2(); 311 311 RETURN: ring (and exports an ideal into it) 312 PURPOSE: define the ideal in a parametric Weyl algebra, 312 PURPOSE: define the ideal in a parametric Weyl algebra, 313 313 @* which annihilates Appel F2 hypergeometric function 314 314 NOTE: the ideal called IAppel2 is exported to the output ring … … 340 340 "USAGE: appelF4(); 341 341 RETURN: ring (and exports an ideal into it) 342 PURPOSE: define the ideal in a parametric Weyl algebra, 342 PURPOSE: define the ideal in a parametric Weyl algebra, 343 343 @* which annihilates Appel F4 hypergeometric function 344 344 NOTE: the ideal called IAppel4 is exported to the output ring … … 460 460 ERROR("Basering is not a Weyl algebra"); 461 461 } 462 if (defined(LD0) || defined(BS)) 462 if (defined(LD0) || defined(BS)) 463 463 { 464 464 ERROR("Reserved names LD0 and/or BS are used. Please rename the objects."); … … 500 500 "USAGE: DLoc0(I, F); I an ideal, F a poly 501 501 RETURN: ring 502 PURPOSE: compute the presentation of the localization of D/I w.r.t. f^s, 502 PURPOSE: compute the presentation of the localization of D/I w.r.t. f^s, 503 503 @* where D is a Weyl Algebra, based on the output of procedure SDLoc 504 504 ASSUME: the basering is similar to the output ring of SDLoc procedure … … 734 734 gkdim(I); // 3 735 735 def W = SDLoc(I,F); setring W; // creates ideal LD in W = R[s] 736 def U = DLoc0(LD, x2-y3); setring U; // compute in R 736 def U = DLoc0(LD, x2-y3); setring U; // compute in R 737 737 LD0; // Groebner basis of the presentation of localization 738 738 BS; // description of b-function for localization … … 949 949 setring R; 950 950 poly F = x2-y3; 951 ideal I = Dx*F, Dy*F; 951 ideal I = Dx*F, Dy*F; 952 952 // note, that I is not holonomic, since it's dimension is not 2 953 953 gkdim(I); // 3, while dim R = 4 … … 1405 1405 RETURN: poly 1406 1406 PURPOSE: reconstruct a monic polynomial in one variable from its factorization 1407 ASSUME: s is a string with the name of some variable and 1407 ASSUME: s is a string with the name of some variable and 1408 1408 @* L is supposed to consist of two entries: 1409 1409 @* L[1] of the type ideal with the roots of a polynomial … … 1468 1468 ASSUME: The basering is the n-th Weyl algebra in characteristic 0 and for all 1469 1469 @* 1<=i<=n the identity var(i+n)*var(i)=var(i)*var(i+1)+1 holds, i.e. the 1470 @* sequence of variables is given by x(1),...,x(n),D(1),...,D(n), 1470 @* sequence of variables is given by x(1),...,x(n),D(1),...,D(n), 1471 1471 @* where D(i) is the differential operator belonging to x(i). 1472 1472 PURPOSE: computes the initial ideal with respect to given weights. … … 1536 1536 ERROR(string(var(i+n)) + " is not a differential operator for " + string(var(i))); 1537 1537 } 1538 } 1538 } 1539 1539 // 1. create homogenized Weyl algebra 1540 1540 // 1.1 create ordering … … 1571 1571 for (i=1; i<=n; i++) { @relD[i,n+i] = var(N)^(homogweights[i]+homogweights[n+i]); } 1572 1572 def Dh = nc_algebra(1,@relD); 1573 setring Dh; kill @Dh; 1573 setring Dh; kill @Dh; 1574 1574 dbprint(ppl-1,"// computing in ring",Dh); 1575 1575 // 2. Compute the initial ideal … … 1816 1816 { 1817 1817 dbprint(ppl,"// found no roots"); 1818 } 1818 } 1819 1819 L = list(II,mm); 1820 1820 if (ir <> 1) … … 1825 1825 L = L + list(string(ir)); 1826 1826 } 1827 else 1827 else 1828 1828 { 1829 1829 dbprint(ppl,"// no irreducible factors found"); 1830 } 1830 } 1831 1831 setring save; 1832 1832 L = imap(@S,L); … … 1838 1838 ring r = 0,(x,y),dp; 1839 1839 bFactor((x^2-1)^2); 1840 bFactor((x^2+1)^2); 1840 bFactor((x^2+1)^2); 1841 1841 bFactor((y^2+1/2)*(y+9)*(y-7)); 1842 1842 } -
Singular/LIB/elim.lib
rae9fd9 r3f4e52 1 // $Id: elim.lib,v 1.3 4 2009-05-05 09:25:56 bulyginExp $1 // $Id: elim.lib,v 1.35 2009-07-28 10:34:55 Singular Exp $ 2 2 // (GMG, modified 22.06.96) 3 3 // GMG, last modified 30.10.08: new procedure elimRing; … … 10 10 // and can now choose as method slimgb or std. 11 11 /////////////////////////////////////////////////////////////////////////////// 12 version="$Id: elim.lib,v 1.3 4 2009-05-05 09:25:56 bulyginExp $";12 version="$Id: elim.lib,v 1.35 2009-07-28 10:34:55 Singular Exp $"; 13 13 category="Commutative Algebra"; 14 14 info=" … … 478 478 if ( #[2] == "std" ) { method = "std"; } 479 479 if ( #[2] == "slimgb" ) { method = "slimgb"; } 480 480 481 481 } 482 482 else … … 484 484 ERROR("expected `elim(ideal,intvec[,string])`"); 485 485 } 486 486 487 487 if (size(#) == 3) 488 488 { … … 500 500 if ( method == "" ) 501 501 { 502 ERROR("expected \"std\" or \"slimgb\" or \"withWeights\" as the optional string parameters"); 503 } 504 502 ERROR("expected \"std\" or \"slimgb\" or \"withWeights\" as the optional string parameters"); 503 } 505 504 } 506 505 -
Singular/LIB/freegb.lib
rae9fd9 r3f4e52 1 1 ////////////////////////////////////////////////////////////////////////////// 2 version="$Id: freegb.lib,v 1.2 4 2009-04-15 11:13:09 seelischExp $";2 version="$Id: freegb.lib,v 1.25 2009-07-28 10:34:55 Singular Exp $"; 3 3 category="Noncommutative"; 4 4 info=" … … 42 42 PURPOSE: sets attributes for a letterplace ring: 43 43 @* 'isLetterplaceRing' = true, 'uptodeg' = d, 'lV' = b, where 44 @* 'uptodeg' stands for the degree bound, 44 @* 'uptodeg' stands for the degree bound, 45 45 @* 'lV' for the number of variables in the block 0. 46 46 NOTE: Activate the resulting ring by using @code{setring} … … 54 54 // Set letterplace-specific attributes for the output ring! 55 55 attrib(R, "uptodeg", uptodeg); 56 attrib(R, "lV", lV); 57 attrib(R, "isLetterplaceRing", 1); 58 return (R); 56 attrib(R, "lV", lV); 57 attrib(R, "isLetterplaceRing", 1); 58 return (R); 59 59 } 60 60 example … … 347 347 "USAGE: isVar(p); poly p 348 348 RETURN: int 349 PURPOSE: check, whether leading monomial of p is a power of a single variable 349 PURPOSE: check, whether leading monomial of p is a power of a single variable 350 350 @* from the basering. Returns the exponent or 0 if p is multivariate. 351 351 EXAMPLE: example isVar; shows examples … … 2130 2130 def R = makeLetterplaceRing(d); 2131 2131 setring R; 2132 int uptodeg = d; 2133 int lV = 2; 2132 int uptodeg = d; 2133 int lV = 2; 2134 2134 def R = setLetterplaceAttributes(r,uptodeg,2); // supply R with letterplace structure 2135 2135 setring R; -
Singular/LIB/general.lib
rae9fd9 r3f4e52 3 3 //eric, added absValue 11.04.2002 4 4 /////////////////////////////////////////////////////////////////////////////// 5 version="$Id: general.lib,v 1.6 4 2009-07-15 14:43:52 motsakExp $";5 version="$Id: general.lib,v 1.65 2009-07-28 10:34:55 Singular Exp $"; 6 6 category="General purpose"; 7 7 info=" … … 846 846 // Note that in general: lead(sort(M)) != sort(lead(M)), e.g: 847 847 module M = [0, 1, 1, 0], [1, 0, 0, 1]; M; 848 sort(lead(M), "c, dp")[1]; 849 lead(sort(M, "c, dp")[1]); 848 sort(lead(M), "c, dp")[1]; 849 lead(sort(M, "c, dp")[1]); 850 850 851 851 // In order to sort M wrt a NEW ordering by considering OLD leading 852 852 // terms use one of the following equivalent commands: 853 module( M[ sort(lead(M), "c,dp")[2] ] ); 854 sort( M, sort(lead(M), "c,dp")[2] )[1]; 853 module( M[ sort(lead(M), "c,dp")[2] ] ); 854 sort( M, sort(lead(M), "c,dp")[2] )[1]; 855 855 } 856 856 /////////////////////////////////////////////////////////////////////////////// -
Singular/LIB/gmssing.lib
rae9fd9 r3f4e52 1 1 /////////////////////////////////////////////////////////////////////////////// 2 version="$Id: gmssing.lib,v 1.1 4 2009-07-28 08:13:38Singular Exp $";2 version="$Id: gmssing.lib,v 1.15 2009-07-28 10:34:55 Singular Exp $"; 3 3 category="Singularities"; 4 4 … … 38 38 KEYWORDS: singularities; Gauss-Manin system; Brieskorn lattice; 39 39 mixed Hodge structure; V-filtration; weight filtration 40 Bernstein-Sato polynomial; monodromy; spectrum; spectral pairs; 40 Bernstein-Sato polynomial; monodromy; spectrum; spectral pairs; 41 41 good basis 42 42 "; … … 590 590 int bs[2][i]; multiplicity of i-th root of b(s) 591 591 @end format 592 KEYWORDS: singularities; Gauss-Manin system; Brieskorn lattice; 592 KEYWORDS: singularities; Gauss-Manin system; Brieskorn lattice; 593 593 Bernstein-Sato polynomial 594 594 EXAMPLE: example bernstein; shows examples … … 633 633 @format 634 634 list l; Jordan data jordan(M) of monodromy matrix exp(-2*pi*i*M) 635 ideal l[1]; 635 ideal l[1]; 636 636 number l[1][i]; eigenvalue of i-th Jordan block of M 637 intvec l[2]; 637 intvec l[2]; 638 638 int l[2][i]; size of i-th Jordan block of M 639 intvec l[3]; 639 intvec l[3]; 640 640 int l[3][i]; multiplicity of i-th Jordan block of M 641 641 @end format -
Singular/LIB/ncdecomp.lib
rae9fd9 r3f4e52 1 1 /////////////////////////////////////////////////////////////////////////////// 2 version="$Id: ncdecomp.lib,v 1.1 5 2009-07-07 16:29:58 levandovExp $";2 version="$Id: ncdecomp.lib,v 1.16 2009-07-28 10:34:55 Singular Exp $"; 3 3 category="Noncommutative"; 4 4 info=" … … 7 7 8 8 OVERVIEW: 9 @* This library presents algorithms for the central character decomposition of a module, 10 @* i.e. a decomposition into generalized weight modules with respect to the center. 11 @* Based on ideas of O. Khomenko and V. Levandovskyy (see the article [L2] in the 9 @* This library presents algorithms for the central character decomposition of a module, 10 @* i.e. a decomposition into generalized weight modules with respect to the center. 11 @* Based on ideas of O. Khomenko and V. Levandovskyy (see the article [L2] in the 12 12 @* References for details). 13 13 … … 119 119 RETURN: module 120 120 PURPOSE: compute the central quotient M:G 121 THEORY: for an ideal G of the center of an algebra and a submodule M of A^n, 121 THEORY: for an ideal G of the center of an algebra and a submodule M of A^n, 122 122 @* the central quotient of M by G is defined to be 123 123 @* M:G := { v in A^n | z*v in M, for all z in G }. -
Singular/LIB/polymake.lib
rae9fd9 r3f4e52 1 version="$Id: polymake.lib,v 1.1 7 2009-04-15 11:26:29 seelischExp $";1 version="$Id: polymake.lib,v 1.18 2009-07-28 10:34:55 Singular Exp $"; 2 2 category="Tropical Geometry"; 3 3 info=" 4 LIBRARY: polymake.lib Computations with polytopes and fans, 4 LIBRARY: polymake.lib Computations with polytopes and fans, 5 5 interface to polymake and TOPCOM 6 6 AUTHOR: Thomas Markwig, email: keilen@mathematik.uni-kl.de … … 8 8 WARNING: 9 9 Most procedures will not work unless polymake or topcom is installed and 10 if so, they will only work with the operating system LINUX! 10 if so, they will only work with the operating system LINUX! 11 11 For more detailed information see the following note or consult the 12 12 help string of the procedures. … … 14 14 NOTE: 15 15 Even though this is a @sc{Singular} library for computing polytopes and fans 16 such as the Newton polytope or the Groebner fan of a polynomial, most of 16 such as the Newton polytope or the Groebner fan of a polynomial, most of 17 17 the hard computations are NOT done by @sc{Singular} but by the program 18 18 @* - polymake by Ewgenij Gawrilow, TU Berlin and Michael Joswig, TU Darmstadt 19 @* (see http://www.math.tu-berlin.de/polymake/), 19 @* (see http://www.math.tu-berlin.de/polymake/), 20 20 @* respectively (only in the procedure triangularions) by the program 21 21 @* - topcom by Joerg Rambau, Universitaet Bayreuth (see http://www.uni-bayreuth.de/ 22 22 departments/wirtschaftsmathematik/rambau/TOPCOM); 23 23 @* This library should rather be seen as an interface which allows to use a 24 (very limited) number of options which polymake respectively topcom offers 25 to compute with polytopes and fans and to make the results available in 24 (very limited) number of options which polymake respectively topcom offers 25 to compute with polytopes and fans and to make the results available in 26 26 @sc{Singular} for further computations; 27 27 moreover, the user familiar with @sc{Singular} does not have to learn the syntax 28 of polymake or topcom, if the options offered here are sufficient for his 28 of polymake or topcom, if the options offered here are sufficient for his 29 29 purposes. 30 @* Note, though, that the procedures concerned with planar polygons are 30 @* Note, though, that the procedures concerned with planar polygons are 31 31 independent of both, polymake and topcom. 32 32 … … 95 95 proc polymakePolytope (intmat polytope,list #) 96 96 "USAGE: polymakePolytope(polytope[,#]); polytope list, # string 97 ASSUME: each row of polytope gives the coordinates of a lattice point of a 98 polytope with their affine coordinates as given by the output of 97 ASSUME: each row of polytope gives the coordinates of a lattice point of a 98 polytope with their affine coordinates as given by the output of 99 99 secondaryPolytope 100 PURPOSE: the procedure calls polymake to compute the vertices of the polytope 100 PURPOSE: the procedure calls polymake to compute the vertices of the polytope 101 101 as well as its dimension and information on its facets 102 102 RETURN: list L with four entries 103 103 @* L[1] : an integer matrix whose rows are the coordinates of vertices 104 of the polytope 104 of the polytope 105 105 @* L[2] : the dimension of the polytope 106 106 @* L[3] : a list whose i-th entry explains to which vertices the 107 ith vertex of the Newton polytope is connected 108 -- i.e. L[3][i] is an integer vector and an entry k in 109 there means that the vertex L[1][i] is connected to the 107 ith vertex of the Newton polytope is connected 108 -- i.e. L[3][i] is an integer vector and an entry k in 109 there means that the vertex L[1][i] is connected to the 110 110 vertex L[1][k] 111 @* L[4] : an integer matrix whose rows mulitplied by 112 (1,var(1),...,var(nvar)) give a linear system of equations 111 @* L[4] : an integer matrix whose rows mulitplied by 112 (1,var(1),...,var(nvar)) give a linear system of equations 113 113 describing the affine hull of the polytope, 114 114 i.e. the smallest affine space containing the polytope 115 NOTE: - for its computations the procedure calls the program polymake by 116 Ewgenij Gawrilow, TU Berlin and Michael Joswig, TU Darmstadt; 117 it therefore is necessary that this program is installed in order 115 NOTE: - for its computations the procedure calls the program polymake by 116 Ewgenij Gawrilow, TU Berlin and Michael Joswig, TU Darmstadt; 117 it therefore is necessary that this program is installed in order 118 118 to use this procedure; 119 119 see http://www.math.tu-berlin.de/polymake/ 120 @* - note that in the vertex edge graph we have changed the polymake 121 convention which starts indexing its vertices by zero while we start 120 @* - note that in the vertex edge graph we have changed the polymake 121 convention which starts indexing its vertices by zero while we start 122 122 with one ! 123 @* - the procedure creates the file /tmp/polytope.polymake which contains 124 the polytope in polymake format; if you wish to use this for further 125 computations with polymake, you have to use the procedure 123 @* - the procedure creates the file /tmp/polytope.polymake which contains 124 the polytope in polymake format; if you wish to use this for further 125 computations with polymake, you have to use the procedure 126 126 polymakeKeepTmpFiles in before 127 127 @* - moreover, the procedure creates the file /tmp/polytope.output which 128 128 it deletes again before ending 129 129 @* - it is possible to provide an optional second argument a string 130 which then will be used instead of 'polytope' in the name of the 130 which then will be used instead of 'polytope' in the name of the 131 131 polymake output file 132 132 EXAMPLE: example polymakePolytope; shows an example" … … 200 200 } 201 201 } 202 } 202 } 203 203 newveg=newveg[1,size(newveg)-1]; 204 204 execute("list nveg="+newveg+";"); … … 235 235 "EXAMPLE:"; 236 236 echo=2; 237 // the lattice points of the unit square in the plane 237 // the lattice points of the unit square in the plane 238 238 list points=intvec(0,0),intvec(0,1),intvec(1,0),intvec(1,1); 239 239 // the secondary polytope of this lattice point configuration is computed … … 261 261 of the Newton polytope of f 262 262 @* L[2] : the dimension of the Newton polytope of f 263 @* L[3] : a list whose ith entry explains to which vertices the 264 ith vertex of the Newton polytope is connected 265 -- i.e. L[3][i] is an integer vector and an entry k in 263 @* L[3] : a list whose ith entry explains to which vertices the 264 ith vertex of the Newton polytope is connected 265 -- i.e. L[3][i] is an integer vector and an entry k in 266 266 there means that the vertex L[1][i] is 267 267 connected to the vertex L[1][k] 268 @* L[4] : an integer matrix whose rows mulitplied by 269 (1,var(1),...,var(nvar)) give a linear system of equations 268 @* L[4] : an integer matrix whose rows mulitplied by 269 (1,var(1),...,var(nvar)) give a linear system of equations 270 270 describing the affine hull of the Newton polytope, i.e. the 271 271 smallest affine space containing the Newton polytope 272 NOTE: - if we replace the first column of L[4] by zeros, i.e. if we move 273 the affine hull to the origin, then we get the equations for the 274 orthogonal comploment of the linearity space of the normal fan dual 272 NOTE: - if we replace the first column of L[4] by zeros, i.e. if we move 273 the affine hull to the origin, then we get the equations for the 274 orthogonal comploment of the linearity space of the normal fan dual 275 275 to the Newton polytope, i.e. we get the EQUATIONS that 276 276 we need as input for polymake when computing the normal fan … … 278 278 TU Berlin and Michael Joswig, so it only works if polymake is installed; 279 279 see http://www.math.tu-berlin.de/polymake/ 280 @* - the procedure creates the file /tmp/newtonPolytope.polymake which 281 contains the polytope in polymake format and which can be used for 280 @* - the procedure creates the file /tmp/newtonPolytope.polymake which 281 contains the polytope in polymake format and which can be used for 282 282 further computations with polymake 283 @* - moreover, the procedure creates the file /tmp/newtonPolytope.output 283 @* - moreover, the procedure creates the file /tmp/newtonPolytope.output 284 284 and deletes it again before ending 285 @* - it is possible to give as an optional second argument a string 286 which then will be used instead of 'newtonPolytope' in the name of 285 @* - it is possible to give as an optional second argument a string 286 which then will be used instead of 'newtonPolytope' in the name of 287 287 the polymake output file 288 288 EXAMPLE: example newtonPolytope; shows an example" 289 289 { 290 290 int i,j; 291 // compute the list of exponent vectors of the polynomial, 291 // compute the list of exponent vectors of the polynomial, 292 292 // which are the lattice points 293 293 // whose convex hull is the Newton polytope of f … … 320 320 np[2]; 321 321 // np[3] contains information how the vertices are connected to each other, 322 // e.g. the first vertex (number 0) is connected to the second, third and 322 // e.g. the first vertex (number 0) is connected to the second, third and 323 323 // fourth vertex 324 324 np[3][1]; … … 330 330 np[1]; 331 331 // its dimension is 332 np[2]; 333 // the Newton polytope is contained in the affine space given 332 np[2]; 333 // the Newton polytope is contained in the affine space given 334 334 // by the equations 335 335 np[4]*M; … … 340 340 proc newtonPolytopeLP (poly f) 341 341 "USAGE: newtonPolytopeLP(f); f poly 342 RETURN: list, the exponent vectors of the monomials occuring in f, 342 RETURN: list, the exponent vectors of the monomials occuring in f, 343 343 i.e. the lattice points of the Newton polytope of f 344 344 EXAMPLE: example normalFan; shows an example" … … 368 368 proc normalFan (intmat vertices,intmat affinehull,list graph,int er,list #) 369 369 "USAGE: normalFan (vert,aff,graph,rays,[,#]); vert,aff intmat, graph list, rays int, # string 370 ASSUME: - vert is an integer matrix whose rows are the coordinate of 371 the vertices of a convex lattice polytope; 370 ASSUME: - vert is an integer matrix whose rows are the coordinate of 371 the vertices of a convex lattice polytope; 372 372 @* - aff describes the affine hull of this polytope, i.e. 373 the smallest affine space containing it, in the following sense: 374 denote by n the number of columns of vert, then multiply aff by 375 (1,x(1),...,x(n)) and set the resulting terms to zero in order to 373 the smallest affine space containing it, in the following sense: 374 denote by n the number of columns of vert, then multiply aff by 375 (1,x(1),...,x(n)) and set the resulting terms to zero in order to 376 376 get the equations for the affine hull; 377 @* - the ith entry of graph is an integer vector describing to which 378 vertices the ith vertex is connected, i.e. a k as entry means that 377 @* - the ith entry of graph is an integer vector describing to which 378 vertices the ith vertex is connected, i.e. a k as entry means that 379 379 the vertex vert[i] is connected to vert[k]; 380 @* - the integer rays is either one (if the extreme rays should be 380 @* - the integer rays is either one (if the extreme rays should be 381 381 computed) or zero (otherwise) 382 RETURN: list, the ith entry of L[1] contains information about the cone in the 383 normal fan dual to the ith vertex of the polytope 384 @* L[1][i][1] = integer matrix representing the inequalities which 382 RETURN: list, the ith entry of L[1] contains information about the cone in the 383 normal fan dual to the ith vertex of the polytope 384 @* L[1][i][1] = integer matrix representing the inequalities which 385 385 describe the cone dual to the ith vertex 386 @* L[1][i][2] = a list which contains the inequalities represented 387 by L[i][1] as a list of strings, where we use the 386 @* L[1][i][2] = a list which contains the inequalities represented 387 by L[i][1] as a list of strings, where we use the 388 388 variables x(1),...,x(n) 389 389 @* L[1][i][3] = only present if 'er' is set to 1; in that case it is 390 an interger matrix whose rows are the extreme rays 390 an interger matrix whose rows are the extreme rays 391 391 of the cone 392 @* L[2] = is an integer matrix whose rows span the linearity space 393 of the fan, i.e. the linear space which is contained in 392 @* L[2] = is an integer matrix whose rows span the linearity space 393 of the fan, i.e. the linear space which is contained in 394 394 each cone 395 395 NOTE: - the procedure calls for its computation polymake by Ewgenij Gawrilow, 396 TU Berlin and Michael Joswig, so it only works if polymake is 396 TU Berlin and Michael Joswig, so it only works if polymake is 397 397 installed; 398 398 see http://www.math.tu-berlin.de/polymake/ 399 @* - in the optional argument # it is possible to hand over other names 399 @* - in the optional argument # it is possible to hand over other names 400 400 for the variables to be used -- be careful, the format must be correct 401 401 which is not tested, e.g. if you want the variable names to be … … 405 405 list ineq; // stores the inequalities of the cones 406 406 int i,j,k; 407 // we work over the following ring 407 // we work over the following ring 408 408 execute("ring ineqring=0,x(1.."+string(ncols(vertices))+"),lp;"); 409 409 string greatersign=">"; … … 430 430 for (i=1;i<=nrows(vertices);i++) 431 431 { 432 // first we produce for each vertex in the polytope 432 // first we produce for each vertex in the polytope 433 433 // the inequalities describing the dual cone in the normal fan 434 list pp; // contain strings representing the inequalities 434 list pp; // contain strings representing the inequalities 435 435 // describing the normal cone 436 intmat ie[size(graph[i])][ncols(vertices)]; // contains the inequalities 436 intmat ie[size(graph[i])][ncols(vertices)]; // contains the inequalities 437 437 // as rows 438 // consider all the vertices to which the ith vertex in the 438 // consider all the vertices to which the ith vertex in the 439 439 // polytope is connected by an edge 440 440 for (j=1;j<=size(graph[i]);j++) 441 441 { 442 442 // produce the vector ie_j pointing from the jth vertex to the ith vertex; 443 // this will be the jth inequality for the cone in the normal fan dual to 443 // this will be the jth inequality for the cone in the normal fan dual to 444 444 // the ith vertex 445 445 ie[j,1..ncols(vertices)]=vertices[i,1..ncols(vertices)]-vertices[graph[i][j],1..ncols(vertices)]; … … 448 448 p=(VAR*EXP)[1,1]; 449 449 pl,pr=0,0; 450 // separate the terms with positive coefficients in p from 450 // separate the terms with positive coefficients in p from 451 451 // those with negative coefficients 452 452 for (k=1;k<=size(p);k++) … … 461 461 } 462 462 } 463 // build the string which represents the jth inequality 463 // build the string which represents the jth inequality 464 464 // for the cone dual to the ith vertex 465 // as polynomial inequality of type string, and store this 465 // as polynomial inequality of type string, and store this 466 466 // in the list pp as jth entry 467 467 pp[j]=string(pl)+" "+greatersign+" "+string(pr); … … 496 496 // create the file ineq.output 497 497 write(":w /tmp/ineq.output",""); 498 int dimension; // keeps the dimension of the intersection the 498 int dimension; // keeps the dimension of the intersection the 499 499 // bad cones with the u11tobeseencone 500 500 for (i=1;i<=size(ineq);i++) 501 501 { 502 i,". Cone of ",nrows(vertices); // indicate how many 502 i,". Cone of ",nrows(vertices); // indicate how many 503 503 // vertices have been dealt with 504 504 ungleichungen=intmatToPolymake(ineq[i][1],"rays"); … … 525 525 } 526 526 // get the linearity space 527 return(list(ineq,linearity)); 527 return(list(ineq,linearity)); 528 528 } 529 529 example … … 554 554 proc groebnerFan (poly f,list #) 555 555 "USAGE: groebnerFan(f[,#]); f poly, # string 556 RETURN: list, the ith entry of L[1] contains information about the ith cone 557 in the Groebner fan dual to the ith vertex in the Newton 556 RETURN: list, the ith entry of L[1] contains information about the ith cone 557 in the Groebner fan dual to the ith vertex in the Newton 558 558 polytope of the f 559 @* L[1][i][1] = integer matrix representing the inequalities 560 which describe the cone 561 @* L[1][i][2] = a list which contains the inequalities represented 559 @* L[1][i][1] = integer matrix representing the inequalities 560 which describe the cone 561 @* L[1][i][2] = a list which contains the inequalities represented 562 562 by L[1][i][1] as a list of strings 563 @* L[1][i][3] = an interger matrix whose rows are the extreme rays 563 @* L[1][i][3] = an interger matrix whose rows are the extreme rays 564 564 of the cone 565 @* L[2] = is an integer matrix whose rows span the linearity space 566 of the fan, i.e. the linear space which is contained 567 in each cone 568 @* L[3] = the Newton polytope of f in the format of the procedure 565 @* L[2] = is an integer matrix whose rows span the linearity space 566 of the fan, i.e. the linear space which is contained 567 in each cone 568 @* L[3] = the Newton polytope of f in the format of the procedure 569 569 newtonPolytope 570 @* L[4] = integer matrix where each row represents the exponet 570 @* L[4] = integer matrix where each row represents the exponet 571 571 vector of one monomial occuring in the input polynomial 572 572 NOTE: - if you have already computed the Newton polytope of f then you might want 573 to use the procedure normalFan instead in order to avoid doing costly 573 to use the procedure normalFan instead in order to avoid doing costly 574 574 computation twice 575 575 @* - the procedure calls for its computation polymake by Ewgenij Gawrilow, 576 576 TU Berlin and Michael Joswig, so it only works if polymake is installed; 577 577 see http://www.math.tu-berlin.de/polymake/ 578 @* - the procedure creates the file /tmp/newtonPolytope.polymake which 579 contains the Newton polytope of f in polymake format and which can 578 @* - the procedure creates the file /tmp/newtonPolytope.polymake which 579 contains the Newton polytope of f in polymake format and which can 580 580 be used for further computations with polymake 581 @* - it is possible to give as an optional second argument as string which 582 then will be used instead of 'newtonPolytope' in the name of the 581 @* - it is possible to give as an optional second argument as string which 582 then will be used instead of 'newtonPolytope' in the name of the 583 583 polymake output file 584 584 EXAMPLE: example groebnerFan; shows an example" 585 585 { 586 586 int i,j; 587 // compute the list of exponent vectors of the polynomial, which are 587 // compute the list of exponent vectors of the polynomial, which are 588 588 // the lattice points whose convex hull is the Newton polytope of f 589 589 intmat exponents[size(f)][nvars(basering)]; … … 649 649 proc intmatToPolymake (intmat M,string art) 650 650 "USAGE: intmatToPolymake(M,art); M intmat, art string 651 ASSUME: - M is an integer matrix which should be transformed into polymake 651 ASSUME: - M is an integer matrix which should be transformed into polymake 652 652 format; 653 653 @* - art is one of the following strings: 654 654 @* + 'rays' : indicating that a first column of 0's should be added 655 @* + 'points' : indicating that a first column of 1's should be added 656 RETURN: string, the matrix is transformed in a string and a first column has 655 @* + 'points' : indicating that a first column of 1's should be added 656 RETURN: string, the matrix is transformed in a string and a first column has 657 657 been added 658 658 EXAMPLE: example intmatToPolymake; shows an example" … … 662 662 string anf="0 "; 663 663 } 664 else 664 else 665 665 { 666 666 string anf="1 "; … … 697 697 proc polymakeToIntmat (string pm,string art) 698 698 "USAGE: polymakeToIntmat(pm,art); pm, art string 699 ASSUME: pm is the result of calling polymake with one 'argument' like 700 VERTICES, AFFINE_HULL, etc., so that the first row of the string is 701 the name of the corresponding 'argument' and the further rows contain 699 ASSUME: pm is the result of calling polymake with one 'argument' like 700 VERTICES, AFFINE_HULL, etc., so that the first row of the string is 701 the name of the corresponding 'argument' and the further rows contain 702 702 the result which consists of vectors either over the integers 703 703 or over the rationals … … 705 705 from the second row, where each row has been multiplied with the 706 706 lowest common multiple of the denominators of its entries as if 707 it is an integer matrix; moreover, if art=='affine', then 708 the first column is omitted since we only want affine 707 it is an integer matrix; moreover, if art=='affine', then 708 the first column is omitted since we only want affine 709 709 coordinates 710 710 EXAMPLE: example polymakeToIntmat; shows an example" … … 718 718 pm=stringdelete(pm,1); 719 719 } 720 pm=stringdelete(pm,1); 721 // find out how many entries each vector has, namely one more 720 pm=stringdelete(pm,1); 721 // find out how many entries each vector has, namely one more 722 722 // than 'spaces' in a row 723 723 int i=1; … … 734 734 // if we want to have affine coordinates 735 735 if (art=="affine") 736 { 736 { 737 737 s--; // then there is one column less 738 738 // and the entry of the first column (in the first row) has to be removed … … 743 743 pm=stringdelete(pm,1); 744 744 } 745 // we add two line breaks at the end in order to have this as 745 // we add two line breaks at the end in order to have this as 746 746 // a stopping criterion 747 747 pm=pm+zeilenumbruch+zeilenumbruch; … … 761 761 z++; 762 762 pm[i]=","; 763 // if we want to have affine coordinates, 763 // if we want to have affine coordinates, 764 764 // then we have to delete the first entry in each row 765 765 if (art=="affine") … … 775 775 if (pm[i]==" ") 776 776 { 777 pm[i]=","; 777 pm[i]=","; 778 778 } 779 779 } … … 784 784 pm=stringdelete(pm,size(pm)); 785 785 } 786 // since the matrix could be over the rationals, 786 // since the matrix could be over the rationals, 787 787 // we need a ring with rational coefficients 788 ring zwischering=0,x,lp; 788 ring zwischering=0,x,lp; 789 789 // create the matrix with the elements of pm as entries 790 790 execute("matrix mm["+string(z)+"]["+string(s)+"]="+pm+";"); … … 835 835 proc triangulations (list polygon) 836 836 "USAGE: triangulations(polygon); list polygon 837 ASSUME: polygon is a list of integer vectors of the same size representing 838 the affine coordinates of the lattice points 837 ASSUME: polygon is a list of integer vectors of the same size representing 838 the affine coordinates of the lattice points 839 839 PURPOSE: the procedure considers the marked polytope given as the convex hull of 840 840 the lattice points and with these lattice points as markings; it then 841 computes all possible triangulations of this marked polytope 841 computes all possible triangulations of this marked polytope 842 842 RETURN: list, each entry corresponds to one triangulation and the ith entry is 843 843 itself a list of integer vectors of size three, where each integer … … 846 846 NOTE:- the procedure calls for its computations the program points2triangs 847 847 from the program topcom by Joerg Rambau, Universitaet Bayreuth; it 848 therefore is necessary that this program is installed in order to use 848 therefore is necessary that this program is installed in order to use 849 849 this procedure; see 850 850 @* http://www.uni-bayreuth.de/departments/wirtschaftsmathematik/rambau/TOPCOM 851 @* - the procedure creates the files /tmp/triangulationsinput and 851 @* - the procedure creates the files /tmp/triangulationsinput and 852 852 /tmp/triangulationsoutput; 853 the former is used as input for points2triangs and the latter is its 854 output containing the triangulations of corresponding to points in the 855 format of points2triangs; if you wish to use this for further 856 computations with topcom, you have to use the procedure 853 the former is used as input for points2triangs and the latter is its 854 output containing the triangulations of corresponding to points in the 855 format of points2triangs; if you wish to use this for further 856 computations with topcom, you have to use the procedure 857 857 polymakeKeepTmpFiles in before 858 @* - note that an integer i in an integer vector representing a triangle 859 refers to the ith lattice point, i.e. polygon[i]; this convention is 860 different from TOPCOM's convention, where i would refer to the i-1st 858 @* - note that an integer i in an integer vector representing a triangle 859 refers to the ith lattice point, i.e. polygon[i]; this convention is 860 different from TOPCOM's convention, where i would refer to the i-1st 861 861 lattice point 862 862 EXAMPLE: example triangulations; shows an example" 863 863 { 864 864 int i,j; 865 // prepare the input for points2triangs by writing the input polygon in the 865 // prepare the input for points2triangs by writing the input polygon in the 866 866 // necessary format 867 867 string spi="["; … … 885 885 system("sh","cd /tmp; rm -f triangulationsinput; rm -f triangulationsoutput"); 886 886 } 887 // preprocessing of p2t if points2triangs is version >= 0.15 887 // preprocessing of p2t if points2triangs is version >= 0.15 888 888 // brings p2t to the format of version 0.14 889 889 string np2t; // takes the triangulations in Singular format … … 907 907 } 908 908 else 909 { 909 { 910 910 np2t=np2t+p2t[i]; 911 911 } … … 919 919 { 920 920 if (np2t[size(np2t)]!=";") 921 { 921 { 922 922 np2t=np2t+p2t[size(p2t)-1]+p2t[size(p2t)]; 923 923 } … … 941 941 np2t=np2t+"))"; 942 942 i++; 943 } 943 } 944 944 else 945 945 { … … 979 979 "EXAMPLE:"; 980 980 echo=2; 981 // the lattice points of the unit square in the plane 981 // the lattice points of the unit square in the plane 982 982 list polygon=intvec(0,0),intvec(0,1),intvec(1,0),intvec(1,1); 983 983 // the triangulations of this lattice point configuration are computed … … 1025 1025 int i,j,k,l; 1026 1026 intmat N[2][2]; // is used to compute areas of triangles 1027 intvec vertex; // stores a point in the secondary polytope as 1027 intvec vertex; // stores a point in the secondary polytope as 1028 1028 // intermediate result 1029 1029 int eintrag; 1030 1030 int halt; 1031 intmat secpoly[size(triangs)][size(polygon)]; // stores all lattice points 1031 intmat secpoly[size(triangs)][size(polygon)]; // stores all lattice points 1032 1032 // of the secondary polytope 1033 // consider each triangulation and compute the corresponding point 1033 // consider each triangulation and compute the corresponding point 1034 1034 // in the secondary polytope 1035 1035 for (i=1;i<=size(triangs);i++) 1036 1036 { 1037 // for each triangulation we have to compute the coordinates 1037 // for each triangulation we have to compute the coordinates 1038 1038 // corresponding to each marked point 1039 1039 for (j=1;j<=size(polygon);j++) 1040 1040 { 1041 1041 eintrag=0; 1042 // for each marked point we have to consider all triangles in the 1042 // for each marked point we have to consider all triangles in the 1043 1043 // triangulation which involve this particular point 1044 1044 for (k=1;k<=size(triangs[i]);k++) … … 1062 1062 secpoly[i,1..size(polygon)]=vertex; 1063 1063 } 1064 return(list(secpoly,triangs)); 1064 return(list(secpoly,triangs)); 1065 1065 } 1066 1066 example … … 1084 1084 proc secondaryFan (list polygon,list #) 1085 1085 "USAGE: secondaryFan(polygon[,#]); list polygon, list # 1086 ASSUME: - polygon is a list of integer vectors of the same size representing 1086 ASSUME: - polygon is a list of integer vectors of the same size representing 1087 1087 the affine coordinates of lattice points 1088 @* - if the triangulations of the corresponding polygon have already been 1089 computed with the procedure triangulations then these can be given 1090 as a second (optional) argument in order to avoid doing this 1088 @* - if the triangulations of the corresponding polygon have already been 1089 computed with the procedure triangulations then these can be given 1090 as a second (optional) argument in order to avoid doing this 1091 1091 computation again 1092 1092 PURPOSE: the procedure considers the marked polytope given as the convex hull of 1093 1093 the lattice points and with these lattice points as markings; it then 1094 computes the lattice points of the secondary polytope given by this 1094 computes the lattice points of the secondary polytope given by this 1095 1095 marked polytope which correspond to the triangulations computed by 1096 1096 the procedure triangulations 1097 RETURN: list, the ith entry of L[1] contains information about the ith cone in 1098 the secondary fan of the polygon, i.e. the cone dual to the 1097 RETURN: list, the ith entry of L[1] contains information about the ith cone in 1098 the secondary fan of the polygon, i.e. the cone dual to the 1099 1099 ith vertex of the secondary polytope 1100 @* L[1][i][1] = integer matrix representing the inequalities which 1100 @* L[1][i][1] = integer matrix representing the inequalities which 1101 1101 describe the cone dual to the ith vertex 1102 @* L[1][i][2] = a list which contains the inequalities represented 1102 @* L[1][i][2] = a list which contains the inequalities represented 1103 1103 by L[1][i][1] as a list of strings, where we use the 1104 1104 variables x(1),...,x(n) 1105 1105 @* L[1][i][3] = only present if 'er' is set to 1; in that case it is 1106 an interger matrix whose rows are the extreme rays 1106 an interger matrix whose rows are the extreme rays 1107 1107 of the cone 1108 @* L[2] = is an integer matrix whose rows span the linearity space 1109 of the fan, i.e. the linear space which is contained in 1108 @* L[2] = is an integer matrix whose rows span the linearity space 1109 of the fan, i.e. the linear space which is contained in 1110 1110 each cone 1111 @* L[3] = the secondary polytope in the format of the procedure 1111 @* L[3] = the secondary polytope in the format of the procedure 1112 1112 polymakePolytope 1113 @* L[4] = the list of triangulations corresponding to the vertices 1113 @* L[4] = the list of triangulations corresponding to the vertices 1114 1114 of the secondary polytope 1115 1115 NOTE:- the procedure calls for its computation polymake by Ewgenij Gawrilow, 1116 1116 TU Berlin and Michael Joswig, so it only works if polymake is installed; 1117 1117 see http://www.math.tu-berlin.de/polymake/ 1118 @* - in the optional argument # it is possible to hand over other names for 1118 @* - in the optional argument # it is possible to hand over other names for 1119 1119 the variables to be used -- be careful, the format must be correct 1120 1120 which is not tested, e.g. if you want the variable names to be 1121 1121 u00,u10,u01,u11 then you must hand over the string 'u11,u10,u01,u11' 1122 @* - if the triangluations are not handed over as optional argument the 1123 procedure calls for its computation of these triangulations the program 1124 points2triangs from the program topcom by Joerg Rambau, Universitaet 1125 Bayreuth; it therefore is necessary that this program is installed in 1122 @* - if the triangluations are not handed over as optional argument the 1123 procedure calls for its computation of these triangulations the program 1124 points2triangs from the program topcom by Joerg Rambau, Universitaet 1125 Bayreuth; it therefore is necessary that this program is installed in 1126 1126 order to use this procedure; see 1127 1127 @* http://www.uni-bayreuth.de/departments/wirtschaftsmathematik/rambau/TOPCOM … … 1172 1172 proc cycleLength (list boundary,intvec interior) 1173 1173 "USAGE: cycleLength(boundary,interior); list boundary, intvec interior 1174 ASSUME: boundary is a list of integer vectors describing a cycle in some 1175 convex lattice polygon around the lattice point interior ordered 1174 ASSUME: boundary is a list of integer vectors describing a cycle in some 1175 convex lattice polygon around the lattice point interior ordered 1176 1176 clock wise 1177 1177 RETURN: string, the cycle length of the corresponding cycle in the dual … … 1180 1180 { 1181 1181 int j; 1182 // create a ring whose variables are indexed by the points in 1182 // create a ring whose variables are indexed by the points in 1183 1183 // boundary resp. by interior 1184 1184 string rst="ring cyclering=0,(u"+string(interior[1])+string(interior[2]); … … 1218 1218 // interior is a lattice point in the interior of this lattice polygon 1219 1219 intvec interior=1,1; 1220 // compute the general cycle length of a cycle of the corresponding cycle 1220 // compute the general cycle length of a cycle of the corresponding cycle 1221 1221 // in the dual tropical curve, note that (0,1) and (2,1) do not contribute 1222 1222 cycleLength(boundary,interior); … … 1227 1227 proc splitPolygon (list markings) 1228 1228 "USAGE: splitPolygon (markings); markings list 1229 ASSUME: markings is a list of integer vectors representing lattice points in 1230 the plane which we consider as the marked points of the convex lattice 1229 ASSUME: markings is a list of integer vectors representing lattice points in 1230 the plane which we consider as the marked points of the convex lattice 1231 1231 polytope spanned by them 1232 PURPOSE: split the marked points in the vertices, the points on the facets 1232 PURPOSE: split the marked points in the vertices, the points on the facets 1233 1233 which are not vertices, and the interior points 1234 1234 RETURN: list, L consisting of three lists … … 1236 1236 @* L[1][i][1] = intvec, the coordinates of the ith vertex 1237 1237 @* L[1][i][2] = int, the position of L[1][i][1] in markings 1238 @* L[2][i] : represents the lattice points on the facet of the 1239 polygon with endpoints L[1][i] and L[1][i+1] 1238 @* L[2][i] : represents the lattice points on the facet of the 1239 polygon with endpoints L[1][i] and L[1][i+1] 1240 1240 (i considered modulo size(L[1])) 1241 @* L[2][i][j][1] = intvec, the coordinates of the jth 1241 @* L[2][i][j][1] = intvec, the coordinates of the jth 1242 1242 lattice point on that facet 1243 @* L[2][i][j][2] = int, the position of L[2][i][j][1] 1243 @* L[2][i][j][2] = int, the position of L[2][i][j][1] 1244 1244 in markings 1245 @* L[3] : represents the interior lattice points of the polygon 1245 @* L[3] : represents the interior lattice points of the polygon 1246 1246 @* L[3][i][1] = intvec, coordinates of ith interior point 1247 1247 @* L[3][i][2] = int, the position of L[3][i][1] in markings … … 1254 1254 vert[1]=pb[2]; 1255 1255 int i,j,k; // indices 1256 list boundary; // stores the points on the facets of the 1256 list boundary; // stores the points on the facets of the 1257 1257 // polygon which are not vertices 1258 // append to the boundary points as well as to the vertices 1258 // append to the boundary points as well as to the vertices 1259 1259 // the first vertex a second time 1260 1260 pb[1]=pb[1]+list(pb[1][1]); … … 1281 1281 // store the information on the boundary in vert[2] 1282 1282 vert[2]=boundary; 1283 // find the remaining points in the input which are not on 1283 // find the remaining points in the input which are not on 1284 1284 // the boundary by checking 1285 1285 // for each point in markings if it is contained in pb[1] … … 1298 1298 // store the interior points in vert[3] 1299 1299 vert[3]=interior; 1300 // add to each point in vert the index which it gets from 1300 // add to each point in vert the index which it gets from 1301 1301 // its position in the input markings; 1302 1302 // do so for ver[1] … … 1332 1332 } 1333 1333 vert[3][i]=list(vert[3][i],j); 1334 } 1334 } 1335 1335 return(vert); 1336 1336 } … … 1339 1339 "EXAMPLE:"; 1340 1340 echo=2; 1341 // the lattice polygon spanned by the points (0,0), (3,0) and (0,3) 1341 // the lattice polygon spanned by the points (0,0), (3,0) and (0,3) 1342 1342 // with all integer points as markings 1343 1343 list polygon=intvec(1,1),intvec(3,0),intvec(2,0),intvec(1,0), … … 1359 1359 proc eta (list triang,list polygon) 1360 1360 "USAGE: eta(triang,polygon); triang, polygon list 1361 ASSUME: polygon has the format of the output of splitPolygon, i.e. it is a 1362 list with three entries describing a convex lattice polygon in the 1361 ASSUME: polygon has the format of the output of splitPolygon, i.e. it is a 1362 list with three entries describing a convex lattice polygon in the 1363 1363 following way: 1364 @* polygon[1] : is a list of lists; for each i the entry polygon[1][i][1] 1365 is a lattice point which is a vertex of the lattice 1364 @* polygon[1] : is a list of lists; for each i the entry polygon[1][i][1] 1365 is a lattice point which is a vertex of the lattice 1366 1366 polygon, and polygon[1][i][2] is an integer assigned to 1367 1367 this lattice point as identifying index 1368 @* polygon[2] : is a list of lists; for each vertex of the polygon, 1369 i.e. for each entry in polygon[1], it contains a list 1370 polygon[2][i], which contains the lattice points on the 1371 facet with endpoints polygon[1][i] and polygon[1][i+1] 1368 @* polygon[2] : is a list of lists; for each vertex of the polygon, 1369 i.e. for each entry in polygon[1], it contains a list 1370 polygon[2][i], which contains the lattice points on the 1371 facet with endpoints polygon[1][i] and polygon[1][i+1] 1372 1372 - i considered mod size(polygon[1]); 1373 each such lattice point contributes an entry 1373 each such lattice point contributes an entry 1374 1374 polygon[2][i][j][1] which is an integer 1375 vector giving the coordinate of the lattice point and an 1375 vector giving the coordinate of the lattice point and an 1376 1376 entry polygon[2][i][j][2] which is the identifying index 1377 @* polygon[3] : is a list of lists, where each entry corresponds to a 1378 lattice point in the interior of the polygon, with 1377 @* polygon[3] : is a list of lists, where each entry corresponds to a 1378 lattice point in the interior of the polygon, with 1379 1379 polygon[3][j][1] being the coordinates of the point 1380 1380 and polygon[3][j][2] being the identifying index; 1381 @* triang is a list of integer vectors all of size three describing a 1382 triangulation of the polygon described by polygon; if an entry of 1381 @* triang is a list of integer vectors all of size three describing a 1382 triangulation of the polygon described by polygon; if an entry of 1383 1383 triang is the vector (i,j,k) then the triangle is built from the vertices 1384 1384 with indices i, j and k 1385 RETURN: intvec, the integer vector eta describing that vertex of the Newton 1386 polytope discriminant of the polygone whose dual cone in the 1387 Groebner fan contains the cone of the secondary fan of the 1385 RETURN: intvec, the integer vector eta describing that vertex of the Newton 1386 polytope discriminant of the polygone whose dual cone in the 1387 Groebner fan contains the cone of the secondary fan of the 1388 1388 polygon corresponding to the given triangulation 1389 NOTE: for a better description of eta see Gelfand, Kapranov, 1389 NOTE: for a better description of eta see Gelfand, Kapranov, 1390 1390 Zelevinski: Discriminants, Resultants and multidimensional Determinants. 1391 1391 Chapter 10. … … 1393 1393 { 1394 1394 int i,j,k,l,m,n; // index variables 1395 list ordpolygon; // stores the lattice points in the order 1395 list ordpolygon; // stores the lattice points in the order 1396 1396 // used in the triangulation 1397 1397 list triangarea; // stores the areas of the triangulations … … 1419 1419 for (i=1;i<=size(triang);i++) 1420 1420 { 1421 // Note that the ith lattice point in orderedpolygon has the 1421 // Note that the ith lattice point in orderedpolygon has the 1422 1422 // number i-1 in the triangulation! 1423 1423 N=ordpolygon[triang[i][1]]-ordpolygon[triang[i][2]],ordpolygon[triang[i][1]]-ordpolygon[triang[i][3]]; … … 1425 1425 } 1426 1426 intvec ETA; // stores the eta_ij 1427 int etaij; // stores the part of eta_ij during computations 1427 int etaij; // stores the part of eta_ij during computations 1428 1428 // which comes from triangle areas 1429 int seitenlaenge; // stores the part of eta_ij during computations 1429 int seitenlaenge; // stores the part of eta_ij during computations 1430 1430 // which comes from boundary facets 1431 1431 list seiten; // stores the lattice points on facets of the polygon 1432 1432 intvec v; // used to compute a facet length 1433 // 3) store first in seiten[i] all lattice points on the facet 1433 // 3) store first in seiten[i] all lattice points on the facet 1434 1434 // connecting the ith vertex, 1435 // i.e. polygon[1][i], with the i+1st vertex, i.e. polygon[1][i+1], 1435 // i.e. polygon[1][i], with the i+1st vertex, i.e. polygon[1][i+1], 1436 1436 // where we replace i+1 1437 1437 // 1 if i=size(polygon[1]); 1438 // then append the last entry of seiten once more at the very 1438 // then append the last entry of seiten once more at the very 1439 1439 // beginning of seiten, so 1440 1440 // that the index is shifted by one … … 1462 1462 if ((polygon[1][j][2]==triang[k][1]) or (polygon[1][j][2]==triang[k][2]) or (polygon[1][j][2]==triang[k][3])) 1463 1463 { 1464 // ... if so, add the area of the triangle to etaij 1464 // ... if so, add the area of the triangle to etaij 1465 1465 etaij=etaij+triangarea[k]; 1466 // then check if that triangle has a facet which is contained 1467 // in one of the 1466 // then check if that triangle has a facet which is contained 1467 // in one of the 1468 1468 // two facets of the polygon which are adjecent to the given vertex ... 1469 1469 // these two facets are seiten[j] and seiten[j+1] … … 1479 1479 if ((seiten[n][l][2]==triang[k][m]) and (seiten[n][l][2]!=polygon[1][j][2])) 1480 1480 { 1481 // if so, then compute the vector pointing from this 1481 // if so, then compute the vector pointing from this 1482 1482 // lattice point to the vertex 1483 1483 v=polygon[1][j][1]-seiten[n][l][1]; 1484 // and the lattice length of this vector has to be 1484 // and the lattice length of this vector has to be 1485 1485 // subtracted from etaij 1486 1486 etaij=etaij-abs(gcd(v[1],v[2])); … … 1494 1494 ETA[polygon[1][j][2]]=etaij; 1495 1495 } 1496 // 5) compute the eta_ij for all lattice points on the facets 1496 // 5) compute the eta_ij for all lattice points on the facets 1497 1497 // of the polygon which are not vertices, these are the 1498 1498 // lattice points in polygon[2][1] to polygon[2][size(polygon[1])] … … 1500 1500 { 1501 1501 for (j=1;j<=size(polygon[2][i]);j++) 1502 { 1502 { 1503 1503 // initialise etaij 1504 1504 etaij=0; … … 1511 1511 if ((polygon[2][i][j][2]==triang[k][1]) or (polygon[2][i][j][2]==triang[k][2]) or (polygon[2][i][j][2]==triang[k][3])) 1512 1512 { 1513 // ... if so, add the area of the triangle to etaij 1513 // ... if so, add the area of the triangle to etaij 1514 1514 etaij=etaij+triangarea[k]; 1515 // then check if that triangle has a facet which is contained in the 1515 // then check if that triangle has a facet which is contained in the 1516 1516 // facet of the polygon which contains the lattice point in question, 1517 1517 // this is the facet seiten[i+1]; … … 1521 1521 // ... and for each lattice point in the triangle ... 1522 1522 for (m=1;m<=size(triang[k]);m++) 1523 { 1523 { 1524 1524 // ... if they coincide and are not the vertex itself ... 1525 1525 if ((seiten[i+1][l][2]==triang[k][m]) and (seiten[i+1][l][2]!=polygon[2][i][j][2])) 1526 1526 { 1527 // if so, then compute the vector pointing from 1527 // if so, then compute the vector pointing from 1528 1528 // this lattice point to the vertex 1529 1529 v=polygon[2][i][j][1]-seiten[i+1][l][1]; 1530 // and the lattice length of this vector contributes 1530 // and the lattice length of this vector contributes 1531 1531 // to seitenlaenge 1532 1532 seitenlaenge=seitenlaenge+abs(gcd(v[1],v[2])); … … 1536 1536 } 1537 1537 } 1538 // if the lattice point was a vertex of any triangle 1538 // if the lattice point was a vertex of any triangle 1539 1539 // in the triangulation ... 1540 1540 if (etaij!=0) … … 1561 1561 if ((polygon[3][j][2]==triang[k][1]) or (polygon[3][j][2]==triang[k][2]) or (polygon[3][j][2]==triang[k][3])) 1562 1562 { 1563 // ... if so, add the area of the triangle to etaij 1563 // ... if so, add the area of the triangle to etaij 1564 1564 etaij=etaij+triangarea[k]; 1565 1565 } … … 1574 1574 "EXAMPLE:"; 1575 1575 echo=2; 1576 // the lattice polygon spanned by the points (0,0), (3,0) and (0,3) 1576 // the lattice polygon spanned by the points (0,0), (3,0) and (0,3) 1577 1577 // with all integer points as markings 1578 1578 list polygon=intvec(1,1),intvec(3,0),intvec(2,0),intvec(1,0), … … 1581 1581 // split the polygon in its vertices, its facets and its interior points 1582 1582 list sp=splitPolygon(polygon); 1583 // define a triangulation by connecting the only interior point 1583 // define a triangulation by connecting the only interior point 1584 1584 // with the vertices 1585 1585 list triang=intvec(1,2,5),intvec(1,5,10),intvec(1,5,10); … … 1587 1587 eta(triang,sp); 1588 1588 } 1589 1589 1590 1590 ///////////////////////////////////////////////////////////////////////////// 1591 1591 … … 1614 1614 } 1615 1615 // check is the polygon is only a line segment given by more than two points; 1616 // for this first compute sum of the absolute values of the determinants 1616 // for this first compute sum of the absolute values of the determinants 1617 1617 // of the matrices whose 1618 // rows are the vectors pointing from the first to the second point 1618 // rows are the vectors pointing from the first to the second point 1619 1619 // and from the 1620 // the first point to the ith point for i=3,...,size(polygon); 1620 // the first point to the ith point for i=3,...,size(polygon); 1621 1621 // if this sum is zero 1622 1622 // then the polygon is a line segment and we have to find its end points … … 1631 1631 intmat laenge[size(polygon)][size(polygon)]; 1632 1632 intvec mp; 1633 // for this collect first all vectors pointing from one lattice 1633 // for this collect first all vectors pointing from one lattice 1634 1634 // point to the next, 1635 1635 // compute their pairwise angles and their lengths 1636 1636 for (i=1;i<=size(polygon)-1;i++) 1637 { 1637 { 1638 1638 for (j=i+1;j<=size(polygon);j++) 1639 1639 { … … 1659 1659 polygon=sortlistbyintvec(polygon,abstand); 1660 1660 return(list(polygon,endpoints)); 1661 } 1661 } 1662 1662 /////////////////////////////////////////////////////////////// 1663 1663 list orderedvertices; // stores the vertices in an ordered way 1664 list minimisedorderedvertices; // stores the vertices in an ordered way; 1664 list minimisedorderedvertices; // stores the vertices in an ordered way; 1665 1665 // redundant ones removed 1666 list comparevertices; // stores vertices which should be compared to 1666 list comparevertices; // stores vertices which should be compared to 1667 1667 // the testvertex 1668 1668 orderedvertices[1]=polygon[1]; // set the starting vertex 1669 1669 minimisedorderedvertices[1]=polygon[1]; // set the starting vertex 1670 1670 intvec testvertex=polygon[1]; //vertex to which the others have to be compared 1671 intvec startvertex=polygon[1]; // keep the starting vertex to test, 1671 intvec startvertex=polygon[1]; // keep the starting vertex to test, 1672 1672 // when the end is reached 1673 1673 int endtest; // is set to one, when the end is reached 1674 int startvertexfound;// is 1, once for some testvertex a candidate 1675 // for the next vertex has been found 1674 int startvertexfound;// is 1, once for some testvertex a candidate 1675 // for the next vertex has been found 1676 1676 polygon=delete(polygon,1); // delete the testvertex 1677 1677 intvec v,w; 1678 1678 int l=1; // counts the vertices 1679 // the basic idea is that a vertex can be 1679 // the basic idea is that a vertex can be 1680 1680 // the next one on the boundary if all other vertices 1681 // lie to the right of the vector v pointing 1681 // lie to the right of the vector v pointing 1682 1682 // from the testvertex to this one; this can be tested 1683 // by checking if the determinant of the 2x2-matrix 1683 // by checking if the determinant of the 2x2-matrix 1684 1684 // with first column v and second column the vector w, 1685 // pointing from the testvertex to the new vertex, 1685 // pointing from the testvertex to the new vertex, 1686 1686 // is non-positive; if this is the case for all 1687 // new vertices, then the one in consideration is 1687 // new vertices, then the one in consideration is 1688 1688 // a possible choice for the next vertex on the boundary 1689 // and it is stored in naechste; we can then order 1689 // and it is stored in naechste; we can then order 1690 1690 // the candidates according to their distance from 1691 1691 // the testvertex; then they occur on the boundary in that order! … … 1699 1699 v=polygon[i]-testvertex; // points from the testvertex to the ith vertex 1700 1700 comparevertices=delete(polygon,i); // we needn't compare v to itself 1701 // we should compare v to the startvertex-testvertex; 1701 // we should compare v to the startvertex-testvertex; 1702 1702 // in the first calling of the loop 1703 // this is irrelevant since the difference will be zero; 1703 // this is irrelevant since the difference will be zero; 1704 1704 // however, later on it will 1705 // be vital, since we delete the vertices 1705 // be vital, since we delete the vertices 1706 1706 // which we have already tested from the list 1707 // of all vertices, and when all vertices 1707 // of all vertices, and when all vertices 1708 1708 // on the boundary have been found we would 1709 // therefore find a vertex in the interior 1709 // therefore find a vertex in the interior 1710 1710 // as candidate; but always testing against 1711 1711 // the starting vertex, this cannot happen 1712 comparevertices[size(comparevertices)+1]=startvertex; 1712 comparevertices[size(comparevertices)+1]=startvertex; 1713 1713 for (j=1;(j<=size(comparevertices)) and (d<=0);j++) 1714 1714 { … … 1718 1718 d=det(D); 1719 1719 } 1720 if (d<=0) // if all determinants are non-positive, 1720 if (d<=0) // if all determinants are non-positive, 1721 1721 { // then the ith vertex is a candidate 1722 1722 naechste[k]=list(polygon[i],i,scalarproduct(v,v));// we store the vertex, … … 1726 1726 } 1727 1727 if (size(naechste)>0) // then a candidate for the next vertex has been found 1728 { 1728 { 1729 1729 startvertexfound=1; // at least once a candidate has been found 1730 naechste=sortlist(naechste,3); // we order the candidates according 1730 naechste=sortlist(naechste,3); // we order the candidates according 1731 1731 // to their distance from testvertex; 1732 for (j=1;j<=size(naechste);j++) // then we store them in this 1732 for (j=1;j<=size(naechste);j++) // then we store them in this 1733 1733 { // order in orderedvertices 1734 1734 l++; 1735 1735 orderedvertices[l]=naechste[j][1]; 1736 1736 } 1737 testvertex=naechste[size(naechste)][1]; // we store the last one as 1737 testvertex=naechste[size(naechste)][1]; // we store the last one as 1738 1738 // next testvertex; 1739 1739 // store the next corner of NSD 1740 minimisedorderedvertices[size(minimisedorderedvertices)+1]=testvertex; 1741 naechste=sortlist(naechste,2); // then we reorder the vertices 1740 minimisedorderedvertices[size(minimisedorderedvertices)+1]=testvertex; 1741 naechste=sortlist(naechste,2); // then we reorder the vertices 1742 1742 // according to their position 1743 1743 for (j=size(naechste);j>=1;j--) // and we delete them from the vertices … … 1746 1746 } 1747 1747 } 1748 else // that means either that the vertex was inside the polygon, 1749 { // or that we have reached the last vertex on the boundary 1748 else // that means either that the vertex was inside the polygon, 1749 { // or that we have reached the last vertex on the boundary 1750 1750 // of the polytope 1751 if (startvertexfound==0) // the vertex was in the interior; 1751 if (startvertexfound==0) // the vertex was in the interior; 1752 1752 { // we delete it and start all over again 1753 orderedvertices[1]=polygon[1]; 1754 minimisedorderedvertices[1]=polygon[1]; 1753 orderedvertices[1]=polygon[1]; 1754 minimisedorderedvertices[1]=polygon[1]; 1755 1755 testvertex=polygon[1]; 1756 1756 startvertex=polygon[1]; 1757 1757 polygon=delete(polygon,1); 1758 1758 } 1759 else // we have reached the last vertex on the boundary of 1759 else // we have reached the last vertex on the boundary of 1760 1760 { // the polytope and can stop 1761 1761 endtest=1; … … 1764 1764 kill naechste; 1765 1765 } 1766 // test if the first vertex in minimisedorderedvertices 1766 // test if the first vertex in minimisedorderedvertices 1767 1767 // is on the same line with the second and 1768 // the last, i.e. if we started our search in the 1768 // the last, i.e. if we started our search in the 1769 1769 // middle of a face; if so, delete it 1770 1770 v=minimisedorderedvertices[2]-minimisedorderedvertices[1]; … … 1775 1775 minimisedorderedvertices=delete(minimisedorderedvertices,1); 1776 1776 } 1777 // test if the first vertex in minimisedorderedvertices 1777 // test if the first vertex in minimisedorderedvertices 1778 1778 // is on the same line with the two 1779 // last ones, i.e. if we started our search at the end of a face; 1779 // last ones, i.e. if we started our search at the end of a face; 1780 1780 // if so, delete it 1781 1781 v=minimisedorderedvertices[size(minimisedorderedvertices)-1]-minimisedorderedvertices[1]; … … 1809 1809 proc cyclePoints (list triang,list points,int pt) 1810 1810 "USAGE: cyclePoints(triang,points,pt) triang,points list, pt int 1811 ASSUME: - points is a list of integer vectors describing the lattice 1811 ASSUME: - points is a list of integer vectors describing the lattice 1812 1812 points of a marked polygon; 1813 @* - triang is a list of integer vectors describing a triangulation 1814 of the marked polygon in the sense that an integer vector of 1815 the form (i,j,k) describes the triangle formed by polygon[i], 1813 @* - triang is a list of integer vectors describing a triangulation 1814 of the marked polygon in the sense that an integer vector of 1815 the form (i,j,k) describes the triangle formed by polygon[i], 1816 1816 polygon[j] and polygon[k]; 1817 @* - pt is an integer between 1 and size(points), singling out a 1817 @* - pt is an integer between 1 and size(points), singling out a 1818 1818 lattice point among the marked points 1819 PURPOSE: consider the convex lattice polygon, say P, spanned by all lattice 1820 points in points which in the triangulation triang are connected 1821 to the point points[pt]; the procedure computes all marked points 1819 PURPOSE: consider the convex lattice polygon, say P, spanned by all lattice 1820 points in points which in the triangulation triang are connected 1821 to the point points[pt]; the procedure computes all marked points 1822 1822 in points which lie on the boundary of that polygon, ordered 1823 1823 clockwise 1824 RETURN: list, of integer vectors which are the coordinates of the lattice 1825 points on the boundary of the above mentioned polygon P, if 1826 this polygon is not the empty set (that would be the case if 1827 points[pt] is not a vertex of any triangle in the 1824 RETURN: list, of integer vectors which are the coordinates of the lattice 1825 points on the boundary of the above mentioned polygon P, if 1826 this polygon is not the empty set (that would be the case if 1827 points[pt] is not a vertex of any triangle in the 1828 1828 triangulation); otherwise return the empty list 1829 1829 EXAMPLE: example cyclePoints; shows an example" 1830 1830 { 1831 1831 int i,j; // indices 1832 list v; // saves the indices of lattice points connected to the 1832 list v; // saves the indices of lattice points connected to the 1833 1833 // interior point in the triangulation 1834 1834 // save all points in triangulations containing pt in v … … 1866 1866 pts[i]=points[v[i]]; 1867 1867 } 1868 // consider the convex polytope spanned by the points in pts, 1868 // consider the convex polytope spanned by the points in pts, 1869 1869 // find the points on the 1870 1870 // boundary and order them clockwise … … 1875 1875 "EXAMPLE:"; 1876 1876 echo=2; 1877 // the lattice polygon spanned by the points (0,0), (3,0) and (0,3) 1877 // the lattice polygon spanned by the points (0,0), (3,0) and (0,3) 1878 1878 // with all integer points as markings 1879 1879 list points=intvec(1,1),intvec(3,0),intvec(2,0),intvec(1,0), 1880 1880 intvec(0,0),intvec(2,1),intvec(0,1),intvec(1,2), 1881 1881 intvec(0,2),intvec(0,3); 1882 // define a triangulation 1882 // define a triangulation 1883 1883 list triang=intvec(1,2,5),intvec(1,5,7),intvec(1,7,9),intvec(8,9,10), 1884 1884 intvec(1,8,9),intvec(1,2,8); … … 1892 1892 "USAGE: latticeArea(polygon); polygon list 1893 1893 ASSUME: polygon is a list of integer vectors in the plane 1894 RETURN: int, the lattice area of the convex hull of the lattice points in 1894 RETURN: int, the lattice area of the convex hull of the lattice points in 1895 1895 polygon, i.e. twice the Euclidean area 1896 1896 EXAMPLE: example polygonlatticeArea; shows an example" … … 1921 1921 proc picksFormula (list polygon) 1922 1922 "USAGE: picksFormula(polygon); polygon list 1923 ASSUME: polygon is a list of integer vectors in the plane and consider their 1924 convex hull C 1925 RETURN: list, L of three integersthe 1923 ASSUME: polygon is a list of integer vectors in the plane and consider their 1924 convex hull C 1925 RETURN: list, L of three integersthe 1926 1926 @* L[1] : the lattice area of C, i.e. twice the Euclidean area 1927 1927 @* L[2] : the number of lattice points on the boundary of C … … 1948 1948 bdpts=bdpts+abs(gcd(edge[1],edge[2])); 1949 1949 } 1950 // Pick's formula says that the lattice area A, the number g of interior 1950 // Pick's formula says that the lattice area A, the number g of interior 1951 1951 // points and 1952 1952 // the number b of boundary points are connected by the formula: A=b+2g-2 … … 1976 1976 "USAGE: ellipticNF(polygon); polygon list 1977 1977 ASSUME: polygon is a list of integer vectors in the plane such that their 1978 convex hull C has precisely one interior lattice point, i.e. C is the 1978 convex hull C has precisely one interior lattice point, i.e. C is the 1979 1979 Newton polygon of an elliptic curve 1980 PURPOSE: compute the normal form of the polygon with respect to the unimodular 1980 PURPOSE: compute the normal form of the polygon with respect to the unimodular 1981 1981 affine transformations T=A*x+v; there are sixteen different normal forms 1982 (see e.g. Bjorn Poonen, Fernando Rodriguez-Villegas: Lattice Polygons 1983 and the number 12. Amer. Math. Monthly 107 (2000), no. 3, 1982 (see e.g. Bjorn Poonen, Fernando Rodriguez-Villegas: Lattice Polygons 1983 and the number 12. Amer. Math. Monthly 107 (2000), no. 3, 1984 1984 238--250.) 1985 1985 RETURN: list, L such that 1986 @* L[1] : list whose entries are the vertices of the normal form of 1986 @* L[1] : list whose entries are the vertices of the normal form of 1987 1987 the polygon 1988 1988 @* L[2] : the matrix A of the unimodular transformation 1989 1989 @* L[3] : the translation vector v of the unimodular transformation 1990 @* L[4] : list such that the ith entry is the image of polygon[i] 1990 @* L[4] : list such that the ith entry is the image of polygon[i] 1991 1991 under the unimodular transformation T 1992 1992 EXAMPLE: example ellipticNF; shows an example" … … 2020 2020 intvec trans; // stores the vector by which we have to translate the polygon 2021 2021 intmat A[2][2]; // stores the matrix by which we have to transform the polygon 2022 matrix M[3][3]; // stores the projective coordinates of the points 2022 matrix M[3][3]; // stores the projective coordinates of the points 2023 2023 // which are to be transformed 2024 matrix N[3][3]; // stores the projective coordinates of the points to 2024 matrix N[3][3]; // stores the projective coordinates of the points to 2025 2025 // which M is to be transformed 2026 intmat T[3][3]; // stores the unimodular affine transformation in 2026 intmat T[3][3]; // stores the unimodular affine transformation in 2027 2027 // projective form 2028 2028 // add the second point of pg once again at the end 2029 2029 pg=insert(pg,pg[2],size(pg)); 2030 // if there is only one edge which has the maximal number of lattice points, 2030 // if there is only one edge which has the maximal number of lattice points, 2031 2031 // then M should be: 2032 2032 M=pg[max],1,pg[max+1],1,pg[max+2],1; … … 2118 2118 M=pg[max],1,pg[max+1],1,pg[max+2],1; 2119 2119 // the orientation of the polygon matters 2120 A=pg[max-1]-pg[max],pg[max+1]-pg[max]; 2120 A=pg[max-1]-pg[max],pg[max+1]-pg[max]; 2121 2121 if (det(A)==4) 2122 2122 { … … 2167 2167 { 2168 2168 max++; 2169 } 2169 } 2170 2170 M=pg[max],1,pg[max+1],1,pg[max+2],1; 2171 2171 N=0,1,1,1,2,1,2,1,1; … … 2230 2230 // the vertices of the normal form are 2231 2231 nf[1]; 2232 // it has been transformed by the unimodular affine transformation A*x+v 2232 // it has been transformed by the unimodular affine transformation A*x+v 2233 2233 // with matrix A 2234 2234 nf[2]; … … 2247 2247 "USAGE: ellipticNFDB(n[,#]); n int, # list 2248 2248 ASSUME: n is an integer between 1 and 16 2249 PURPOSE: this is a database storing the 16 normal forms of planar polygons with 2249 PURPOSE: this is a database storing the 16 normal forms of planar polygons with 2250 2250 precisely one interior point up to unimodular affine transformations 2251 @* (see e.g. Bjorn Poonen, Fernando Rodriguez-Villegas: Lattice Polygons 2251 @* (see e.g. Bjorn Poonen, Fernando Rodriguez-Villegas: Lattice Polygons 2252 2252 and the number 12. Amer. Math. Monthly 107 (2000), no. 3, 2253 2253 238--250.) 2254 2254 RETURN: list, L such that 2255 @* L[1] : list whose entries are the vertices of the nth normal form 2256 @* L[2] : list whose entries are all the lattice points of the 2257 nth normal form 2258 @* L[3] : only present if the optional parameter # is present, and 2259 then it is a polynomial in the variables (x,y) whose 2255 @* L[1] : list whose entries are the vertices of the nth normal form 2256 @* L[2] : list whose entries are all the lattice points of the 2257 nth normal form 2258 @* L[3] : only present if the optional parameter # is present, and 2259 then it is a polynomial in the variables (x,y) whose 2260 2260 Newton polygon is the nth normal form 2261 NOTE: the optional parameter is only allowed if the basering has the 2261 NOTE: the optional parameter is only allowed if the basering has the 2262 2262 variables x and y 2263 2263 EXAMPLE: example ellipticNFDB; shows an example" … … 2310 2310 proc polymakeKeepTmpFiles (int i) 2311 2311 "USAGE: polymakeKeepTmpFiles(int i); i int 2312 PURPOSE: some procedures create files in the directory /tmp which are used for 2312 PURPOSE: some procedures create files in the directory /tmp which are used for 2313 2313 computations with polymake respectively topcom; these will be removed 2314 when the corresponding procedure is left; however, it might be 2314 when the corresponding procedure is left; however, it might be 2315 2315 desireable to keep them for further computations with either polymake or 2316 2316 topcom; this can be achieved by this procedure; call the procedure as: … … 2355 2355 static proc scalarproduct (intvec w,intvec v) 2356 2356 "USAGE: scalarproduct(w,v); w,v intvec 2357 ASSUME: w and v are integer vectors of the same length 2357 ASSUME: w and v are integer vectors of the same length 2358 2358 RETURN: int, the scalarproduct of v and w 2359 2359 NOTE: the procedure is called by findOrientedBoundary" … … 2402 2402 { 2403 2403 int m=nrows(M); 2404 2404 2405 2405 } 2406 2406 else … … 2460 2460 { 2461 2461 return(""); 2462 2462 2463 2463 } 2464 2464 if (i==1) … … 2570 2570 k++; 2571 2571 } 2572 else 2572 else 2573 2573 { 2574 2574 stop=1; … … 2613 2613 k++; 2614 2614 } 2615 else 2615 else 2616 2616 { 2617 2617 stop=1; … … 2662 2662 static proc polygonToCoordinates (list points) 2663 2663 "USAGE: polygonToCoordinates(points); points list 2664 ASSUME: points is a list of integer vectors each of size two describing the 2665 marked points of a convex lattice polygon like the output of 2664 ASSUME: points is a list of integer vectors each of size two describing the 2665 marked points of a convex lattice polygon like the output of 2666 2666 polygonDB 2667 RETURN: list, the first entry is a string representing the coordinates 2667 RETURN: list, the first entry is a string representing the coordinates 2668 2668 corresponding to the latticpoints seperated by commata 2669 the second entry is a list where the ith entry is a string 2670 representing the coordinate of corresponding to the ith 2671 lattice point the third entry is the latex format of the 2669 the second entry is a list where the ith entry is a string 2670 representing the coordinate of corresponding to the ith 2671 lattice point the third entry is the latex format of the 2672 2672 first entry 2673 2673 NOTE: the procedure is called by fan" -
Singular/LIB/primdec.lib
rae9fd9 r3f4e52 1 1 /////////////////////////////////////////////////////////////////////////////// 2 version="$Id: primdec.lib,v 1.14 7 2009-04-15 08:10:22Singular Exp $";2 version="$Id: primdec.lib,v 1.148 2009-07-28 10:34:55 Singular Exp $"; 3 3 category="Commutative Algebra"; 4 4 info=" … … 22 22 They work in any characteristic.@* 23 23 Baserings must have a global ordering and no quotient ideal. 24 24 25 25 26 26 PROCEDURES: -
Singular/LIB/random.lib
rae9fd9 r3f4e52 1 1 //(GMG/BM, last modified 22.06.96) 2 2 /////////////////////////////////////////////////////////////////////////////// 3 version="$Id: random.lib,v 1.2 0 2009-04-15 11:18:27 seelischExp $";3 version="$Id: random.lib,v 1.21 2009-07-28 10:34:56 Singular Exp $"; 4 4 category="General purpose"; 5 5 info=" … … 154 154 proc sparseHomogIdeal (int k, int u, list #) 155 155 "USAGE: sparseid(k,u[,o,p,b]); k,u,o,p,b integers 156 RETURN: ideal having k homogeneous generators, each of random degree in the 157 interval [u,o], p percent of terms in degree d are 0, the remaining 158 have random coefficients in the interval [1,b], (default: o=u, p=75, 156 RETURN: ideal having k homogeneous generators, each of random degree in the 157 interval [u,o], p percent of terms in degree d are 0, the remaining 158 have random coefficients in the interval [1,b], (default: o=u, p=75, 159 159 b=30000) 160 160 EXAMPLE: example sparseid; shows an example … … 172 172 { 173 173 id = maxideal(random(u, o)); // monomial basis of some degree 174 m = sparsemat(size(id),1,p,b); // random coefficients 174 m = sparsemat(size(id),1,p,b); // random coefficients 175 175 i[ii] = (matrix(id)*m)[1,1]; 176 176 } -
Singular/LIB/ratgb.lib
rae9fd9 r3f4e52 1 1 ////////////////////////////////////////////////////////////////////////////// 2 version="$Id: ratgb.lib,v 1.1 6 2009-04-15 11:15:40 seelischExp $";2 version="$Id: ratgb.lib,v 1.17 2009-07-28 10:34:56 Singular Exp $"; 3 3 category="Noncommutative"; 4 4 info=" … … 174 174 va = L3[w][2]; 175 175 for(z=1;z<=nvars(save)-is;z++) 176 { 177 vb[z] = va[is+z]; 176 { 177 vb[z] = va[is+z]; 178 178 } 179 179 tmp3[1] = "a"; … … 372 372 setring A; 373 373 IAppel1; 374 def F1 = ratstd(IAppel1,2); 375 lead(pGBid); 374 def F1 = ratstd(IAppel1,2); 375 lead(pGBid); 376 376 setring F1; rGBid; 377 377 } … … 385 385 setring A; 386 386 IAppel2; 387 def F1 = ratstd(IAppel2,2); 388 lead(pGBid); 387 def F1 = ratstd(IAppel2,2); 388 lead(pGBid); 389 389 setring F1; rGBid; 390 390 } … … 398 398 setring A; 399 399 IAppel4; 400 def F1 = ratstd(IAppel4,2); 401 lead(pGBid); 400 def F1 = ratstd(IAppel4,2); 401 lead(pGBid); 402 402 setring F1; rGBid; 403 403 }
Note: See TracChangeset
for help on using the changeset viewer.