# Changeset 3754ca in git

Ignore:
Timestamp:
Apr 15, 2009, 1:28:08 PM (14 years ago)
Branches:
(u'jengelh-datetime', 'ceac47cbc86fe4a15902392bdbb9bd2ae0ea02c6')(u'spielwiese', 'a800fe4b3e9d37a38c5a10cc0ae9dfa0c15a4ee6')
Children:
a6606e6cba9689ecbcc4e27ac00fb8c1deabd128
Parents:
40c648539a84cb2dc36e46b6b6c84deeb21e393b
Message:
minor textual changes prior to 3-1-0

git-svn-id: file:///usr/local/Singular/svn/trunk@11714 2c84dea3-7e68-4137-9b89-c4e89433aadc
Location:
Singular/LIB
Files:
51 edited

Unmodified
Removed
• ## Singular/LIB/ainvar.lib

 r40c648 // $Id: ainvar.lib,v 1.9 2008-10-01 15:29:23 Singular Exp$ // $Id: ainvar.lib,v 1.10 2009-04-15 11:05:22 seelisch Exp$ ///////////////////////////////////////////////////////////////////////////// version="$Id: ainvar.lib,v 1.9 2008-10-01 15:29:23 Singular Exp$"; version="$Id: ainvar.lib,v 1.10 2009-04-15 11:05:22 seelisch Exp$"; category="Invariant theory"; info=" { // the ring L[2] = char(bsr),(x(1..nvars(bsr)),y(1..z)),(dp(n),dp(m)), // contains poly check s.t. LT(p) is of the form check(LT(f1),...,LT(fr)) // contains polynomial check s.t. LT(p) is of the form check(LT(f1),...,LT(fr)) def s1 = L[2]; map psi = s1,maxideal(1),dom; //---------  test wether @(0)-h(@(1),...,@(z)) is in ker --------------- // for some poly h and divide by maximal power of q=#[1] // for some polynomial h and divide by maximal power of q=#[1] poly h; z=size(kern);
• ## Singular/LIB/aksaka.lib

 r40c648 //CM, last modified 10.12.06 /////////////////////////////////////////////////////////////////////////////// version="$Id: aksaka.lib,v 1.4 2009-04-06 12:39:02 seelisch Exp$"; version="$Id: aksaka.lib,v 1.5 2009-04-15 11:05:47 seelisch Exp$"; category="Teaching"; info=" wurzel(r)                  square root of number r euler(r)                   phi-function of euler coeffmod(f,n)              poly f modulo number n (coefficients mod n) powerpolyX(q,n,a,r)        (poly a)^q modulo (poly r,number n) coeffmod(f,n)              polynomial f modulo number n (coefficients mod n) powerpolyX(q,n,a,r)        (polynomial a)^q modulo (poly r,number n) ask(n)                     ASK-Algorithm; deterministic Primality test "; ASSUME: poly f depends on at most var(1) of the basering RETURN: poly f modulo number n NOTE:   at first the coefficients of the monomials of the poly f are NOTE:   at first the coefficients of the monomials of the polynomial f are determined, then their remainder modulo n is calculated, after that the poly 'is put together' again after that the polynomial 'is put together' again EXAMPLE:example coeffmod; shows an example " // umwandeln der Koeffizienten in numbers, // Berechnung der Reste dieser numbers modulo n, // poly mit neuen Koeffizienten wieder zusammensetzen // Polynom mit neuen Koeffizienten wieder zusammensetzen i++; }
• ## Singular/LIB/alexpoly.lib

 r40c648 version="$Id: alexpoly.lib,v 1.17 2008-12-12 17:22:35 Singular Exp$"; version="$Id: alexpoly.lib,v 1.18 2009-04-15 11:06:40 seelisch Exp$"; category="Singularities"; info=" } /////////////////////////////////////////////////////////////////////////////////////////////////// // If the input was a poly or a HN-Expansion, then calculate the contact matrix and char.exponents. // If the input was a polynomial or a HN-Expansion, then calculate the contact matrix and char.exponents. /////////////////////////////////////////////////////////////////////////////////////////////////// if (defined(I@N@V))
• ## Singular/LIB/algebra.lib

 r40c648 //new proc  nonZeroEntry(id), used to fix a bug in proc finitenessTest /////////////////////////////////////////////////////////////////////////////// version="$Id: algebra.lib,v 1.22 2009-04-14 12:00:13 Singular Exp$"; version="$Id: algebra.lib,v 1.23 2009-04-15 11:07:30 seelisch Exp$"; category="Commutative Algebra"; info=" algebra_containment(); query of algebra containment module_containment();  query of module containment over a subalgebra inSubring(p,I);        test whether poly p is in subring generated by I inSubring(p,I);        test whether polynomial p is in subring generated by I algDependent(I);       computes algebraic relations between generators of I alg_kernel(phi);       computes the kernel of the ringmap phi x = x(1),...,x(n) denote the variables of the basering @end format DISPLAY: if k=0 and printlevel >= voice+1 (default) display the poly check DISPLAY: if k=0 and printlevel >= voice+1 (default) display the polynomial check NOTE:    The proc inSubring uses a different algorithm which is sometimes faster. dbprint(printlevel-voice+3," // 'algebra_containment' created a ring as 2nd element of the list. // The ring contains the poly check which defines the algebraic relation. // The ring contains the polynomial check which defines the algebraic relation. // To access to the ring and see check you must give the ring a name, // e.g.: dbprint(printlevel-voice+3," // 'module_containment' created a ring as 2nd element of the list. The // ring contains the poly check which defines the algebraic relation // ring contains the polynomial check which defines the algebraic relation // for p. To access to the ring and see check you must give the ring // a name, e.g.: @format a list l of size 2, l[1] integer, l[2] string l[1]=1 iff p is in the subring generated by i=i[1],...,i[k], l[1]=1 if and only if p is in the subring generated by i=i[1],...,i[k], and then l[2] = y(0)-h(y(1),...,y(k)) if p = h(i[1],...,i[k]) l[1]=0 iff p is in not the subring generated by i, l[1]=0 if and only if p is in not the subring generated by i, and then l[2] = h(y(0),y(1),...,y(k)) where p satisfies the nonlinear relation h(p,i[1],...,i[k])=0. NOTE:    the proc algebra_containment tests the same using a different algorithm, which is often faster if l[1] == 0 then l[2] may contain more than one relation h(y(0),y(1),...,y(k)), if l[1] == 0 then l[2] may contain more than one relation h(y(0),y(1),...,y(k)), separated by comma EXAMPLE: example inSubring; shows an example "USAGE:   is_surjective(phi); phi map to basering, or ideal defining it RETURN:  an integer,  1 if phi is surjective, 0 if not NOTE:    The algorithm returns 1 iff all the variables of the basering are NOTE:    The algorithm returns 1 if and only if all the variables of the basering are contained in the polynomial subalgebra generated by the polynomials defining phi. Hence, it tests surjectivity in the case of a global odering. RETURN:  1 if R ---> basering/J is finite and 0 else NOTE:    R may be a quotient ring (this will be ignored since a map R/I-->S/J is finite iff the induced map R-->S/J is finite). is finite if and only if the induced map R-->S/J is finite). SEE ALSO: finitenessTest EXAMPLE: example mapIsFinite; shows an example
• ## Singular/LIB/bfun.lib

 r40c648 ////////////////////////////////////////////////////////////////////////////// version="$Id: bfun.lib,v 1.8 2009-04-14 12:00:13 Singular Exp$"; version="$Id: bfun.lib,v 1.9 2009-04-15 11:09:27 seelisch Exp$"; category="Noncommutative"; info=" @*      one is interested in the global b-function (also known as Bernstein-Sato @*      polynomial) b(s) in K[s], defined to be the non-zero monic polynomial of minimal @*      degree, satisfying a functional identity L * F^{s+1} = b(s) F^s, @*      degree, satisfying a functional identity L * F^{s+1} = b(s) F^s, @*      for some operator L in D[s] (* stands for the action of differential operator) @*      By D one denotes the n-th Weyl algebra @*   There is a constructive definition of a b-function of a holonomic ideal I in D @*   (that is, an ideal I in a Weyl algebra D, such that D/I is holonomic module) @*   with respect to the given weight vector w: For a poly p in D, its initial @*   form w.r.t. (-w,w) is defined as the sum of all terms of p which have @*   with respect to the given weight vector w: For a polynomial p in D, its initial @*   form w.r.t. (-w,w) is defined as the sum of all terms of p which have @*   maximal weighted total degree where the weight of x_i is -w_i and the weight @*   of d_i is w_i. Let J be the initial ideal of I w.r.t. (-w,w), i.e. the @*   of d_i is w_i. Let J be the initial ideal of I w.r.t. (-w,w), i.e. the @*   K-vector space generated by all initial forms w.r.t (-w,w) of elements of I. @*   Put s = w_1 x_1 d_1 + ... + w_n x_n d_n. Then the monic generator b_w(s) of @*   the intersection of J with the PID K[s] is called the b-function of I w.r.t.  w. @*   the intersection of J with the PID K[s] is called the b-function of I w.r.t.  w. @*   Unlike Bernstein-Sato polynomial, general b-function with respect to @*   arbitrary weights need not have rational roots at all. However, b-function @*  of a holonomic ideal is known to be non-zero as well. @* @*      References: [SST] Saito, Sturmfels, Takayama: Groebner Deformations of @* @*      References: [SST] Saito, Sturmfels, Takayama: Groebner Deformations of @*      Hypergeometric Differential Equations (2000), @*      Noro: An Efficient Modular Algorithm for Computing the Global b-function, bfctAnn(f[,s]);           compute the BS polynomial of f via Ann f^s + f bfctOneGB(f[,s,t]);     compute the BS polynomial of f by just one GB computation bfctIdeal(I,w[,s,t]);     compute the b-function of ideal wrt weight pIntersect(f,I[,s]);      intersection of ideal with subalgebra K[f] for a poly f bfctIdeal(I,w[,s,t]);     compute the b-function of ideal w.r.t. weight pIntersect(f,I[,s]);      intersection of ideal with subalgebra K[f] for a polynomial f pIntersectSyz(f,I[,p,s,t]); intersection of ideal with subalgebra K[f] with syz-solver linReduce(f,I[,s]);         reduce a poly by linear reductions wrt ideal linReduce(f,I[,s]);         reduce a polynomial by linear reductions w.r.t. ideal linReduceIdeal(I,[s,t]);  interreduce generators of ideal by linear reductions linSyzSolve(I[,s]);         compute a linear dependency of elements of ideal I AUXILIARY PROCEDURES: allPositive(v);  checks whether all entries of an intvec are positive allPositive(v);  checks whether all entries of an intvec are positive scalarProd(v,w); computes the standard scalar product of two intvecs vec2poly(v[,i]); constructs an univariate poly with given coefficients vec2poly(v[,i]); constructs an univariate polynomial with given coefficients SEE ALSO: dmod_lib, dmodapp_lib, gmssing_lib for (i=1; i<=ncols(I); i++) { M[i] = gen(i);  } } } } dbprint(ppl-1,"// initially sorted ideal:", I); if (remembercoeffs <> 0) { dbprint(ppl-1,"// used permutations:", M); } "USAGE:  linReduce(f, I [,s,t,u]); f a poly, I an ideal, s,t,u optional ints RETURN:  poly or list, linear reductum (over field) of f by elements from I PURPOSE: reduce a poly only by linear reductions (no monomial multiplications) NOTE:    If s<>0, a list consisting of the reduced poly and the coefficient PURPOSE: reduce a polynomial only by linear reductions (no monomial multiplications) NOTE:    If s<>0, a list consisting of the reduced polynomial and the coefficient @*       vector of the used reductions is returned, otherwise (and by default) @*       only reduced poly is returned. @*       only reduced polynomial is returned. @*       If t<>0 (and by default) all monomials are reduced (if possible), @*       otherwise, only leading monomials are reduced. @*       If u<>0 (and by default), the ideal is linearly pre-reduced, i.e. @*       If u<>0 (and by default), the ideal is linearly pre-reduced, i.e. @*       instead of the given ideal, the output of @code{linReduceIdeal} is used. @*       If u is set to 0 and the given ideal does not equal the output of NOTE:    If the intersection is zero, this procedure might not terminate. @*       If p>0 is given, this proc computes the generator of the intersection in @*       char p first and then only searches for a generator of the obtained @*       degree in the basering. Otherwise, it searches for all degrees by @*       char p first and then only searches for a generator of the obtained @*       degree in the basering. Otherwise, it searches for all degrees by @*       computing syzygies. @*       If s<>0, @code{std} is used for Groebner basis computations in char 0, @*       otherwise, and by default, @code{slimgb} is used. @*       If t<>0 and by default, @code{std} is used for Groebner basis @*       If t<>0 and by default, @code{std} is used for Groebner basis @*       computations in char >0, otherwise, @code{slimgb} is used. DISPLAY: If printlevel=1, progress debug messages will be printed, } dbprint(ppl,"// pIntersectSyz finished"); if (solveincharp) { short = shortSave; } if (solveincharp) { short = shortSave; } return(v); } proc vec2poly (list #) "USAGE:  vec2poly(v [,i]);  v a vector or an intvec, i an optional int RETURN:  poly, an univariate poly in i-th variable with coefficients given by v PURPOSE: constructs an univariate poly in K[var(i)] with given coefficients, RETURN:  poly, an univariate polynomial in i-th variable with coefficients given by v PURPOSE: constructs an univariate polynomial in K[var(i)] with given coefficients, @*       such that the coefficient at var(i)^{j-1} is v[j]. NOTE:    The optional argument i must be positive, by default i is 1. // the rest of this proc is nicked from bernsteinBM from dmod.lib list P = factorize(p);//with constants and multiplicities ideal bs; intvec m;   //the BS poly is monic, so we are not interested in constants ideal bs; intvec m;   //the BS polynomial is monic, so we are not interested in constants for (i=2; i<= size(P[1]); i++)  //we delete P[1][1] and P[2][1] { { return(list(ideal(0),intvec(0))); } } if (inorann == 0) // bfct using initial ideal { RETURN:  list of ideal and intvec PURPOSE: computes the roots of the Bernstein-Sato polynomial b(s) @*       for the hypersurface defined by f. @*       for the hypersurface defined by f. ASSUME:  The basering is commutative and of characteristic 0. BACKGROUND: In this proc, the initial Malgrange ideal is computed according to @*       the algorithm by Masayuki Noro and then a system of linear equations is @*       solved by linear reductions. NOTE:    In the output list, the ideal contains all the roots NOTE:    In the output list, the ideal contains all the roots @*       and the intvec their multiplicities. @*       If s<>0, @code{std} is used for GB computations, @*       otherwise, and by default, @code{slimgb} is used. @*       otherwise, and by default, @code{slimgb} is used. @*       If t<>0, a matrix ordering is used for Groebner basis computations, @*       otherwise, and by default, a block ordering is used. @*       the algorithm by Masayuki Noro and then a system of linear equations is @*       solved by computing syzygies. NOTE:    In the output list, the ideal contains all the roots and the intvec NOTE:    In the output list, the ideal contains all the roots and the intvec @*       their multiplicities. @*       If r<>0, @code{std} is used for GB computations in characteristic 0, "USAGE:  bfctIdeal(I,w[,s,t]);  I an ideal, w an intvec, s,t optional ints RETURN:  list of ideal and intvec PURPOSE: computes the roots of the global b-function of I wrt the weight (-w,w). PURPOSE: computes the roots of the global b-function of I w.r.t. the weight (-w,w). ASSUME:  The basering is the n-th Weyl algebra in characteristic 0 and for all @*       1<=i<=n the identity var(i+n)*var(i)=var(i)*var(i+1)+1 holds, i.e. the @*       sequence of variables is given by x(1),...,x(n),D(1),...,D(n), @*       sequence of variables is given by x(1),...,x(n),D(1),...,D(n), @*       where D(i) is the differential operator belonging to x(i). @*       Further we assume that I is holonomic. @*  L[3] is 1 (for nonzero constant) or 0 (for zero b-function). @*       If s<>0, @code{std} is used for GB computations in characteristic 0, @*       otherwise, and by default, @code{slimgb} is used. @*       otherwise, and by default, @code{slimgb} is used. @*       If t<>0, a matrix ordering is used for GB computations, otherwise, @*       and by default, a block ordering is used. @*       their multiplicities. @*       If s<>0, @code{std} is used for the GB computation, otherwise, @*       and by default, @code{slimgb} is used. @*       and by default, @code{slimgb} is used. @*       If t<>0, a matrix ordering is used for GB computations, @*       otherwise, and by default, a block ordering is used. def save = basering; int n = nvars(save); if (char(save) <> 0) if (char(save) <> 0) { ERROR("characteristic of basering has to be 0"); // create names for vars list Lvar; Lvar[1]   = safeVarName("t"); Lvar[1]   = safeVarName("t"); Lvar[2]   = safeVarName("s"); Lvar[n+3] = safeVarName("D"+Lvar[1]); intvec @a = 1:N; @a[2] = 2; intvec @a2 = @a; @a2[2] = 0; @a2[2*n+4] = 0; list Lord; list Lord; Lord[1] = list("a",@a); Lord[2] = list("a",@a2); if (methodord == 0) // default: block ordering @*       their multiplicities. @*       If r<>0, @code{std} is used for GB computations, @*       otherwise, and by default, @code{slimgb} is used. @*       otherwise, and by default, @code{slimgb} is used. DISPLAY: If printlevel=1, progress debug messages will be printed, @*       if printlevel>=2, all the debug messages will be printed.
• ## Singular/LIB/brnoeth.lib

 r40c648 version="$Id: brnoeth.lib,v 1.21 2009-04-07 09:30:44 seelisch Exp$"; version="$Id: brnoeth.lib,v 1.22 2009-04-15 11:10:53 seelisch Exp$"; category="Coding theory"; info=" { // computes : the degree of a given point // remark(1) : if the input is (irreducible homogeneous) poly => the point // remark(1) : if the input is (irreducible homogeneous) polynomial => the point //             is at infinity // remark(2) : it the input is (std. resp. lp. prime) ideal => the point is else { ERROR("parameter must have a poly or ideal in the first component"); ERROR("parameter must have a polynomial or ideal in the first component"); } } else { ERROR("a point must have a poly or ideal in the first component"); ERROR("a point must have a polynomial or ideal in the first component"); } } static proc local_eq (poly H,SS,int m) { // computes a local equation of poly H in the ring SS related to the place // computes a local equation of polynomial H in the ring SS related to the place //     "m" // list POINT/POINTS is searched depending on wether m=0 or m>0 respectively static proc polytoRF (F) { // converts a poly (or number) into a "rational function" of type "ideal" // warning : it must be called inside "R" and poly should be affine // converts a polynomial (or number) into a "rational function" of type "ideal" // warning : it must be called inside "R" and the polynomial is expected to be affine ideal RF; RF[1]=homog(F,z); { // computes l*F as rational function // l should be either a number or a poly of degree zero // l should be either a number or a polynomial of degree zero if (typeof(F)=="ideal") {
• ## Singular/LIB/central.lib

 r40c648 /////////////////////////////////////////////////////////////////////////////// version="$Id: central.lib,v 1.9 2009-03-30 18:11:39 motsak Exp$" version="$Id: central.lib,v 1.10 2009-04-15 11:11:04 seelisch Exp$" category="Noncommutative" info=" static proc SANF( poly p, list FOUND_LEADING_MONOMIALS ) " reduce p wrt found multiples without ANY polynomial multiplications! reduce p w.r.t. found multiples without ANY polynomial multiplications! " { " USAGE:      sa_poly_reduce(p, V); p poly, V ideal RETURN:     polynomial, a reduction of p wrt V PURPOSE:    computes a reduction of the polynomial p wrt the subalgebra generated by elements of V RETURN:     polynomial, a reduction of p w.r.t. V PURPOSE:    computes a reduction of the polynomial p w.r.t. the subalgebra generated by elements of V NOTE:       At the moment the usage of this procedure is limited to G-algebras SEE ALSO:   sa_reduce { DBPrint( 1, "POLY: " + string (p) + " is NOT in the centralizer of poly {" + string(f) + "}" ); " is NOT in the centralizer of polynomial {" + string(f) + "}" ); return (0); } RETURN:      integer, 1 if f is a Cartan element and 0 otherwise. NOTE:        f is a Cartan element of the algebra A @* iff for all g in A there exists C in K such that [f, g] = C * g @* iff for all variables v_i there exist C in K such that [f, v_i] = C * v_i. @* if and only if for all g in A there exists C in K such that [f, g] = C * g @* if and only if for all variables v_i there exist C in K such that [f, v_i] = C * v_i. " {
• ## Singular/LIB/classify.lib

 r40c648 // KK,GMG last modified: 17.12.00 /////////////////////////////////////////////////////////////////////////////// version  = "$Id: classify.lib,v 1.55 2009-01-14 16:07:03 Singular Exp$"; version  = "$Id: classify.lib,v 1.56 2009-04-15 11:11:11 seelisch Exp$"; category="Singularities"; info=" PROCEDURES: basicinvariants(f); computes Milnor number, determinacy-bound and corank of classify(f);        normal form of poly f determined with Arnold's method classify(f);        normal form of polynomial f determined with Arnold's method corank(f);          computes the corank of f (i.e. of the Hessian of f) Hcode(v);           coding of intvec v acoording to the number repetitions init_debug([n]);    print trace and debugging information depending on int n internalfunctions();display names of internal procedures of this library milnorcode(f[,e]);  Hilbert poly of [e-th] Milnor algebra coded with Hcode milnorcode(f[,e]);  Hilbert polynomial of [e-th] Milnor algebra coded with Hcode morsesplit(f);      residual part of f after applying the splitting lemma quickclass(f)       normal form of f determined by invariants (milnorcode) REMARK:   This version of classify is only beta. Please send bugs and comments to: \"Kai Krueger\" @* Be sure to have at least Singular version 1.0.1. Updates can be Be sure to have at least @sc{Singular} version 1.0.1. Updates can be found at: @* URL=http://www.mathematik.uni-kl.de/~krueger/Singular/
• ## Singular/LIB/crypto.lib

 r40c648 //GP, last modified 28.6.06 /////////////////////////////////////////////////////////////////////////////// version="$Id: crypto.lib,v 1.8 2009-04-14 12:00:14 Singular Exp$"; version="$Id: crypto.lib,v 1.9 2009-04-15 11:11:20 seelisch Exp$"; category="Teaching"; info=" "USAGE:  generateG(a,b,m); RETURN: m-th division polynomial NOTE: generate the so-called division polynomials, i.e., the recursively defined NOTE: generate the so-called division polynomials, i.e., the recursively defined polynomials p_m=generateG(a,b,m) in Z[x, y] such that, for a point (x:y:1) on the elliptic curve defined by y^2=x^3+a*x+b  over Z/N the point@* m*P=(x-(p_(m-1)*p_(m+1))/p_m^2 :(p_(m+2)*p_(m-1)^2-p_(m-2)*p_(m+1)^2)/4y*p_m^3 :1) and m*P=0  iff p_m(P)=0 and m*P=0 if and only if p_m(P)=0 EXAMPLE:example generateG; shows an example "
• ## Singular/LIB/curvepar.lib

 r40c648 /////////////////////////////////////////////////////////////////////////////////////////// version="$Id: curvepar.lib,v 1.3 2007-05-24 13:37:19 Singular Exp$"; version="$Id: curvepar.lib,v 1.4 2009-04-15 11:11:20 seelisch Exp$"; category="Singularities"; info=" Each chart C[i] is a list of size 5 C[i][1] is an integer j. It shows, which standard chart do we consider. C[i][2] is an irreducible poly g in k[a]. It is a minimal polynomial for the new parameter. C[i][2] is an irreducible polynomial g in k[a]. It is a minimal polynomial for the new parameter. C[i][3] is an ideal H in k[a]. c_i=F_i(a_new) for i=1..n, teta:k[x(1)..x(n),a]-->k[x(1)..x(n),a] from the new curve to the old one. Resolve[i][3] is an irreducible poly g in k[a]. It is a minimal polynomial for the new parameter a. Resolve[i][3] is an irreducible polynomial g in k[a]. It is a minimal polynomial for the new parameter a. Resolve[i][4] sequence of multiplicities Resolve[i][5] is a list of integers l. It shows, which standard charts we considered.
• ## Singular/LIB/dmod.lib

 r40c648 ////////////////////////////////////////////////////////////////////////////// version="$Id: dmod.lib,v 1.41 2009-04-14 17:11:50 Singular Exp$"; version="$Id: dmod.lib,v 1.42 2009-04-15 11:11:34 seelisch Exp$"; category="Noncommutative"; info=" @*             Jorge Martin Morales,    jorge@unizar.es THEORY: Let K be a field of characteristic 0. Given a polynomial ring THEORY: Let K be a field of characteristic 0. Given a polynomial ring @*      R = K[x_1,...,x_n] and a polynomial F in R, @*      one is interested in the R[1/F]-module of rank one, generated by @*      one is interested in the R[1/F]-module of rank one, generated by @*      the symbol F^s for a symbolic discrete variable s. @* In fact, the module R[1/F]*F^s has a structure of a D(R)[s]-module, where D(R) @* One is interested in the following data: @* - Ann F^s = I = I(F^s) in D(R)[s], denoted by LD in the output @* - global Bernstein polynomial in K[s], denoted by bs, @* - global Bernstein polynomial in K[s], denoted by bs, @* - its minimal integer root s0, the list of all roots of bs, which are known @*   to be rational, with their multiplicities, which is denoted by BS @* - Ann F^s0 = I(F^s0) in D(R), denoted by LD0 in the output @* - Ann F^s0 = I(F^s0) in D(R), denoted by LD0 in the output @*   (LD0 is a holonomic ideal in D(R)) @* - Ann^(1) F^s in D(R)[s], denoted by LD1 (logarithmic derivations) @*     PS*F^(s+1) = bs*F^s holds in K[x_1,...,x_n,1/F]*F^s. REFERENCES: REFERENCES: @* We provide the following implementations of algorithms: @* (OT) the classical Ann F^s algorithm from Oaku and Takayama (Journal of @* (OT) the classical Ann F^s algorithm from Oaku and Takayama (Journal of @* Pure and Applied Math., 1999), @* (LOT) Levandovskyy's modification of the Oaku-Takayama algorithm (ISSAC 2007) @*        l'ideal de Bernstein associe a des polynomes, preprint, 2002) @* (LM08) V. Levandovskyy and J. Martin-Morales, ISSAC 2008 @* (C) Countinho, A Primer of Algebraic D-Modules, @* (SST) Saito, Sturmfels, Takayama 'Groebner Deformations of Hypergeometric @* (C) Countinho, A Primer of Algebraic D-Modules, @* (SST) Saito, Sturmfels, Takayama 'Groebner Deformations of Hypergeometric @*         Differential Equations', Springer, 2000 MAIN PROCEDURES: annfs(F[,S,eng]);       compute Ann F^s0 in D and Bernstein poly for a poly F annfspecial(I, F, m, n);  compute Ann F^n from Ann F^s for a poly F and a number n Sannfs(F[,S,eng]);      compute Ann F^s in D[s] for a poly F Sannfslog(F[,eng]);     compute Ann^(1) F^s in D[s] for a poly F bernsteinBM(F[,eng]);   compute global Bernstein poly for a poly F (algorithm of Briancon-Maisonobe) operatorBM(F[,eng]);    compute Ann F^s, Ann F^s0, BS and PS for a poly F (algorithm of Briancon-Maisonobe) annfsParamBM(F[,eng]);  compute the generic Ann F^s (algorithm by Briancon and Maisonobe) and exceptional parametric constellations for a poly F with parametric coefficients annfsBMI(F[,eng]);      compute Ann F^s and Bernstein ideal for a poly F=f1*..*fP (multivariate algorithm of Briancon-Maisonobe) annfs(F[,S,eng]);       compute Ann F^s0 in D and Bernstein polynomial for a poly F annfspecial(I, F, m, n);  compute Ann F^n from Ann F^s for a polynomial F and a number n Sannfs(F[,S,eng]);      compute Ann F^s in D[s] for a polynomial F Sannfslog(F[,eng]);     compute Ann^(1) F^s in D[s] for a polynomial F bernsteinBM(F[,eng]);   compute global Bernstein polynomial for a polynomial F (algorithm of Briancon-Maisonobe) operatorBM(F[,eng]);    compute Ann F^s, Ann F^s0, BS and PS for a polynomial F (algorithm of Briancon-Maisonobe) annfsParamBM(F[,eng]);  compute the generic Ann F^s (algorithm by Briancon and Maisonobe) and exceptional parametric constellations for a polynomial F with parametric coefficients annfsBMI(F[,eng]);      compute Ann F^s and Bernstein ideal for a polynomial F=f1*..*fP (multivariate algorithm of Briancon-Maisonobe) checkRoot(F,a[,S,eng]); check if a given rational is a root of the global Bernstein polynomial of F and compute its multiplicity annfsBM(F[,eng]);          compute Ann F^s0 in D and Bernstein poly for a poly F (algorithm of Briancon-Maisonobe) annfsLOT(F[,eng]);         compute Ann F^s0 in D and Bernstein poly for a poly F (Levandovskyy modification of the Oaku-Takayama algorithm) annfsOT(F[,eng]);          compute Ann F^s0 in D and Bernstein poly for a poly F (algorithm of Oaku-Takayama) SannfsBM(F[,eng]);         compute Ann F^s in D[s] for a poly F (algorithm of Briancon-Maisonobe) SannfsBFCT(F[,eng]);      compute Ann F^s in D[s] for a poly F (algorithm of Briancon-Maisonobe, other output ordering) SannfsLOT(F[,eng]);        compute Ann F^s in D[s] for a poly F (Levandovskyy modification of the Oaku-Takayama algorithm) SannfsOT(F[,eng]);         compute Ann F^s in D[s] for a poly F (algorithm of Oaku-Takayama) annfs0(I,F [,eng]);          compute Ann F^s0 in D and Bernstein poly from the known Ann F^s in D[s] annfs2(I,F [,eng]);           compute Ann F^s0 in D and Bernstein poly from the known Ann F^s in D[s] by using a trick of Noro annfsRB(I,F [,eng]);          compute Ann F^s0 in D and Bernstein poly from the known Ann F^s in D[s] by reduceB strategy of Macaulay annfsBM(F[,eng]);          compute Ann F^s0 in D and Bernstein polynomial for a polynomial F (algorithm of Briancon-Maisonobe) annfsLOT(F[,eng]);         compute Ann F^s0 in D and Bernstein polynomial for a polynomial F (Levandovskyy modification of the Oaku-Takayama algorithm) annfsOT(F[,eng]);          compute Ann F^s0 in D and Bernstein polynomial for a polynomial F (algorithm of Oaku-Takayama) SannfsBM(F[,eng]);         compute Ann F^s in D[s] for a polynomial F (algorithm of Briancon-Maisonobe) SannfsBFCT(F[,eng]);      compute Ann F^s in D[s] for a polynomial F (algorithm of Briancon-Maisonobe, other output ordering) SannfsLOT(F[,eng]);        compute Ann F^s in D[s] for a polynomial F (Levandovskyy modification of the Oaku-Takayama algorithm) SannfsOT(F[,eng]);         compute Ann F^s in D[s] for a polynomial F (algorithm of Oaku-Takayama) annfs0(I,F [,eng]);          compute Ann F^s0 in D and Bernstein polynomial from the known Ann F^s in D[s] annfs2(I,F [,eng]);           compute Ann F^s0 in D and Bernstein polynomial from the known Ann F^s in D[s] by using a trick of Noro annfsRB(I,F [,eng]);          compute Ann F^s0 in D and Bernstein polynomial from the known Ann F^s in D[s] by reduceB strategy of Macaulay checkRoot1(I,F,a[,eng]);   check whether a rational is a root of the global Bernstein polynomial of F from the known Ann F^s in D[s] checkRoot2(I,F,a[,eng]);   check whether a rational is a root of the global Bernstein polynomial of F and compute its multiplicity from the known Ann F^s in D[s] LIB "poly.lib"; proc testdmodlib() { /* tests all procs for consistency */ /* adding the new proc, add it here */ "MAIN PROCEDURES:"; example annfs; example Sannfs; example Sannfslog; example bernsteinBM; example operatorBM; example annfspecial; example annfsParamBM; example annfsBMI; example checkRoot; example annfs0; example annfs2; example annfsRB; example annfs2; "SECONDARY D-MOD PROCEDURES:"; example annfsBM; example annfsLOT; example annfsOT; example SannfsBM; example SannfsLOT; example SannfsOT; example SannfsBFCT; example checkRoot1; example checkRoot2; example checkFactor; } // new top-level procedures proc annfs(poly F, list #) "USAGE:  annfs(f [,S,eng]);  f a poly, S a string, eng an optional int RETURN:  ring PURPOSE: compute the D-module structure of basering[1/f]*f^s with the algorithm PURPOSE: compute the D-module structure of basering[1/f]*f^s with the algorithm @*  given in S and with the Groebner basis engine given in ''eng'' NOTE:  activate the output ring with the @code{setring} command. "USAGE:  Sannfs(f [,S,eng]);  f a poly, S a string, eng an optional int RETURN:  ring PURPOSE: compute the D-module structure of basering[f^s] with the algorithm PURPOSE: compute the D-module structure of basering[f^s] with the algorithm @*  given in S and with the Groebner basis engine given in eng NOTE:    activate the output ring with the @code{setring} command. PURPOSE: compute the D-module structure of basering[1/f]*f^s NOTE:    activate the output ring with the @code{setring} command. @*   In the output ring D[s], the ideal LD1 is generated by the elements @*   In the output ring D[s], the ideal LD1 is generated by the elements @*   in Ann F^s in D[s], coming from logarithmic derivations. @*       If eng <>0, @code{std} is used for Groebner basis computations, "USAGE:  ALTannfsBM(f [,eng]);  f a poly, eng an optional int RETURN:  ring PURPOSE: compute the annihilator ideal of f^s in D[s], where D is the Weyl PURPOSE: compute the annihilator ideal of f^s in D[s], where D is the Weyl @*   algebra, according to the algorithm by Briancon and Maisonobe NOTE:  activate the output ring with the @code{setring} command. In this ring, "USAGE:  bernsteinBM(f [,eng]);  f a poly, eng an optional int RETURN:  list (of roots of the Bernstein polynomial b and their multiplicies) PURPOSE: compute the global Bernstein-Sato polynomial for a hypersurface, PURPOSE: compute the global Bernstein-Sato polynomial for a hypersurface, @* defined by f, according to the algorithm by Briancon and Maisonobe NOTE:    If eng <>0, @code{std} is used for Groebner basis computations, "USAGE:  annfs2(I, F [,eng]);  I an ideal, F a poly, eng an optional int RETURN:  ring PURPOSE: compute the annihilator ideal of f^s in the Weyl Algebra, PURPOSE: compute the annihilator ideal of f^s in the Weyl Algebra, @*       based on the output of Sannfs-like procedure @*       annfs2 uses shorter expressions in the variable s (the idea of Noro). "USAGE:  annfsRB(I, F [,eng]);  I an ideal, F a poly, eng an optional int RETURN:  ring PURPOSE: compute the annihilator ideal of f^s in the Weyl Algebra, PURPOSE: compute the annihilator ideal of f^s in the Weyl Algebra, @* based on the output of Sannfs like procedure NOTE:    activate the output ring with the @code{setring} command. In this ring, attrib(JF,"isSB",1); // embedded comm ring is used ideal J = NF(I,JF); dbprint(ppl,"// -1-2- finished computing the NF of I wrt Tjurina ideal"); dbprint(ppl,"// -1-2- finished computing the NF of I w.r.t. Tjurina ideal"); dbprint(ppl-1, J2); // make leadcoeffs positive "USAGE:  operatorBM(f [,eng]);  f a poly, eng an optional int RETURN:  ring PURPOSE: compute the B-operator and other relevant data for Ann F^s, PURPOSE: compute the B-operator and other relevant data for Ann F^s, @*  using e.g. algorithm by Briancon and Maisonobe for Ann F^s and BS. NOTE:    activate the output ring with the @code{setring} command. In the output ring D[s] "USAGE:  operatorModulo(f,I,b);  f a poly, I an ideal, b a poly RETURN:  poly PURPOSE: compute the B-operator from the poly f, ideal I = Ann f^s and Bernstein-Sato PURPOSE: compute the B-operator from the polynomial f, ideal I = Ann f^s and Bernstein-Sato polynomial b using modulo i.e. kernel of module homomorphism NOTE:  The computations take place in the ring, similar to the one returned by Sannfs procedure. "USAGE:  annfsBMI(F [,eng]);  F an ideal, eng an optional int RETURN:  ring PURPOSE: compute the D-module structure of basering[1/f]*f^s where PURPOSE: compute the D-module structure of basering[1/f]*f^s where @* f = F[1]*..*F[P], according to the algorithm by Briancon and Maisonobe. NOTE:    activate the output ring with the @code{setring} command. In this ring, "USAGE:  annfsOT(f [,eng]);  f a poly, eng an optional int RETURN:  ring PURPOSE: compute the D-module structure of basering[1/f]*f^s, PURPOSE: compute the D-module structure of basering[1/f]*f^s, @* according to the algorithm by Oaku and Takayama NOTE:    activate the output ring with the @code{setring} command. In this ring, "USAGE:  SannfsOT(f [,eng]);  f a poly, eng an optional int RETURN:  ring PURPOSE: compute the D-module structure of basering[1/f]*f^s, according to the PURPOSE: compute the D-module structure of basering[1/f]*f^s, according to the @* 1st step of the algorithm by Oaku and Takayama in the ring D[s] NOTE:    activate the output ring with the @code{setring} command. @*  In the output ring D[s], the ideal LD (which is NOT a Groebner basis) @*  In the output ring D[s], the ideal LD (which is NOT a Groebner basis) @*  is the needed D-module structure. @*  If eng <>0, @code{std} is used for Groebner basis computations, "USAGE:  SannfsBM(f [,eng]);  f a poly, eng an optional int RETURN:  ring PURPOSE: compute the D-module structure of basering[1/f]*f^s, according to the PURPOSE: compute the D-module structure of basering[1/f]*f^s, according to the @* 1st step of the algorithm by Briancon and Maisonobe in the ring D[s]. NOTE:  activate the output ring with the @code{setring} command. @*   In the output ring D[s], the ideal LD (which is NOT a Groebner basis) is @*   In the output ring D[s], the ideal LD (which is NOT a Groebner basis) is @*   the needed D-module structure. @*   If eng <>0, @code{std} is used for Groebner basis computations, PURPOSE: compute Ann f^s and Groebner basis of Ann f^s+f in D[s] NOTE:    activate the output ring with the @code{setring} command. @*  This procedure, unlike SannfsBM, returns a ring with the degrevlex @*  This procedure, unlike SannfsBM, returns a ring with the degrevlex @*  ordering in all variables. @*  In the ring D[s], the ideal LD is the ideal needed (which is returned as a Groebner basis). PURPOSE: compute Ann f^s and Groebner basis of Ann f^s+f in D[s] NOTE:    activate the output ring with the @code{setring} command. @*    This procedure, unlike SannfsBM, returns a ring with the degrevlex @*    This procedure, unlike SannfsBM, returns a ring with the degrevlex @*    ordering in all variables. @*    In the ring D[s], the ideal LD (which IS a Groebner basis) is the needed ideal. " { // DEBUG INFO: ordering on the output ring = dp, // DEBUG INFO: ordering on the output ring = dp, // use std(K,F); for reusing the std property of K "USAGE:  SannfsLOT(f [,eng]);  f a poly, eng an optional int RETURN:  ring PURPOSE: compute the D-module structure of basering[1/f]*f^s, according to the PURPOSE: compute the D-module structure of basering[1/f]*f^s, according to the @* Levandovskyy's modification of the algorithm by Oaku and Takayama in D[s] NOTE:    activate the output ring with the @code{setring} command. @*    In the ring D[s], the ideal LD (which is NOT a Groebner basis) is @*    In the ring D[s], the ideal LD (which is NOT a Groebner basis) is @*    the needed D-module structure. @*    If eng <>0, @code{std} is used for Groebner basis computations, "USAGE:  annfsLOT(F [,eng]);  F a poly, eng an optional int RETURN:  ring PURPOSE: compute the D-module structure of basering[1/f]*f^s, according to PURPOSE: compute the D-module structure of basering[1/f]*f^s, according to @* the Levandovskyy's modification of the algorithm by Oaku and Takayama NOTE:    activate the output ring with the @code{setring} command. In this ring, "USAGE:  annfs0(I, F [,eng]);  I an ideal, F a poly, eng an optional int RETURN:  ring PURPOSE: compute the annihilator ideal of f^s in the Weyl Algebra, based PURPOSE: compute the annihilator ideal of f^s in the Weyl Algebra, based @* on the output of Sannfs-like procedure NOTE:    activate the output ring with the @code{setring} command. In this ring, //   // returns a ring with the ideal LD in it //   def save = basering; //   // compute the Bernstein poly from gmssing.lib //   // compute the Bernstein polynomial from gmssing.lib //   list RL = ringlist(basering); //   // in the descr. of the ordering, replace "p" by "s" "USAGE:  annfspecial(I,F,mir,n);  I an ideal, F a poly, int mir, number n RETURN:  ideal PURPOSE: compute the annihilator ideal of F^n in the Weyl Algebra PURPOSE: compute the annihilator ideal of F^n in the Weyl Algebra @*           for the given rational number n ASSUME:  The basering is D[s] and contains 's' explicitly as a variable, @*   the integer 'mir' is the minimal integer root of the BS polynomial of F, @*   and the number n is rational. NOTE: We compute the real annihilator for any rational value of n (both @*       generic and exceptional). The implementation goes along the lines of @*       the Algorithm 5.3.15 from Saito-Sturmfels-Takayama. NOTE: We compute the real annihilator for any rational value of n (both @*       generic and exceptional). The implementation goes along the lines of @*       the Algorithm 5.3.15 from Saito-Sturmfels-Takayama. DISPLAY: If printlevel=1, progress debug messages will be printed, @*       if printlevel>=2, all the debug messages will be printed. // together with a global ordering ring r2  = 0,x,dp; poly f3   = 9*(x+2/3)*(x+1)*(x+4/3); //global b-poly of f1=x*y*(x+y) poly f3   = 9*(x+2/3)*(x+1)*(x+4/3); //global b-polynomial of f1=x*y*(x+y) ideal I3 = factorize(f3,1); I3; RETURN:  int ASSUME: Basering is a commutative ring, alpha is a rational number. PURPOSE: check whether a rational number alpha is a root of the global PURPOSE: check whether a rational number alpha is a root of the global @* Bernstein-Sato polynomial of f and compute its multiplicity, @* with the algorithm given by S and with the Groebner basis engine given by eng. NOTE:  The annihilator of f^s in D[s] is needed and hence it is computed with the NOTE:  The annihilator of f^s in D[s] is needed and hence it is computed with the @*       algorithm by Briancon and Maisonobe. The value of a string S can be @*       'alg1' (default) - for the algorithm 1 of [LM08] proc checkRoot2 (ideal I, poly F, number a, list #) "USAGE:  checkRoot2(I,f,a [,eng]);  I an ideal, f a poly, alpha a number, eng an optional int ASSUME:  I is the annihilator of f^s in D[s], basering is D[s], ASSUME:  I is the annihilator of f^s in D[s], basering is D[s], @* that is basering and I are the output os Sannfs-like procedure, @* f is a polynomial in K[_x] and alpha is a rational number. RETURN:  int, the multiplicity of -alpha as a root of the BS polynomial of f. RETURN:  int, the multiplicity of -alpha as a root of the BS polynomial of f. PURPOSE: check whether a rational number alpha is a root of the global Bernstein- @* Sato polynomial of f and compute its multiplicity from the known Ann F^s in D[s] { // to check: alpha is rational (has char 0 check inside) if (!isRational(a)) ASSUME:  checkFactor is called from the basering, created by Sannfs-like proc, @* that is, from the Weyl algebra in x1,..,xN,d1,..,dN tensored with K[s]. @* The ideal I is the annihilator of f^s in D[s], that is the ideal, computed @* The ideal I is the annihilator of f^s in D[s], that is the ideal, computed @* by Sannfs-like procedure (usually called LD there). @* Moreover, f is a polynomial in K[x1,..,xN] and qs is a polynomial in K[s]. RETURN:  int, 1 if qs is a factor of the global Bernstein polynomial of f and 0 otherwise PURPOSE: check whether a univariate polynomial qs is a factor of the PURPOSE: check whether a univariate polynomial qs is a factor of the @*  Bernstein-Sato polynomial of f without explicit knowledge of the latter. NOTE:    If eng <>0, @code{std} is used for Groebner basis computations, dbprint(ppl,"// -1-3- _x,_Dx are eliminated"); dbprint(ppl-1, K); //q is a factor of bs iff K = < q > //q is a factor of bs if and only if K = < q > //K = normalize(K); //q = normalize(q); "USAGE:  indAR(L,n);  list L, int n RETURN:  list PURPOSE: computes arrangement inductively, using L and PURPOSE: computes arrangement inductively, using L and @* var(n) as the next variable ASSUME: L has a structure of an arrangement proc isRational(number n) "USAGE:  isRational(n); n number "USAGE:  isRational(n); n number RETURN:  int PURPOSE: determine whether n is a rational number,
• ## Singular/LIB/dmodapp.lib

 r40c648 ////////////////////////////////////////////////////////////////////////////// version="$Id: dmodapp.lib,v 1.28 2009-04-14 11:52:54 Singular Exp$"; version="$Id: dmodapp.lib,v 1.29 2009-04-15 11:11:34 seelisch Exp$"; category="Noncommutative"; info=" @*             Daniel Andres, daniel.andres@math.rwth-aachen.de GUIDE: Let K be a field of characteristic 0, R = K[x1,..xN] and GUIDE: Let K be a field of characteristic 0, R = K[x1,..xN] and @* D be the Weyl algebra in variables x1,..xN,d1,..dN. @* In this library there are the following procedures for algebraic D-modules: @* - localization of a holonomic module D/I with respect to a mult. closed set @* of all powers of a given polynomial F from R. Our aim is to compute an @* ideal L in D, such that D/L is a presentation of a localized module. Such L @* always exists, since such localizations are known to be holonomic and thus @* of all powers of a given polynomial F from R. Our aim is to compute an @* ideal L in D, such that D/L is a presentation of a localized module. Such L @* always exists, since such localizations are known to be holonomic and thus @* cyclic modules. The procedures for the localization are DLoc,SDLoc and DLoc0. @* @* - annihilator in D of a given polynomial F from R as well as @* of a given rational function G/F from Quot(R). These can be computed via @* of a given rational function G/F from Quot(R). These can be computed via @* procedures annPoly resp. annRat. @* @* - initial form and initial ideals in Weyl algebras with respect to a given @* - initial form and initial ideals in Weyl algebras with respect to a given @* weight vector can be computed with  inForm, initialMalgrange, initialIdealW. @* @* - appelF1, appelF2 and appelF4 return ideals in parametric Weyl algebras, @* - appelF1, appelF2 and appelF4 return ideals in parametric Weyl algebras, @* which annihilate corresponding Appel hypergeometric functions. REFERENCES: @* (SST) Saito, Sturmfels, Takayama 'Groebner Deformations of Hypergeometric REFERENCES: @* (SST) Saito, Sturmfels, Takayama 'Groebner Deformations of Hypergeometric @*         Differential Equations', Springer, 2000 @* (ONW) Oaku, Takayama, Walther 'A Localization Algorithm for D-modules', 2000 appelF4();      create an ideal annihilating Appel F4 function engine(I,i);     computes a Groebner basis with the algorithm given by i poly2list(f);   decompose a poly to a list of terms and exponents poly2list(f);   decompose a polynomial into a list of terms and exponents fl2poly(L,s);  reconstruct a monic univariate polynomial from its factorization insertGenerator(id,p[,k]); insert an element into an ideal/module LIB "gkdim.lib"; // todo: complete and include into above list // charVariety(I);       compute the characteristic variety of the ideal I // charInfo(); ??? /////////////////////////////////////////////////////////////////////////////// // testing for consistency of the library: proc testdmodapp() { example initialIdealW; example initialMalgrange; example DLoc; example DLoc0; example SDLoc; example inForm; example isFsat; example annRat; example annPoly; example appelF1; example appelF2; example appelF4; example poly2list; example fl2poly; example insertGenerator; example deleteGenerator; example bFactor; } proc inForm (ideal I, intvec w) "USAGE:  inForm(I,w);  I ideal, w intvec RETURN:  the initial form of I wrt the weight vector w PURPOSE: computes the initial form of an ideal wrt a given weight vector RETURN:  the initial form of I w.r.t. the weight vector w PURPOSE: computes the initial form of an ideal w.r.t. a given weight vector NOTE:  the size of the weight vector must be equal to the number of variables @*     of the basering. "USAGE:  appelF1(); RETURN:  ring  (and exports an ideal into it) PURPOSE: define the ideal in a parametric Weyl algebra, PURPOSE: define the ideal in a parametric Weyl algebra, @* which annihilates Appel F1 hypergeometric function NOTE: the ideal called  IAppel1 is exported to the output ring "USAGE:  appelF2(); RETURN:  ring (and exports an ideal into it) PURPOSE: define the ideal in a parametric Weyl algebra, PURPOSE: define the ideal in a parametric Weyl algebra, @* which annihilates Appel F2 hypergeometric function NOTE: the ideal called  IAppel2 is exported to the output ring "USAGE:  appelF4(); RETURN:  ring  (and exports an ideal into it) PURPOSE: define the ideal in a parametric Weyl algebra, PURPOSE: define the ideal in a parametric Weyl algebra, @* which annihilates Appel F4 hypergeometric function NOTE: the ideal called  IAppel4 is exported to the output ring NOTE:    In the basering, the following objects are exported: @* the ideal LD0 (in Groebner basis) is the presentation of the localization @* the list BS contains roots with multiplicities of Bernstein poly of (D/I)_f. @* the list BS contains roots with multiplicities of Bernstein polynomial of (D/I)_f. DISPLAY: If printlevel=1, progress debug messages will be printed, @*       if printlevel>=2, all the debug messages will be printed. ERROR("Basering is not a Weyl algebra"); } if (defined(LD0) || defined(BS)) if (defined(LD0) || defined(BS)) { ERROR("Reserved names LD0 and/or BS are used. Please rename the objects."); "USAGE:  DLoc0(I, F);  I an ideal, F a poly RETURN:  ring PURPOSE: compute the presentation of the localization of D/I w.r.t. f^s, PURPOSE: compute the presentation of the localization of D/I w.r.t. f^s, @*           where D is a Weyl Algebra, based on the output of procedure SDLoc ASSUME: the basering is similar to the output ring of SDLoc procedure NOTE:    activate this ring with the @code{setring} command. In this ring, @* the ideal LD0 (in Groebner basis) is the presentation of the localization @* the list BS contains roots and multiplicities of Bernstein poly of (D/I)_f. @* the list BS contains roots and multiplicities of Bernstein polynomial of (D/I)_f. DISPLAY: If printlevel=1, progress debug messages will be printed, @*       if printlevel>=2, all the debug messages will be printed. gkdim(I); // 3 def W = SDLoc(I,F);  setring W; // creates ideal LD in W = R[s] def U = DLoc0(LD, x2-y3);  setring U; // compute in R def U = DLoc0(LD, x2-y3);  setring U; // compute in R LD0; // Groebner basis of the presentation of localization BS; // description of b-function for localization setring R; poly F = x2-y3; ideal I = Dx*F, Dy*F; ideal I = Dx*F, Dy*F; // note, that I is not holonomic, since it's dimension is not 2 gkdim(I); // 3, while dim R = 4 if (inp1 == "ideal") { ERROR("second argument has to be a poly if first argument is an ideal"); ERROR("second argument has to be a polynomial if first argument is an ideal"); } else { vector f = #[2]; } RETURN:  poly PURPOSE: reconstruct a monic polynomial in one variable from its factorization ASSUME:  s is a string with the name of some variable and ASSUME:  s is a string with the name of some variable and @*         L is supposed to consist of two entries: @*         L[1] of the type ideal with the roots of a polynomial proc initialIdealW (ideal I, intvec u, intvec v, list #) "USAGE:  initialIdealW(I,u,v [,s,t]);  I ideal, u,v intvecs, s,t optional ints RETURN:  ideal, GB of initial ideal of the input ideal wrt the weights u and v RETURN:  ideal, GB of initial ideal of the input ideal w.r.t. the weights u and v ASSUME:  The basering is the n-th Weyl algebra in characteristic 0 and  for all @*       1<=i<=n the identity var(i+n)*var(i)=var(i)*var(i+1)+1 holds, i.e. the @*       sequence of variables is given by x(1),...,x(n),D(1),...,D(n), @*       sequence of variables is given by x(1),...,x(n),D(1),...,D(n), @*       where D(i) is the differential operator belonging to x(i). PURPOSE: computes the initial ideal with respect to given weights. } } // 1. create  homogenized Weyl algebra // 1.1 create ordering "USAGE:  initialMalgrange(f,[,s,t,v]); f poly, s,t optional ints, v opt. intvec RETURN:  ring, the Weyl algebra induced by basering, extended by two new vars PURPOSE: computes the initial Malgrange ideal of a given poly wrt the weight PURPOSE: computes the initial Malgrange ideal of a given polynomial w.r.t. the weight @*       vector (-1,0...,0,1,0,...,0) such that the weight of t is -1 and the @*       weight of Dt is 1. { dbprint(ppl,"// found no roots"); } } L = list(II,mm); if (ir <> 1) L = L + list(string(ir)); } else else { dbprint(ppl,"// no irreducible factors found"); } } setring save; L = imap(@S,L); ring r = 0,(x,y),dp; bFactor((x^2-1)^2); bFactor((x^2+1)^2); bFactor((x^2+1)^2); bFactor((y^2+1/2)*(y+9)*(y-7)); }
• ## Singular/LIB/elim.lib

 r40c648 // $Id: elim.lib,v 1.30 2009-04-14 12:00:14 Singular Exp$ // $Id: elim.lib,v 1.31 2009-04-15 11:11:34 seelisch Exp$ // (GMG, modified 22.06.96) // GMG, last modified 30.10.08: new procedure elimRing; // and can now choose as method slimgb or std. /////////////////////////////////////////////////////////////////////////////// version="$Id: elim.lib,v 1.30 2009-04-14 12:00:14 Singular Exp$"; version="$Id: elim.lib,v 1.31 2009-04-15 11:11:34 seelisch Exp$"; category="Commutative Algebra"; info=" //------------------ set resp. compute ring weights ---------------------- int ii; intvec @w=1:nvarBR;     //to store weights of all variables intvec @w;              //to store weights of all variables @w[nvarBR] = 0; @w = @w + 1;            //initialize @w as 1..1 string str = "a";       //default for specifying elimination ordering if (size(#) == 0)       //default values @w = #[1];              //take the given weights str = #[2];             //string for specifying elimination ordering } if ( typeof(#[1]) == "string" and typeof(#[2]) == "intvec" ) { int local = (var(ii) < 1); } } } else //define now the first a-block of the form a(w1,0..0) intvec @v=0:nvarBR; intvec @v; @v[nvarBR] = 0; @v = @v+w1; B3[1] = list("a", @v); @*      If the variables in the basering have weights these weights are used in elimRing. If a string \"withWeigts\" as (optional) argument is given Singular computes weights for the variables to make the input as @sc{Singular} computes weights for the variables to make the input as homogeneous as possible. @*      The method is different from that used by eliminate and elim1;
• ## Singular/LIB/equising.lib

 r40c648 version="$Id: equising.lib,v 1.19 2008-10-06 17:34:18 Singular Exp$"; version="$Id: equising.lib,v 1.20 2009-04-15 11:11:35 seelisch Exp$"; category="Singularities"; info=" l[1]=ESSring is a ring extension of basering containing the ideal ES (describing the ES-stratum), the ideal ES_all_triv (describing the part with trival equimultiple sections) and the poly p_F=F, part with trival equimultiple sections) and the polynomial p_F=F, l[2]=1 if some error has occured,  l[2]=0 otherwise. @end format
• ## Singular/LIB/findifs.lib

 r40c648 /////////////////////////////////////////////////////////////////////////////// version="$Id: findifs.lib,v 1.6 2009-04-06 17:43:33 motsak Exp$"; version="$Id: findifs.lib,v 1.7 2009-04-15 11:11:35 seelisch Exp$"; category="Applications"; info=" PROCEDURES: decoef(P,n);  decompose poly P into summands with respect to the number n decoef(P,n);  decompose polynomial P into summands with respect to the number n difpoly2tex(S,P[,Q]); present the difference scheme in the nodal form "USAGE:  decoef(P,n);  P a poly, n a number RETURN:  ideal PURPOSE:  decompose poly P into summands with respect PURPOSE:  decompose polynomial P into summands with respect to the  presence of a number n in the coefficients NOTE:    n is usually a parameter with no power EXAMPLE: example decoef; shows examples "{ // decomposes poly into summands // wrt the presence of a number n in coeffs // decomposes polynomial into summands // w.r.t. the presence of a number n in coeffs // returns ideal def br = basering; poly   p = S[4,1]; // by elimination of module components list L; L[1]=A;L[2] = B; ideal I = decoef(p,dt); // make splitting wrt the appearance of dt ideal I = decoef(p,dt); // make splitting w.r.t. the appearance of dt "* Create the nodal of the scheme in TeX format: "; " ideal I = decoef(p,dt);";
• ## Singular/LIB/freegb.lib

 r40c648 ////////////////////////////////////////////////////////////////////////////// version="$Id: freegb.lib,v 1.23 2009-04-14 12:08:36 Singular Exp$"; version="$Id: freegb.lib,v 1.24 2009-04-15 11:13:09 seelisch Exp$"; category="Noncommutative"; info=" AUTHOR: Viktor Levandovskyy,     levandov@math.rwth-aachen.de THEORY: See chapter 'LETTERPLACE' in the Singular Manual. THEORY: See chapter 'LETTERPLACE' in the @sc{Singular} Manual. PROCEDURES: PURPOSE: sets attributes for a letterplace ring: @*      'isLetterplaceRing' = true, 'uptodeg' = d, 'lV' = b, where @*      'uptodeg' stands for the degree bound, @*      'uptodeg' stands for the degree bound, @*      'lV' for the number of variables in the block 0. NOTE: Activate the resulting ring by using @code{setring} // Set letterplace-specific attributes for the output ring! attrib(R, "uptodeg", uptodeg); attrib(R, "lV", lV); attrib(R, "isLetterplaceRing", 1); return (R); attrib(R, "lV", lV); attrib(R, "isLetterplaceRing", 1); return (R); } example { // FINALLY IMPLEMENTED AS A PART OT THE CODE // shifts a poly from the ring @R to s positions // shifts a polynomial from the ring R to s positions // M lives in varing, the result in lpring // to be run from varing "USAGE:  isVar(p);  poly p RETURN:  int PURPOSE: check, whether leading monomial of p is a power of a single variable PURPOSE: check, whether leading monomial of p is a power of a single variable @* from the basering. Returns the exponent or 0 if p is multivariate. EXAMPLE: example isVar; shows examples def R = makeLetterplaceRing(d); setring R; int uptodeg = d; int lV = 2; int uptodeg = d; int lV = 2; def R = setLetterplaceAttributes(r,uptodeg,2); // supply R with letterplace structure setring R; static proc strList2poly(list L) { //  list L comes from sent2lplace (which takes a poly on the input) //  list L comes from sent2lplace (which takes a polynomial as input) // each entry of L is a sublist with the coef on the last place int s = size(L); int t;
• ## Singular/LIB/general.lib

 r40c648 //eric, added absValue 11.04.2002 /////////////////////////////////////////////////////////////////////////////// version="$Id: general.lib,v 1.60 2009-04-07 09:30:44 seelisch Exp$"; version="$Id: general.lib,v 1.61 2009-04-15 11:14:16 seelisch Exp$"; category="General purpose"; info=" polynomials have to be put into eval(...) in order to be interpreted correctly * a second Singular process is started by this procedure * a second @sc{Singular} process is started by this procedure EXAMPLE: example watchdog; shows an example "
• ## Singular/LIB/hnoether.lib

 r40c648 version="$Id: hnoether.lib,v 1.58 2008-09-24 07:54:59 Singular Exp$"; version="$Id: hnoether.lib,v 1.59 2009-04-15 11:14:36 seelisch Exp$"; // (GMG, last modified 08.06.08: comments to Newton non-degenerate added) /////////////////////////////////////////////////////////////////////////////// puiseux2generators(m,n);   convert Puiseux pairs to generators of semigroup separateHNE(hne1,hne2);    number of quadratic transf. needed for separation squarefree(f);             a squarefree divisor of the poly f allsquarefree(f,l);        the maximal squarefree divisor of the poly f squarefree(f);             a squarefree divisor of the polynomial f allsquarefree(f,l);        the maximal squarefree divisor of the polynomial f further_hn_proc();         show further procedures useful for interactive use T1_Transform(f,d,M); returns f(x,y+d*x^M)  (f: poly,d:number,M:int) T2_Transform(f,d,M,N,ref);   a composition of T1 & T koeff(f,I,J);       gets coefficient of indicated monomial of poly f koeff(f,I,J);       gets coefficient of indicated monomial of polynomial f redleit(f,S,E);     restriction of monomials of f to line (S-E) leit(f,n,m);        special case of redleit (for irred. polynomials) //       static procedures not useful for interactive use: // polytest(f);        tests coefficients and exponents of poly f // polytest(f);        tests coefficients and exponents of polynomial f // extractHNEs(H,t);   extracts output H of HN to output of hnexpansion // HN(f,grenze);       recursive subroutine for hnexpansion kill zweitring; nm = getnm(f);             // N,M haben sich evtl. veraendert N = nm[1]; M = nm[2];      // Berechne Schnittpunkte Newtonpoly mit Achsen N = nm[1]; M = nm[2];      // Berechne Schnittpunkte Newtonpolynom mit Achsen if (defined(HNDebugOn)) {"I continue with the polynomial",f; } } f=test_sqr; nm = getnm(f);              // N,M haben sich veraendert N = nm[1]; M = nm[2];       // Berechne Schnittpunkte Newtonpoly mit Achsen N = nm[1]; M = nm[2];       // Berechne Schnittpunkte Newtonpolynom mit Achsen if (defined(HNDebugOn)) {"I continue with the polynomial",f; } } } if (defined(HNDebugOn)) { if (getauscht) {"x<->y were exchanged; poly is now ",f;} if (getauscht) {"x<->y were exchanged; polynomial is now ",f;} else           {"x , y were not exchanged";} "M resp. N are now",M,N; " { // INPUT = poly or ring // INPUT = polynomial or ring if (typeof(#[1])=="poly") { list L=hnexpansion(#[1]); NOTE:    The main purpose is that if the line defined by S and E is part of the Newton polygon, the result is the quasihomogeneous leading form of f wrt. that line. w.r.t. that line. SEE ALSO: newtonpoly EXAMPLE: example redleit;  shows an example If the computation of the HNE required a field extension, the first entry @code{L[1]} of the list is a ring, in which a list @code{hne} of lists (the HN data, as above) and a poly @code{f} (image of of lists (the HN data, as above) and a polynomial @code{f} (image of @code{f} over the new field) are stored. @* } else { HNEs[1]=list(hqs)+azeilen+list(fneu); // fneu ist transform. Poly oder Null HNEs[1]=list(hqs)+azeilen+list(fneu); // fneu ist transform. Polynom oder Null conj1[1]=conj_factor; }
• ## Singular/LIB/inout.lib

 r40c648 // (GMG/BM, last modified 22.06.96) /////////////////////////////////////////////////////////////////////////////// version="$Id: inout.lib,v 1.33 2009-04-07 09:30:44 seelisch Exp$"; version="$Id: inout.lib,v 1.34 2009-04-15 11:14:36 seelisch Exp$"; category="General purpose"; info=" lprint(poly/...[,n]);  display poly/... fitting to pagewidth [size n] pmat(matrix[,n]);      print form-matrix [first n chars of each colum] rMacaulay(string);     read Macaulay_1 output and return its Singular format rMacaulay(string);     read Macaulay_1 output and return its @sc{Singular} format show(any);             display any object in a compact format showrecursive(id,p);   display id recursively with respect to variables in p RETURN:  no return value NOTE:    The syntax of writelist is similar to the syntax of the write command of Singular which does not manage lists properly. write command of @sc{Singular} which does not manage lists properly. If (file,name) = (\"listfile\",\"L1\"),  writelist creates (resp. appends if listfile exists) a file with name listfile and stores there the list L under the name L1. The Singular command execute(read(\"listfile\")); assigns the content of L (stored in there the list L under the name L1. The @sc{Singular} command @code{execute(read(\"listfile\"))}; assigns the content of L (stored in listfile) to a list L1. @*       On a UNIX system, write(\">file\",...) overwrites an existing file
• ## Singular/LIB/involut.lib

 r40c648 version="$Id: involut.lib,v 1.17 2009-04-14 08:26:08 Singular Exp$"; version="$Id: involut.lib,v 1.18 2009-04-15 11:14:36 seelisch Exp$"; category="Noncommutative"; info=" static proc In_Poly(poly mm, list l, int NVars) // applies the involution to the poly mm // applies the involution to the polynomial mm // entries of a list l are images of variables under invo // more general than invo_poly; used in many rings setting static proc Hom_Poly(poly mm, list l, int NVars) // applies the endomorphism to the poly mm // applies the endomorphism to the polynomial mm // entries of a list l are images of variables under endo // should not be replaced by map-based stuff! used in
• ## Singular/LIB/kskernel.lib

 r40c648 //////////////////////////////////////////////////////////////// version="$Id: kskernel.lib,v 1.3 2007-06-20 15:30:11 Singular Exp$"; version="$Id: kskernel.lib,v 1.4 2009-04-15 11:14:36 seelisch Exp$"; category="General purpose"; info=" // M is a sorted matrix of triples {i,j,k(i,j)} // returns a list of coefficients of p // wrt. the base {x^i y^j,(i,j) in (M[i,j,k])}=B_u // w.r.t. the base {x^i y^j,(i,j) in (M[i,j,k])}=B_u proc MonoDec(poly p, matrix M) { RETURN:  nothing; but replaces elements of the matrix KSkernel in the ring Ksring with their leading monomials wrt. the local ordering (ls) w.r.t. the local ordering (ls) EXAMPLE: example KSlinear; shows an example "
• ## Singular/LIB/latex.lib

 r40c648 /////////////////////////////////////////////////////////////////////////////// version="$Id: latex.lib,v 1.34 2009-04-14 17:23:25 Singular Exp$"; version="$Id: latex.lib,v 1.35 2009-04-15 11:14:36 seelisch Exp$"; category="Visualization"; info=" tex(fnm)            calls LaTeX2e for LaTeX-file fnm texdemo([n])        produces a file explaining the features of this lib texfactorize(fnm,f) creates string in LaTeX-format for factors of poly f texfactorize(fnm,f) creates string in LaTeX-format for factors of polynomial f texmap(fnm,m,r1,r2) creates string in LaTeX-format for map m:r1->r2 texname(fnm,s)      creates string in LaTeX-format for identifier \"(\" + int + \",\" + s' + \")\" --> \"_@{\"+ int +\"@}\" + \"^@{\" + s'+\"@}\" @end example Furthermore, strings which begin with a left brace are modified Furthermore, strings which begin with a @code{\"@{\"} are modified by deleting the first and the last character (which is then assumed to be a right brace). be a @code{\"@}\"}}. if @code{fname!=\"\"}: append the transformed string s to the file proc texpoly(string fname,def p,list #) "USAGE:   texpoly(fname,p); fname string, p poly RETURN:  if @code{fname=\"\"}: string, the poly p in LaTeX-typesetting;@* RETURN:  if @code{fname=\"\"}: string, the polynomial p in LaTeX-typesetting;@* otherwise: append this string to the file @code{}, and return nothing. { " -- Call  texmap  instead "; return();} if (typeof(p)  == "link" or typeof(p) == "list" or typeof(p) == "resolution") { " -- Object can not translated into tex "; return();} { " -- Object cannot translated into tex "; return();} if (!(defined(TeXdisplay))){ lnbreak = "\\\\[2mm]" + newline;} "\\\\" +  nl + "{\\tt  texfactorize(fnm,f);} & creates string in \\LaTeX-format for factors of poly f"+ "\\\\" +  nl + factors of polynomial f"+ "\\\\" +  nl + "{\\tt  texmap(fnm,m,r1,r2);} & creates string in \\LaTeX-format for map m:r1$\\rightarrow$r2"+ "\\\\" +  nl + // write(fname,"\\Line"); // -1b------ still in the same ring, a poly with rational coefs -------- // -1b------ still in the same ring, a polynomial with rational coefs -------- write(fname, " A polynomial with rational coefficients.
• ## Singular/LIB/linalg.lib

 r40c648 //GMG last modified: 04/25/2000 ////////////////////////////////////////////////////////////////////////////// version="$Id: linalg.lib,v 1.40 2009-04-07 16:18:05 seelisch Exp$"; version="$Id: linalg.lib,v 1.41 2009-04-15 11:27:06 seelisch Exp$"; category="Linear Algebra"; info=" } //var can not be in A //var cannot be in A s="Wp("; for( i=1; i<=nvars(BR); i++ ){
• ## Singular/LIB/modstd.lib

 r40c648 //GP, last modified 23.10.06 /////////////////////////////////////////////////////////////////////////////// version="$Id: modstd.lib,v 1.14 2007-07-20 10:02:38 Singular Exp$"; version="$Id: modstd.lib,v 1.15 2009-04-15 11:14:36 seelisch Exp$"; category="Commutative Algebra"; info=" } //================= delete unlucky primes ==================== // unlucky iff the leading ideal is wrong // unlucky if and only if the leading ideal is wrong list LL=deleteUnluckyPrimes(T,L); T=LL[1]; } //================= delete unlucky primes ==================== // unlucky iff the leading ideal is wrong // unlucky if and only if the leading ideal is wrong list LL=deleteUnluckyPrimes(T,L); T=LL[1];
• ## Singular/LIB/ncalg.lib

 r40c648 /////////////////////////////////////////////////////////////////////////////// version="$Id: ncalg.lib,v 1.33 2009-04-15 08:17:58 Singular Exp$"; version="$Id: ncalg.lib,v 1.34 2009-04-15 11:28:08 seelisch Exp$"; category="Noncommutative"; info=" ASSUME: This procedure uses toric_lib and therefore inherits its input requirements: @*        possible values for input variable @code{alg} are: \"ect\",\"pt\",\"blr\", \"hs\", \"du\". @*        As for the term ordering, it should be a string @code{sord} in Singular format like \"lp\",\"dp\", etc. @*        As for the term ordering, it should be a string @code{sord} in @sc{Singular} format like \"lp\",\"dp\", etc. @*        Please consult the toric_lib for allowed orderings and more details. SEE ALSO: toric_lib
• ## Singular/LIB/nctools.lib

 r40c648 /////////////////////////////////////////////////////////////////////////////// version="$Id: nctools.lib,v 1.51 2009-04-14 13:31:39 Singular Exp$"; version="$Id: nctools.lib,v 1.52 2009-04-15 11:18:07 seelisch Exp$"; category="Noncommutative"; info=" // internal documentation, for tests etc // 1st arg: v an optional integer (if v!=0, will be verbose) // if the second argument is given, produces ndc wrt powers x^N // if the second argument is given, produces ndc w.r.t. powers x^N int N = 1; int Verbose = 0; } /////////////////////////////////////////////////////////////////////////////// { print("Warning: Since the current ordering is not global there might be problems computing twostd(Q)!"); "Q:"; "Q:"; @Q; }
• ## Singular/LIB/normal.lib

 r40c648 /////////////////////////////////////////////////////////////////////////////// version="$Id: normal.lib,v 1.52 2009-04-10 13:34:00 Singular Exp$"; version="$Id: normal.lib,v 1.53 2009-04-15 11:15:56 seelisch Exp$"; category="Commutative Algebra"; info=" genus(I);           computes the geometric genus of a projective curve primeClosure(L);    integral closure of R/p, p a prime ideal closureFrac(L);     write a poly in integral closure as element of Quot(R/p) closureFrac(L);     write a polynomial in integral closure as element of Quot(R/p) iMult(L);           intersection multiplicity of the ideals of the list L ideal Ann = quotient(SM[2],SL[1]); ideal qAnn = simplify(reduce(Ann,SM[1]),2); //NOTE: qAnn=0 iff first var (=SL[1]) not in SM is a nzd of R/SM //NOTE: qAnn=0 if and only if first var (=SL[1]) not in SM is a nzd of R/SM //------------- We found a non-zerodivisor of R/SM ----------------------- proc closureFrac(list L) "USAGE:    closureFrac (L); L a list of size n+1 as in the result of primeClosure, L[n] contains an additional poly f primeClosure, L[n] contains an additional polynomial f CREATE:   a list fraction of two elements of L[1], such that f=fraction[1]/fraction[2] via the injections phi L[i]-->L[i+1]. J = fetch(R, J); J = interred(J); poly D = getSmallest(J);    // Chooses the poly of smallest degree as poly D = getSmallest(J);    // Chooses the polynomial of smallest degree as // non-zerodivisor. if(dbg >= 1){ // and the others as parameters. // The degree is taken wrt the variables indicated in v. // The degree is taken w.r.t. the variables indicated in v. int i;      // Counter int d = 0;  // The degree THEORY:  The procedure can be used to test whether the computation of the normalization was correct: basering/i --> nor[1][1]/norid is the normalization of basering/i iff v=1,1,0. normalization of basering/i if and only if v=1,1,0. NOTE:    For big examples it can be hard to fully test correctness; the partial test norTest(i,nor,2) is usually fast //### make a copy of nor to have a cpoy of nor[1][1]  (not a reference to) // in order not to overwrite norid and normap. // in order not to override norid and normap. // delete nor[2] (if it contains the module generators, which are not used) // s.t. newnor does not belong to a ring.
• ## Singular/LIB/poly.lib

 r40c648 /////////////////////////////////////////////////////////////////////////////// version="$Id: poly.lib,v 1.52 2009-04-07 09:30:44 seelisch Exp$"; version="$Id: poly.lib,v 1.53 2009-04-15 11:19:50 seelisch Exp$"; category="General purpose"; info=" mindeg1(poly/...);     int = [weighted] minimal degree of input normalize(poly/...);   normalize poly/... such that leading coefficient is 1 rad_con(p,I);          check radical containment of poly p in ideal I rad_con(p,I);          check radical containment of polynomial p in ideal I content(f);            content of polynomial/vector f numerator(n);          numerator of number n
• ## Singular/LIB/polymake.lib

 r40c648 version="$Id: polymake.lib,v 1.16 2009-04-15 08:08:58 Singular Exp$"; version="$Id: polymake.lib,v 1.17 2009-04-15 11:26:29 seelisch Exp$"; category="Tropical Geometry"; info=" LIBRARY:   polymake.lib    Computations with polytopes and fans, LIBRARY:   polymake.lib    Computations with polytopes and fans, interface to polymake and TOPCOM AUTHOR:    Thomas Markwig,  email: keilen@mathematik.uni-kl.de WARNING: Most procedures will not work unless polymake or topcom is installed and if so, they will only work with the operating system LINUX! if so, they will only work with the operating system LINUX! For more detailed information see the following note or consult the help string of the procedures. NOTE: Even though this is a Singular library for computing polytopes and fans such as the Newton polytope or the Groebner fan of a polynomial, most of the hard computations are NOT done by Singular but by the program Even though this is a @sc{Singular} library for computing polytopes and fans such as the Newton polytope or the Groebner fan of a polynomial, most of the hard computations are NOT done by @sc{Singular} but by the program @* - polymake by Ewgenij Gawrilow, TU Berlin and Michael Joswig, TU Darmstadt @*   (see http://www.math.tu-berlin.de/polymake/), @*   (see http://www.math.tu-berlin.de/polymake/), @* respectively (only in the procedure triangularions) by the program @* - topcom by Joerg Rambau, Universitaet Bayreuth (see http://www.uni-bayreuth.de/ departments/wirtschaftsmathematik/rambau/TOPCOM); @*   This library should rather be seen as an interface which allows to use a (very limited) number of options which polymake respectively topcom offers to compute with polytopes and fans and to make the results available in Singular for further computations; moreover, the user familiar with Singular does not have to learn the syntax of polymake or topcom, if the options offered here are sufficient for his (very limited) number of options which polymake respectively topcom offers to compute with polytopes and fans and to make the results available in @sc{Singular} for further computations; moreover, the user familiar with @sc{Singular} does not have to learn the syntax of polymake or topcom, if the options offered here are sufficient for his purposes. @*   Note, though, that the procedures concerned with planar polygons are @*   Note, though, that the procedures concerned with planar polygons are independent of both, polymake and topcom. proc polymakePolytope (intmat polytope,list #) "USAGE:  polymakePolytope(polytope[,#]);   polytope list, # string ASSUME:  each row of polytope gives the coordinates of a lattice point of a polytope with their affine coordinates as given by the output of ASSUME:  each row of polytope gives the coordinates of a lattice point of a polytope with their affine coordinates as given by the output of secondaryPolytope PURPOSE: the procedure calls polymake to compute the vertices of the polytope PURPOSE: the procedure calls polymake to compute the vertices of the polytope as well as its dimension and information on its facets RETURN:  list L with four entries @*            L[1] : an integer matrix whose rows are the coordinates of vertices of the polytope of the polytope @*            L[2] : the dimension of the polytope @*            L[3] : a list whose i-th entry explains to which vertices the ith vertex of the Newton polytope is connected -- i.e. L[3][i] is an integer vector and an entry k in there means that the vertex L[1][i] is connected to the ith vertex of the Newton polytope is connected -- i.e. L[3][i] is an integer vector and an entry k in there means that the vertex L[1][i] is connected to the vertex L[1][k] @*            L[4] : an integer matrix whose rows mulitplied by (1,var(1),...,var(nvar)) give a linear system of equations @*            L[4] : an integer matrix whose rows mulitplied by (1,var(1),...,var(nvar)) give a linear system of equations describing the affine hull of the polytope, i.e. the smallest affine space containing the polytope NOTE: -  for its computations the procedure calls the program polymake by Ewgenij Gawrilow, TU Berlin and Michael Joswig, TU Darmstadt; it therefore is necessary that this program is installed in order NOTE: -  for its computations the procedure calls the program polymake by Ewgenij Gawrilow, TU Berlin and Michael Joswig, TU Darmstadt; it therefore is necessary that this program is installed in order to use this procedure; see http://www.math.tu-berlin.de/polymake/ @*    -  note that in the vertex edge graph we have changed the polymake convention which starts indexing its vertices by zero while we start @*    -  note that in the vertex edge graph we have changed the polymake convention which starts indexing its vertices by zero while we start with one ! @*    -  the procedure creates the file  /tmp/polytope.polymake which contains the polytope in polymake format; if you wish to use this for further computations with polymake, you have to use the procedure @*    -  the procedure creates the file  /tmp/polytope.polymake which contains the polytope in polymake format; if you wish to use this for further computations with polymake, you have to use the procedure polymakeKeepTmpFiles in before @*    -  moreover, the procedure creates the file /tmp/polytope.output which it deletes again before ending @*    -  it is possible to provide an optional second argument a string which then will be used instead of 'polytope' in the name of the which then will be used instead of 'polytope' in the name of the polymake output file EXAMPLE: example polymakePolytope;   shows an example" } } } } newveg=newveg[1,size(newveg)-1]; execute("list nveg="+newveg+";"); "EXAMPLE:"; echo=2; // the lattice points of the unit square in the plane // the lattice points of the unit square in the plane list points=intvec(0,0),intvec(0,1),intvec(1,0),intvec(1,1); // the secondary polytope of this lattice point configuration is computed of the Newton polytope of f @*            L[2] : the dimension of the Newton polytope of f @*            L[3] : a list whose ith entry explains to which vertices the ith vertex of the Newton polytope is connected -- i.e. L[3][i] is an integer vector and an entry k in @*            L[3] : a list whose ith entry explains to which vertices the ith vertex of the Newton polytope is connected -- i.e. L[3][i] is an integer vector and an entry k in there means that the vertex L[1][i] is connected to the vertex L[1][k] @*            L[4] : an integer matrix whose rows mulitplied by (1,var(1),...,var(nvar)) give a linear system of equations @*            L[4] : an integer matrix whose rows mulitplied by (1,var(1),...,var(nvar)) give a linear system of equations describing the affine hull of the Newton polytope, i.e. the smallest affine space containing the Newton polytope NOTE: -  if we replace the first column of L[4] by zeros, i.e. if we move the affine hull to the origin, then we get the equations for the orthogonal comploment of the linearity space of the normal fan dual NOTE: -  if we replace the first column of L[4] by zeros, i.e. if we move the affine hull to the origin, then we get the equations for the orthogonal comploment of the linearity space of the normal fan dual to the Newton polytope, i.e. we get the EQUATIONS that we need as input for polymake when computing the normal fan TU Berlin and Michael Joswig, so it only works if polymake is installed; see http://www.math.tu-berlin.de/polymake/ @*    -  the procedure creates the file  /tmp/newtonPolytope.polymake which contains the polytope in polymake format and which can be used for @*    -  the procedure creates the file  /tmp/newtonPolytope.polymake which contains the polytope in polymake format and which can be used for further computations with polymake @*    -  moreover, the procedure creates the file /tmp/newtonPolytope.output @*    -  moreover, the procedure creates the file /tmp/newtonPolytope.output and deletes it again before ending @*    -  it is possible to give as an optional second argument a string which then will be used instead of 'newtonPolytope' in the name of @*    -  it is possible to give as an optional second argument a string which then will be used instead of 'newtonPolytope' in the name of the polymake output file EXAMPLE: example newtonPolytope;   shows an example" { int i,j; // compute the list of exponent vectors of the polynomial, // compute the list of exponent vectors of the polynomial, // which are the lattice points // whose convex hull is the Newton polytope of f np[2]; // np[3] contains information how the vertices are connected to each other, // e.g. the first vertex (number 0) is connected to the second, third and // e.g. the first vertex (number 0) is connected to the second, third and //      fourth vertex np[3][1]; np[1]; // its dimension is np[2]; // the Newton polytope is contained in the affine space given np[2]; // the Newton polytope is contained in the affine space given //     by the equations np[4]*M; proc newtonPolytopeLP (poly f) "USAGE:  newtonPolytopeLP(f);  f poly RETURN: list, the exponent vectors of the monomials occuring in f, RETURN: list, the exponent vectors of the monomials occuring in f, i.e. the lattice points of the Newton polytope of f EXAMPLE: example normalFan;   shows an example" proc normalFan (intmat vertices,intmat affinehull,list graph,int er,list #) "USAGE:  normalFan (vert,aff,graph,rays,[,#]);   vert,aff intmat,  graph list, rays int, # string ASSUME:  - vert is an integer matrix whose rows are the coordinate of the vertices of a convex lattice polytope; ASSUME:  - vert is an integer matrix whose rows are the coordinate of the vertices of a convex lattice polytope; @*       - aff describes the affine hull of this polytope, i.e. the smallest affine space containing it, in the following sense: denote by n the number of columns of vert, then multiply aff by (1,x(1),...,x(n)) and set the resulting terms to zero in order to the smallest affine space containing it, in the following sense: denote by n the number of columns of vert, then multiply aff by (1,x(1),...,x(n)) and set the resulting terms to zero in order to get the equations for the affine hull; @*       - the ith entry of graph is an integer vector describing to which vertices the ith vertex is connected, i.e. a k as entry means that @*       - the ith entry of graph is an integer vector describing to which vertices the ith vertex is connected, i.e. a k as entry means that the vertex vert[i] is connected to vert[k]; @*       - the integer rays is either one (if the extreme rays should be @*       - the integer rays is either one (if the extreme rays should be computed) or zero (otherwise) RETURN:  list, the ith entry of L[1] contains information about the cone in the normal fan dual to the ith vertex of the polytope @*             L[1][i][1] = integer matrix representing the inequalities which RETURN:  list, the ith entry of L[1] contains information about the cone in the normal fan dual to the ith vertex of the polytope @*             L[1][i][1] = integer matrix representing the inequalities which describe the cone dual to the ith vertex @*             L[1][i][2] = a list which contains the inequalities represented by L[i][1] as a list of strings, where we use the @*             L[1][i][2] = a list which contains the inequalities represented by L[i][1] as a list of strings, where we use the variables x(1),...,x(n) @*             L[1][i][3] = only present if 'er' is set to 1; in that case it is an interger matrix whose rows are the extreme rays an interger matrix whose rows are the extreme rays of the cone @*             L[2] = is an integer matrix whose rows span the linearity space of the fan, i.e. the linear space which is contained in @*             L[2] = is an integer matrix whose rows span the linearity space of the fan, i.e. the linear space which is contained in each cone NOTE:    - the procedure calls for its computation polymake by Ewgenij Gawrilow, TU Berlin and Michael Joswig, so it only works if polymake is TU Berlin and Michael Joswig, so it only works if polymake is installed; see http://www.math.tu-berlin.de/polymake/ @*       - in the optional argument # it is possible to hand over other names @*       - in the optional argument # it is possible to hand over other names for the variables to be used -- be careful, the format must be correct which is not tested, e.g. if you want the variable names to be list ineq; // stores the inequalities of the cones int i,j,k; // we work over the following ring // we work over the following ring execute("ring ineqring=0,x(1.."+string(ncols(vertices))+"),lp;"); string greatersign=">"; for (i=1;i<=nrows(vertices);i++) { // first we produce for each vertex in the polytope // first we produce for each vertex in the polytope // the inequalities describing the dual cone in the normal fan list pp;  // contain strings representing the inequalities list pp;  // contain strings representing the inequalities // describing the normal cone intmat ie[size(graph[i])][ncols(vertices)]; // contains the inequalities intmat ie[size(graph[i])][ncols(vertices)]; // contains the inequalities // as rows // consider all the vertices to which the ith vertex in the // consider all the vertices to which the ith vertex in the // polytope is connected by an edge for (j=1;j<=size(graph[i]);j++) { // produce the vector ie_j pointing from the jth vertex to the ith vertex; // this will be the jth inequality for the cone in the normal fan dual to // this will be the jth inequality for the cone in the normal fan dual to // the ith vertex ie[j,1..ncols(vertices)]=vertices[i,1..ncols(vertices)]-vertices[graph[i][j],1..ncols(vertices)]; p=(VAR*EXP)[1,1]; pl,pr=0,0; // separate the terms with positive coefficients in p from // separate the terms with positive coefficients in p from // those with negative coefficients for (k=1;k<=size(p);k++) } } // build the string which represents the jth inequality // build the string which represents the jth inequality // for the cone dual to the ith vertex // as polynomial inequality of type string, and store this // as polynomial inequality of type string, and store this // in the list pp as jth entry pp[j]=string(pl)+" "+greatersign+" "+string(pr); // create the file ineq.output write(":w /tmp/ineq.output",""); int dimension; // keeps the dimension of the intersection the int dimension; // keeps the dimension of the intersection the // bad cones with the u11tobeseencone for (i=1;i<=size(ineq);i++) { i,". Cone of ",nrows(vertices); // indicate how many i,". Cone of ",nrows(vertices); // indicate how many // vertices have been dealt with ungleichungen=intmatToPolymake(ineq[i][1],"rays"); } // get the linearity space return(list(ineq,linearity)); return(list(ineq,linearity)); } example proc groebnerFan (poly f,list #) "USAGE:  groebnerFan(f[,#]);  f poly, # string RETURN:  list, the ith entry of L[1] contains information about the ith cone in the Groebner fan dual to the ith vertex in the Newton RETURN:  list, the ith entry of L[1] contains information about the ith cone in the Groebner fan dual to the ith vertex in the Newton polytope of the f @*             L[1][i][1] = integer matrix representing the inequalities which describe the cone @*             L[1][i][2] = a list which contains the inequalities represented @*             L[1][i][1] = integer matrix representing the inequalities which describe the cone @*             L[1][i][2] = a list which contains the inequalities represented by L[1][i][1] as a list of strings @*             L[1][i][3] = an interger matrix whose rows are the extreme rays @*             L[1][i][3] = an interger matrix whose rows are the extreme rays of the cone @*             L[2] = is an integer matrix whose rows span the linearity space of the fan, i.e. the linear space which is contained in each cone @*             L[3] = the Newton polytope of f in the format of the procedure @*             L[2] = is an integer matrix whose rows span the linearity space of the fan, i.e. the linear space which is contained in each cone @*             L[3] = the Newton polytope of f in the format of the procedure newtonPolytope @*             L[4] = integer matrix where each row represents the exponet @*             L[4] = integer matrix where each row represents the exponet vector of one monomial occuring in the input polynomial NOTE: - if you have already computed the Newton polytope of f then you might want to use the procedure normalFan instead in order to avoid doing costly to use the procedure normalFan instead in order to avoid doing costly computation twice @*    - the procedure calls for its computation polymake by Ewgenij Gawrilow, TU Berlin and Michael Joswig, so it only works if polymake is installed; see http://www.math.tu-berlin.de/polymake/ @*    - the procedure creates the file  /tmp/newtonPolytope.polymake which contains the Newton polytope of f in polymake format and which can @*    - the procedure creates the file  /tmp/newtonPolytope.polymake which contains the Newton polytope of f in polymake format and which can be used for further computations with polymake @*    - it is possible to give as an optional second argument as string which then will be used instead of 'newtonPolytope' in the name of the @*    - it is possible to give as an optional second argument as string which then will be used instead of 'newtonPolytope' in the name of the polymake output file EXAMPLE: example groebnerFan;   shows an example" { int i,j; // compute the list of exponent vectors of the polynomial, which are // compute the list of exponent vectors of the polynomial, which are // the lattice points whose convex hull is the Newton polytope of f intmat exponents[size(f)][nvars(basering)]; proc intmatToPolymake (intmat M,string art) "USAGE:  intmatToPolymake(M,art);  M intmat, art string ASSUME:  - M is an integer matrix which should be transformed into polymake ASSUME:  - M is an integer matrix which should be transformed into polymake format; @*       - art is one of the following strings: @*           + 'rays'   : indicating that a first column of 0's should be added @*           + 'points' : indicating that a first column of 1's should be added RETURN:  string, the matrix is transformed in a string and a first column has @*           + 'points' : indicating that a first column of 1's should be added RETURN:  string, the matrix is transformed in a string and a first column has been added EXAMPLE: example intmatToPolymake;   shows an example" string anf="0 "; } else else { string anf="1 "; proc polymakeToIntmat (string pm,string art) "USAGE:  polymakeToIntmat(pm,art);  pm, art string ASSUME:  pm is the result of calling polymake with one 'argument' like VERTICES, AFFINE_HULL, etc., so that the first row of the string is the name of the corresponding 'argument' and the further rows contain ASSUME:  pm is the result of calling polymake with one 'argument' like VERTICES, AFFINE_HULL, etc., so that the first row of the string is the name of the corresponding 'argument' and the further rows contain the result which consists of vectors either over the integers or over the rationals from the second row, where each row has been multiplied with the lowest common multiple of the denominators of its entries as if it is an integer matrix; moreover, if art=='affine', then the first column is omitted since we only want affine it is an integer matrix; moreover, if art=='affine', then the first column is omitted since we only want affine coordinates EXAMPLE: example polymakeToIntmat;   shows an example" pm=stringdelete(pm,1); } pm=stringdelete(pm,1); // find out how many entries each vector has, namely one more pm=stringdelete(pm,1); // find out how many entries each vector has, namely one more // than 'spaces' in a row int i=1; // if we want to have affine coordinates if (art=="affine") { { s--; // then there is one column less // and the entry of the first column (in the first row) has to be removed pm=stringdelete(pm,1); } // we add two line breaks at the end in order to have this as // we add two line breaks at the end in order to have this as // a stopping criterion pm=pm+zeilenumbruch+zeilenumbruch; z++; pm[i]=","; // if we want to have affine coordinates, // if we want to have affine coordinates, // then we have to delete the first entry in each row if (art=="affine") if (pm[i]==" ") { pm[i]=","; pm[i]=","; } } pm=stringdelete(pm,size(pm)); } // since the matrix could be over the rationals, // since the matrix could be over the rationals, // we need a ring with rational coefficients ring zwischering=0,x,lp; ring zwischering=0,x,lp; // create the matrix with the elements of pm as entries execute("matrix mm["+string(z)+"]["+string(s)+"]="+pm+";"); proc triangulations (list polygon) "USAGE:  triangulations(polygon); list polygon ASSUME:  polygon is a list of integer vectors of the same size representing the affine coordinates of the lattice points ASSUME:  polygon is a list of integer vectors of the same size representing the affine coordinates of the lattice points PURPOSE: the procedure considers the marked polytope given as the convex hull of the lattice points and with these lattice points as markings; it then computes all possible triangulations of this marked polytope computes all possible triangulations of this marked polytope RETURN:  list, each entry corresponds to one triangulation and the ith entry is itself a list of integer vectors of size three, where each integer NOTE:- the procedure calls for its computations the program points2triangs from the program topcom by Joerg Rambau, Universitaet Bayreuth; it therefore is necessary that this program is installed in order to use therefore is necessary that this program is installed in order to use this  procedure; see @*     http://www.uni-bayreuth.de/departments/wirtschaftsmathematik/rambau/TOPCOM @*   - the procedure creates the files /tmp/triangulationsinput and @*   - the procedure creates the files /tmp/triangulationsinput and /tmp/triangulationsoutput; the former is used as input for points2triangs and the latter is its output containing the triangulations of corresponding to points in the format of points2triangs; if you wish to use this for further computations with topcom, you have to use the procedure the former is used as input for points2triangs and the latter is its output containing the triangulations of corresponding to points in the format of points2triangs; if you wish to use this for further computations with topcom, you have to use the procedure polymakeKeepTmpFiles in before @*   - note that an integer i in an integer vector representing a triangle refers to the ith lattice point, i.e. polygon[i]; this convention is different from TOPCOM's convention, where i would refer to the i-1st @*   - note that an integer i in an integer vector representing a triangle refers to the ith lattice point, i.e. polygon[i]; this convention is different from TOPCOM's convention, where i would refer to the i-1st lattice point EXAMPLE: example triangulations;   shows an example" { int i,j; // prepare the input for points2triangs by writing the input polygon in the // prepare the input for points2triangs by writing the input polygon in the // necessary format string spi="["; system("sh","cd /tmp; rm -f triangulationsinput; rm -f triangulationsoutput"); } // preprocessing of p2t if points2triangs is version >= 0.15 // preprocessing of p2t if points2triangs is version >= 0.15 // brings p2t to the format of version 0.14 string np2t; // takes the triangulations in Singular format } else { { np2t=np2t+p2t[i]; } { if (np2t[size(np2t)]!=";") { { np2t=np2t+p2t[size(p2t)-1]+p2t[size(p2t)]; } np2t=np2t+"))"; i++; } } else { "EXAMPLE:"; echo=2; // the lattice points of the unit square in the plane // the lattice points of the unit square in the plane list polygon=intvec(0,0),intvec(0,1),intvec(1,0),intvec(1,1); // the triangulations of this lattice point configuration are computed int i,j,k,l; intmat N[2][2]; // is used to compute areas of triangles intvec vertex;  // stores a point in the secondary polytope as intvec vertex;  // stores a point in the secondary polytope as // intermediate result int eintrag; int halt; intmat secpoly[size(triangs)][size(polygon)];   // stores all lattice points intmat secpoly[size(triangs)][size(polygon)];   // stores all lattice points // of the secondary polytope // consider each triangulation and compute the corresponding point // consider each triangulation and compute the corresponding point // in the secondary polytope for (i=1;i<=size(triangs);i++) { // for each triangulation we have to compute the coordinates // for each triangulation we have to compute the coordinates // corresponding to each marked point for (j=1;j<=size(polygon);j++) { eintrag=0; // for each marked point we have to consider all triangles in the // for each marked point we have to consider all triangles in the // triangulation which involve this particular point for (k=1;k<=size(triangs[i]);k++) secpoly[i,1..size(polygon)]=vertex; } return(list(secpoly,triangs)); return(list(secpoly,triangs)); } example proc secondaryFan (list polygon,list #) "USAGE:  secondaryFan(polygon[,#]); list polygon, list # ASSUME:  - polygon is a list of integer vectors of the same size representing ASSUME:  - polygon is a list of integer vectors of the same size representing the affine coordinates of lattice points @*       - if the triangulations of the corresponding polygon have already been computed with the procedure triangulations then these can be given as a second (optional) argument in order to avoid doing this @*       - if the triangulations of the corresponding polygon have already been computed with the procedure triangulations then these can be given as a second (optional) argument in order to avoid doing this computation again PURPOSE: the procedure considers the marked polytope given as the convex hull of the lattice points and with these lattice points as markings; it then computes the lattice points of the secondary polytope given by this computes the lattice points of the secondary polytope given by this marked polytope which correspond to the triangulations computed by the procedure triangulations RETURN:  list, the ith entry of L[1] contains information about the ith cone in the secondary fan of the polygon, i.e. the cone dual to the RETURN:  list, the ith entry of L[1] contains information about the ith cone in the secondary fan of the polygon, i.e. the cone dual to the ith vertex of the secondary polytope @*             L[1][i][1] = integer matrix representing the inequalities which @*             L[1][i][1] = integer matrix representing the inequalities which describe the cone dual to the ith vertex @*             L[1][i][2] = a list which contains the inequalities represented @*             L[1][i][2] = a list which contains the inequalities represented by L[1][i][1] as a list of strings, where we use the variables x(1),...,x(n) @*             L[1][i][3] = only present if 'er' is set to 1; in that case it is an interger matrix whose rows are the extreme rays an interger matrix whose rows are the extreme rays of the cone @*             L[2] = is an integer matrix whose rows span the linearity space of the fan, i.e. the linear space which is contained in @*             L[2] = is an integer matrix whose rows span the linearity space of the fan, i.e. the linear space which is contained in each cone @*             L[3] = the secondary polytope in the format of the procedure @*             L[3] = the secondary polytope in the format of the procedure polymakePolytope @*             L[4] = the list of triangulations corresponding to the vertices @*             L[4] = the list of triangulations corresponding to the vertices of the secondary polytope NOTE:- the procedure calls for its computation polymake by Ewgenij Gawrilow, TU Berlin and Michael Joswig, so it only works if polymake is installed; see http://www.math.tu-berlin.de/polymake/ @*   - in the optional argument # it is possible to hand over other names for @*   - in the optional argument # it is possible to hand over other names for the variables to be used -- be careful, the format must be correct which is not tested, e.g. if you want the variable names to be u00,u10,u01,u11 then you must hand over the string 'u11,u10,u01,u11' @*   - if the triangluations are not handed over as optional argument the procedure calls for its computation of these triangulations the program points2triangs from the program topcom by Joerg Rambau, Universitaet Bayreuth; it therefore is necessary that this program is installed in @*   - if the triangluations are not handed over as optional argument the procedure calls for its computation of these triangulations the program points2triangs from the program topcom by Joerg Rambau, Universitaet Bayreuth; it therefore is necessary that this program is installed in order to use this procedure; see @*     http://www.uni-bayreuth.de/departments/wirtschaftsmathematik/rambau/TOPCOM proc cycleLength (list boundary,intvec interior) "USAGE:  cycleLength(boundary,interior); list boundary, intvec interior ASSUME:  boundary is a list of integer vectors describing a cycle in some convex lattice polygon around the lattice point interior ordered ASSUME:  boundary is a list of integer vectors describing a cycle in some convex lattice polygon around the lattice point interior ordered clock wise RETURN:  string, the cycle length of the corresponding cycle in the dual { int j; // create a ring whose variables are indexed by the points in // create a ring whose variables are indexed by the points in // boundary resp. by interior string rst="ring cyclering=0,(u"+string(interior[1])+string(interior[2]); // interior is a lattice point in the interior of this lattice polygon intvec interior=1,1; // compute the general cycle length of a cycle of the corresponding cycle // compute the general cycle length of a cycle of the corresponding cycle // in the dual tropical curve, note that (0,1) and (2,1) do not contribute cycleLength(boundary,interior); proc splitPolygon (list markings) "USAGE:  splitPolygon (markings);  markings list ASSUME:  markings is a list of integer vectors representing lattice points in the plane which we consider as the marked points of the convex lattice ASSUME:  markings is a list of integer vectors representing lattice points in the plane which we consider as the marked points of the convex lattice polytope spanned by them PURPOSE: split the marked points in the vertices, the points on the facets PURPOSE: split the marked points in the vertices, the points on the facets which are not vertices, and the interior points RETURN:  list, L consisting of three lists @*                       L[1][i][1] = intvec, the coordinates of the ith vertex @*                       L[1][i][2] = int, the position of L[1][i][1] in markings @*             L[2][i] : represents the lattice points on the facet of the polygon with endpoints L[1][i] and L[1][i+1] @*             L[2][i] : represents the lattice points on the facet of the polygon with endpoints L[1][i] and L[1][i+1] (i considered modulo size(L[1])) @*                       L[2][i][j][1] = intvec, the coordinates of the jth @*                       L[2][i][j][1] = intvec, the coordinates of the jth lattice point on that facet @*                       L[2][i][j][2] = int, the position of L[2][i][j][1] @*                       L[2][i][j][2] = int, the position of L[2][i][j][1] in markings @*             L[3]    : represents the interior lattice points of the polygon @*             L[3]    : represents the interior lattice points of the polygon @*                       L[3][i][1] = intvec, coordinates of ith interior point @*                       L[3][i][2] = int, the position of L[3][i][1] in markings vert[1]=pb[2]; int i,j,k;      // indices list boundary;  // stores the points on the facets of the list boundary;  // stores the points on the facets of the // polygon which are not vertices // append to the boundary points as well as to the vertices // append to the boundary points as well as to the vertices // the first vertex a second time pb[1]=pb[1]+list(pb[1][1]); // store the information on the boundary in vert[2] vert[2]=boundary; // find the remaining points in the input which are not on // find the remaining points in the input which are not on // the boundary by checking // for each point in markings if it is contained in pb[1] // store the interior points in vert[3] vert[3]=interior; // add to each point in vert the index which it gets from // add to each point in vert the index which it gets from // its position in the input markings; // do so for ver[1] } vert[3][i]=list(vert[3][i],j); } } return(vert); } "EXAMPLE:"; echo=2; // the lattice polygon spanned by the points (0,0), (3,0) and (0,3) // the lattice polygon spanned by the points (0,0), (3,0) and (0,3) // with all integer points as markings list polygon=intvec(1,1),intvec(3,0),intvec(2,0),intvec(1,0), proc eta (list triang,list polygon) "USAGE:  eta(triang,polygon);  triang, polygon list ASSUME:  polygon has the format of the output of splitPolygon, i.e. it is a list with three entries describing a convex lattice polygon in the ASSUME:  polygon has the format of the output of splitPolygon, i.e. it is a list with three entries describing a convex lattice polygon in the following way: @*       polygon[1] : is a list of lists; for each i the entry polygon[1][i][1] is a lattice point which is a vertex of the lattice @*       polygon[1] : is a list of lists; for each i the entry polygon[1][i][1] is a lattice point which is a vertex of the lattice polygon, and polygon[1][i][2] is an integer assigned to this lattice point as identifying index @*       polygon[2] : is a list of lists; for each vertex of the polygon, i.e. for each entry in polygon[1], it contains a list polygon[2][i], which contains the lattice points on the facet with endpoints polygon[1][i] and polygon[1][i+1] @*       polygon[2] : is a list of lists; for each vertex of the polygon, i.e. for each entry in polygon[1], it contains a list polygon[2][i], which contains the lattice points on the facet with endpoints polygon[1][i] and polygon[1][i+1] - i considered mod size(polygon[1]); each such lattice point contributes an entry each such lattice point contributes an entry polygon[2][i][j][1] which is an integer vector giving the coordinate of the lattice point and an vector giving the coordinate of the lattice point and an entry polygon[2][i][j][2] which is the identifying index @*       polygon[3] : is a list of lists, where each entry corresponds to a lattice point in the interior of the polygon, with @*       polygon[3] : is a list of lists, where each entry corresponds to a lattice point in the interior of the polygon, with polygon[3][j][1] being the coordinates of the point and polygon[3][j][2] being the identifying index; @*       triang is a list of integer vectors all of size three describing a triangulation of the polygon described by polygon; if an entry of @*       triang is a list of integer vectors all of size three describing a triangulation of the polygon described by polygon; if an entry of triang is the vector (i,j,k) then the triangle is built from the vertices with indices i, j and k RETURN:  intvec, the integer vector eta describing that vertex of the Newton polytope discriminant of the polygone whose dual cone in the Groebner fan contains the cone of the secondary fan of the RETURN:  intvec, the integer vector eta describing that vertex of the Newton polytope discriminant of the polygone whose dual cone in the Groebner fan contains the cone of the secondary fan of the polygon corresponding to the given triangulation NOTE:  for a better description of eta see Gelfand, Kapranov, NOTE:  for a better description of eta see Gelfand, Kapranov, Zelevinski: Discriminants, Resultants and multidimensional Determinants. Chapter 10. { int i,j,k,l,m,n; // index variables list ordpolygon;   // stores the lattice points in the order list ordpolygon;   // stores the lattice points in the order // used in the triangulation list triangarea; // stores the areas of the triangulations for (i=1;i<=size(triang);i++) { // Note that the ith lattice point in orderedpolygon has the // Note that the ith lattice point in orderedpolygon has the // number i-1 in the triangulation! N=ordpolygon[triang[i][1]]-ordpolygon[triang[i][2]],ordpolygon[triang[i][1]]-ordpolygon[triang[i][3]]; } intvec ETA;        // stores the eta_ij int etaij;         // stores the part of eta_ij during computations int etaij;         // stores the part of eta_ij during computations // which comes from triangle areas int seitenlaenge;  // stores the part of eta_ij during computations int seitenlaenge;  // stores the part of eta_ij during computations // which comes from boundary facets list seiten;       // stores the lattice points on facets of the polygon intvec v;          // used to compute a facet length // 3) store first in seiten[i] all lattice points on the facet // 3) store first in seiten[i] all lattice points on the facet //    connecting the ith vertex, //    i.e. polygon[1][i], with the i+1st vertex, i.e. polygon[1][i+1], //    i.e. polygon[1][i], with the i+1st vertex, i.e. polygon[1][i+1], //    where we replace i+1 //    1 if i=size(polygon[1]); //    then append the last entry of seiten once more at the very //    then append the last entry of seiten once more at the very //    beginning of seiten, so //    that the index is shifted by one if ((polygon[1][j][2]==triang[k][1]) or (polygon[1][j][2]==triang[k][2]) or (polygon[1][j][2]==triang[k][3])) { // ... if so, add the area of the triangle to etaij // ... if so, add the area of the triangle to etaij etaij=etaij+triangarea[k]; // then check if that triangle has a facet which is contained // in one of the // then check if that triangle has a facet which is contained // in one of the // two facets of the polygon which are adjecent to the given vertex ... // these two facets are seiten[j] and seiten[j+1] if ((seiten[n][l][2]==triang[k][m]) and (seiten[n][l][2]!=polygon[1][j][2])) { // if so, then compute the vector pointing from this // if so, then compute the vector pointing from this // lattice point to the vertex v=polygon[1][j][1]-seiten[n][l][1]; // and the lattice length of this vector has to be // and the lattice length of this vector has to be // subtracted from etaij etaij=etaij-abs(gcd(v[1],v[2])); ETA[polygon[1][j][2]]=etaij; } // 5) compute the eta_ij for all lattice points on the facets // 5) compute the eta_ij for all lattice points on the facets //    of the polygon which are not vertices, these are the //    lattice points in polygon[2][1] to polygon[2][size(polygon[1])] { for (j=1;j<=size(polygon[2][i]);j++) { { // initialise etaij etaij=0; 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])) { // ... if so, add the area of the triangle to etaij // ... if so, add the area of the triangle to etaij etaij=etaij+triangarea[k]; // then check if that triangle has a facet which is contained in the // then check if that triangle has a facet which is contained in the // facet of the polygon which contains the lattice point in question, // this is the facet seiten[i+1]; // ... and for each lattice point in the triangle ... for (m=1;m<=size(triang[k]);m++) { { // ... if they coincide and are not the vertex itself ... if ((seiten[i+1][l][2]==triang[k][m]) and (seiten[i+1][l][2]!=polygon[2][i][j][2])) { // if so, then compute the vector pointing from // if so, then compute the vector pointing from // this lattice point to the vertex v=polygon[2][i][j][1]-seiten[i+1][l][1]; // and the lattice length of this vector contributes // and the lattice length of this vector contributes // to seitenlaenge seitenlaenge=seitenlaenge+abs(gcd(v[1],v[2])); } } // if the lattice point was a vertex of any triangle // if the lattice point was a vertex of any triangle // in the triangulation ... if (etaij!=0) if ((polygon[3][j][2]==triang[k][1]) or (polygon[3][j][2]==triang[k][2]) or (polygon[3][j][2]==triang[k][3])) { // ... if so, add the area of the triangle to etaij // ... if so, add the area of the triangle to etaij etaij=etaij+triangarea[k]; } "EXAMPLE:"; echo=2; // the lattice polygon spanned by the points (0,0), (3,0) and (0,3) // the lattice polygon spanned by the points (0,0), (3,0) and (0,3) // with all integer points as markings list polygon=intvec(1,1),intvec(3,0),intvec(2,0),intvec(1,0), // split the polygon in its vertices, its facets and its interior points list sp=splitPolygon(polygon); // define a triangulation by connecting the only interior point // define a triangulation by connecting the only interior point //        with the vertices list triang=intvec(1,2,5),intvec(1,5,10),intvec(1,5,10); eta(triang,sp); } ///////////////////////////////////////////////////////////////////////////// } // check is the polygon is only a line segment given by more than two points; // for this first compute sum of the absolute values of the determinants // for this first compute sum of the absolute values of the determinants // of the matrices whose // rows are the vectors pointing from the first to the second point // rows are the vectors pointing from the first to the second point // and from the // the first point to the ith point for i=3,...,size(polygon); // the first point to the ith point for i=3,...,size(polygon); // if this sum is zero // then the polygon is a line segment and we have to find its end points intmat laenge[size(polygon)][size(polygon)]; intvec mp; //   for this collect first all vectors pointing from one lattice //   for this collect first all vectors pointing from one lattice //   point to the next, //   compute their pairwise angles and their lengths for (i=1;i<=size(polygon)-1;i++) { { for (j=i+1;j<=size(polygon);j++) { polygon=sortlistbyintvec(polygon,abstand); return(list(polygon,endpoints)); } } /////////////////////////////////////////////////////////////// list orderedvertices;  // stores the vertices in an ordered way list minimisedorderedvertices;  // stores the vertices in an ordered way; list minimisedorderedvertices;  // stores the vertices in an ordered way; // redundant ones removed list comparevertices; // stores vertices which should be compared to list comparevertices; // stores vertices which should be compared to // the testvertex orderedvertices[1]=polygon[1]; // set the starting vertex minimisedorderedvertices[1]=polygon[1]; // set the starting vertex intvec testvertex=polygon[1];  //vertex to which the others have to be compared intvec startvertex=polygon[1]; // keep the starting vertex to test, intvec startvertex=polygon[1]; // keep the starting vertex to test, // when the end is reached int endtest;                   // is set to one, when the end is reached int startvertexfound;// is 1, once for some testvertex a candidate // for the next vertex has been found int startvertexfound;// is 1, once for some testvertex a candidate // for the next vertex has been found polygon=delete(polygon,1);    // delete the testvertex intvec v,w; int l=1;  // counts the vertices // the basic idea is that a vertex can be // the basic idea is that a vertex can be // the next one on the boundary if all other vertices // lie to the right of the vector v pointing // lie to the right of the vector v pointing // from the testvertex to this one; this can be tested // by checking if the determinant of the 2x2-matrix // by checking if the determinant of the 2x2-matrix // with first column v and second column the vector w, // pointing from the testvertex to the new vertex, // pointing from the testvertex to the new vertex, // is non-positive; if this is the case for all // new vertices, then the one in consideration is // new vertices, then the one in consideration is // a possible choice for the next vertex on the boundary // and it is stored in naechste; we can then order // and it is stored in naechste; we can then order // the candidates according to their distance from // the testvertex; then they occur on the boundary in that order! v=polygon[i]-testvertex; // points from the testvertex to the ith vertex comparevertices=delete(polygon,i); // we needn't compare v to itself // we should compare v to the startvertex-testvertex; // we should compare v to the startvertex-testvertex; // in the first calling of the loop // this is irrelevant since the difference will be zero; // this is irrelevant since the difference will be zero; // however, later on it will // be vital, since we delete the vertices // be vital, since we delete the vertices // which we have already tested from the list // of all vertices, and when all vertices // of all vertices, and when all vertices // on the boundary have been found we would // therefore find a vertex in the interior // therefore find a vertex in the interior // as candidate; but always testing against // the starting vertex, this can not happen comparevertices[size(comparevertices)+1]=startvertex; // the starting vertex, this cannot happen comparevertices[size(comparevertices)+1]=startvertex; for (j=1;(j<=size(comparevertices)) and (d<=0);j++) { d=det(D); } if (d<=0) // if all determinants are non-positive, if (d<=0) // if all determinants are non-positive, { // then the ith vertex is a candidate naechste[k]=list(polygon[i],i,scalarproduct(v,v));// we store the vertex, } if (size(naechste)>0) // then a candidate for the next vertex has been found { { startvertexfound=1; // at least once a candidate has been found naechste=sortlist(naechste,3);  // we order the candidates according naechste=sortlist(naechste,3);  // we order the candidates according // to their distance from testvertex; for (j=1;j<=size(naechste);j++) // then we store them in this for (j=1;j<=size(naechste);j++) // then we store them in this { // order in orderedvertices l++; orderedvertices[l]=naechste[j][1]; } testvertex=naechste[size(naechste)][1];  // we store the last one as testvertex=naechste[size(naechste)][1];  // we store the last one as // next testvertex; // store the next corner of NSD minimisedorderedvertices[size(minimisedorderedvertices)+1]=testvertex; naechste=sortlist(naechste,2); // then we reorder the vertices minimisedorderedvertices[size(minimisedorderedvertices)+1]=testvertex; naechste=sortlist(naechste,2); // then we reorder the vertices // according to their position for (j=size(naechste);j>=1;j--) // and we delete them from the vertices } } else // that means either that the vertex was inside the polygon, {    // or that we have reached the last vertex on the boundary else // that means either that the vertex was inside the polygon, {    // or that we have reached the last vertex on the boundary // of the polytope if (startvertexfound==0) // the vertex was in the interior; if (startvertexfound==0) // the vertex was in the interior; { // we delete it and start all over again orderedvertices[1]=polygon[1]; minimisedorderedvertices[1]=polygon[1]; orderedvertices[1]=polygon[1]; minimisedorderedvertices[1]=polygon[1]; testvertex=polygon[1]; startvertex=polygon[1]; polygon=delete(polygon,1); } else // we have reached the last vertex on the boundary of else // we have reached the last vertex on the boundary of { // the polytope and can stop endtest=1; kill naechste; } // test if the first vertex in minimisedorderedvertices // test if the first vertex in minimisedorderedvertices // is on the same line with the second and // the last, i.e. if we started our search in the // the last, i.e. if we started our search in the // middle of a face; if so, delete it v=minimisedorderedvertices[2]-minimisedorderedvertices[1]; minimisedorderedvertices=delete(minimisedorderedvertices,1); } // test if the first vertex in minimisedorderedvertices // test if the first vertex in minimisedorderedvertices // is on the same line with the two // last ones, i.e. if we started our search at the end of a face; // last ones, i.e. if we started our search at the end of a face; // if so, delete it v=minimisedorderedvertices[size(minimisedorderedvertices)-1]-minimisedorderedvertices[1]; proc cyclePoints (list triang,list points,int pt) "USAGE:      cyclePoints(triang,points,pt)  triang,points list, pt int ASSUME:      - points is a list of integer vectors describing the lattice ASSUME:      - points is a list of integer vectors describing the lattice points of a marked polygon; @*           - triang is a list of integer vectors describing a triangulation of the marked polygon in the sense that an integer vector of the form (i,j,k) describes the triangle formed by polygon[i], @*           - triang is a list of integer vectors describing a triangulation of the marked polygon in the sense that an integer vector of the form (i,j,k) describes the triangle formed by polygon[i], polygon[j] and polygon[k]; @*           - pt is an integer between 1 and size(points), singling out a @*           - pt is an integer between 1 and size(points), singling out a lattice point among the marked points PURPOSE:     consider the convex lattice polygon, say P, spanned by all lattice points in points which in the triangulation triang are connected to the point points[pt]; the procedure computes all marked points PURPOSE:     consider the convex lattice polygon, say P, spanned by all lattice points in points which in the triangulation triang are connected to the point points[pt]; the procedure computes all marked points in points which lie on the boundary of that polygon, ordered clockwise RETURN:      list, of integer vectors which are the coordinates of the lattice points on the boundary of the above mentioned polygon P, if this polygon is not the empty set (that would be the case if points[pt] is not a vertex of any triangle in the RETURN:      list, of integer vectors which are the coordinates of the lattice points on the boundary of the above mentioned polygon P, if this polygon is not the empty set (that would be the case if points[pt] is not a vertex of any triangle in the triangulation); otherwise return the empty list EXAMPLE:     example cyclePoints;   shows an example" { int i,j; // indices list v;  // saves the indices of lattice points connected to the list v;  // saves the indices of lattice points connected to the // interior point in the triangulation // save all points in triangulations containing pt in v pts[i]=points[v[i]]; } // consider the convex polytope spanned by the points in pts, // consider the convex polytope spanned by the points in pts, // find the points on the // boundary and order them clockwise "EXAMPLE:"; echo=2; // the lattice polygon spanned by the points (0,0), (3,0) and (0,3) // the lattice polygon spanned by the points (0,0), (3,0) and (0,3) // with all integer points as markings list points=intvec(1,1),intvec(3,0),intvec(2,0),intvec(1,0), intvec(0,0),intvec(2,1),intvec(0,1),intvec(1,2), intvec(0,2),intvec(0,3); // define a triangulation // define a triangulation list triang=intvec(1,2,5),intvec(1,5,7),intvec(1,7,9),intvec(8,9,10), intvec(1,8,9),intvec(1,2,8); "USAGE:  latticeArea(polygon);   polygon list ASSUME:  polygon is a list of integer vectors in the plane RETURN:  int, the lattice area of the convex hull of the lattice points in RETURN:  int, the lattice area of the convex hull of the lattice points in polygon, i.e. twice the Euclidean area EXAMPLE: example polygonlatticeArea;   shows an example" proc picksFormula (list polygon) "USAGE:  picksFormula(polygon);   polygon list ASSUME:  polygon is a list of integer vectors in the plane and consider their convex hull C RETURN:  list, L of three integersthe ASSUME:  polygon is a list of integer vectors in the plane and consider their convex hull C RETURN:  list, L of three integersthe @*             L[1] : the lattice area of C, i.e. twice the Euclidean area @*             L[2] : the number of lattice points on the boundary of C bdpts=bdpts+abs(gcd(edge[1],edge[2])); } // Pick's formula says that the lattice area A, the number g of interior // Pick's formula says that the lattice area A, the number g of interior // points and // the number b of boundary points are connected by the formula: A=b+2g-2 "USAGE:  ellipticNF(polygon);   polygon list ASSUME:  polygon is a list of integer vectors in the plane such that their convex hull C has precisely one interior lattice point, i.e. C is the convex hull C has precisely one interior lattice point, i.e. C is the Newton polygon of an elliptic curve PURPOSE: compute the normal form of the polygon with respect to the unimodular PURPOSE: compute the normal form of the polygon with respect to the unimodular affine transformations T=A*x+v; there are sixteen different normal forms (see e.g. Bjorn Poonen, Fernando Rodriguez-Villegas: Lattice Polygons and the number 12.  Amer. Math. Monthly  107  (2000),  no. 3, (see e.g. Bjorn Poonen, Fernando Rodriguez-Villegas: Lattice Polygons and the number 12.  Amer. Math. Monthly  107  (2000),  no. 3, 238--250.) RETURN:  list, L such that @*             L[1] : list whose entries are the vertices of the normal form of @*             L[1] : list whose entries are the vertices of the normal form of the polygon @*             L[2] : the matrix A of the unimodular transformation @*             L[3] : the translation vector v of the unimodular transformation @*             L[4] : list such that the ith entry is the image of polygon[i] @*             L[4] : list such that the ith entry is the image of polygon[i] under the unimodular transformation T EXAMPLE: example ellipticNF;   shows an example" intvec trans;    // stores the vector by which we have to translate the polygon intmat A[2][2];  // stores the matrix by which we have to transform the polygon matrix M[3][3];  // stores the projective coordinates of the points matrix M[3][3];  // stores the projective coordinates of the points // which are to be transformed matrix N[3][3];  // stores the projective coordinates of the points to matrix N[3][3];  // stores the projective coordinates of the points to // which M is to be transformed intmat T[3][3];  // stores the unimodular affine transformation in intmat T[3][3];  // stores the unimodular affine transformation in // projective form // add the second point of pg once again at the end pg=insert(pg,pg[2],size(pg)); // if there is only one edge which has the maximal number of lattice points, // if there is only one edge which has the maximal number of lattice points, // then M should be: M=pg[max],1,pg[max+1],1,pg[max+2],1; M=pg[max],1,pg[max+1],1,pg[max+2],1; // the orientation of the polygon matters A=pg[max-1]-pg[max],pg[max+1]-pg[max]; A=pg[max-1]-pg[max],pg[max+1]-pg[max]; if (det(A)==4) { { max++; } } M=pg[max],1,pg[max+1],1,pg[max+2],1; N=0,1,1,1,2,1,2,1,1; // the vertices of the normal form are nf[1]; // it has been transformed by the unimodular affine transformation A*x+v // it has been transformed by the unimodular affine transformation A*x+v // with matrix A nf[2]; "USAGE:  ellipticNFDB(n[,#]);   n int, # list ASSUME:  n is an integer between 1 and 16 PURPOSE: this is a database storing the 16 normal forms of planar polygons with PURPOSE: this is a database storing the 16 normal forms of planar polygons with precisely one interior point up to unimodular affine transformations @*       (see e.g. Bjorn Poonen, Fernando Rodriguez-Villegas: Lattice Polygons @*       (see e.g. Bjorn Poonen, Fernando Rodriguez-Villegas: Lattice Polygons and the number 12.  Amer. Math. Monthly  107  (2000),  no. 3, 238--250.) RETURN:  list, L such that @*             L[1] : list whose entries are the vertices of the nth normal form @*             L[2] : list whose entries are all the lattice points of the nth normal form @*             L[3] : only present if the optional parameter # is present, and then it is a polynomial in the variables (x,y) whose @*             L[1] : list whose entries are the vertices of the nth normal form @*             L[2] : list whose entries are all the lattice points of the nth normal form @*             L[3] : only present if the optional parameter # is present, and then it is a polynomial in the variables (x,y) whose Newton polygon is the nth normal form NOTE:    the optional parameter is only allowed if the basering has the NOTE:    the optional parameter is only allowed if the basering has the variables x and y EXAMPLE: example ellipticNFDB;   shows an example" proc polymakeKeepTmpFiles (int i) "USAGE:  polymakeKeepTmpFiles(int i);   i int PURPOSE: some procedures create files in the directory /tmp which are used for PURPOSE: some procedures create files in the directory /tmp which are used for computations with polymake respectively topcom; these will be removed when the corresponding procedure is left; however, it might be when the corresponding procedure is left; however, it might be desireable to keep them for further computations with either polymake or topcom; this can be achieved by this procedure; call the procedure as: static proc scalarproduct (intvec w,intvec v) "USAGE:      scalarproduct(w,v); w,v intvec ASSUME:      w and v are integer vectors of the same length ASSUME:      w and v are integer vectors of the same length RETURN:      int, the scalarproduct of v and w NOTE:        the procedure is called by findOrientedBoundary" { int m=nrows(M); } else { return(""); } if (i==1) k++; } else else { stop=1; k++; } else else { stop=1; static proc polygonToCoordinates (list points) "USAGE:      polygonToCoordinates(points);   points list ASSUME:      points is a list of integer vectors each of size two describing the marked points of a convex lattice polygon like the output of ASSUME:      points is a list of integer vectors each of size two describing the marked points of a convex lattice polygon like the output of polygonDB RETURN:      list, the first entry is a string representing the coordinates RETURN:      list, the first entry is a string representing the coordinates corresponding to the latticpoints seperated by commata the second entry is a list where the ith entry is a string representing the coordinate of corresponding to the ith lattice point the third entry is the latex format of the the second entry is a list where the ith entry is a string representing the coordinate of corresponding to the ith lattice point the third entry is the latex format of the first entry NOTE:        the procedure is called by fan"
• ## Singular/LIB/presolve.lib

 r40c648 /////////////////////////////////////////////////////////////////////////////// version="$Id: presolve.lib,v 1.30 2009-04-14 12:00:14 Singular Exp$"; version="$Id: presolve.lib,v 1.31 2009-04-15 11:18:27 seelisch Exp$"; category="Symbolic-numerical solving"; info=" if ( size(#)!=0 ) {  n=#[1]; } ideal maxi,rest = maxideal(1),0; if ( n < nvars(BAS) ) { rest = maxi[n+1..nvars(BAS)]; if ( n < nvars(BAS) ) { rest = maxi[n+1..nvars(BAS)]; } attrib(rest,"isSB",1); // which do not contain elements not to be eliminated //ideal id = interred(i); //## gmg, gendert 9/2008: interred sehr lange z.B. bei Leonard1 in normal, //ideal id = interred(i); //## gmg, gendert 9/2008: interred sehr lange z.B. bei Leonard1 in normal, //daher interred ersetzt durch: std nur auf linearpart angewendet //Ordnung muss global sein, sonst egal (da Lin affin linear) //--------------- replace ordering by dp if it is not global ----------------- if ( ord_test(BAS) <= 0 ) { intvec V; { intvec V; V[n]=0; V=V+1;                          //weights for dp ordering gnirlist[3] = list("dp",V), g32; ideal i = imap(BAS,i); } list  Lin = linearpart(i); ideal lin = std(Lin[1]);          //SB of ideal generated by polys of i //------------- check for special case of unit ideal and return --------------- int check; if( lin[1] == 1 ) { check = 1; } else if( lin[1] == 1 ) { check = 1; } else { for (ii=1; ii<=size(id); ii++ ) { if ( id[ii] == 1 ) { { check = 1; break; } } //-------- direct substitution of variables if possible and if e!=0 ----------- // first find terms lin1 in lin of pure degree 1 in each poly of lin // first find terms lin1 in lin of pure degree 1 in each polynomial of lin // k1 = pure degree 1 part, i.e. nonzero elts of lin1, renumbered // k2 = lin2 (=matrix(lin) - matrix(lin2)), renumbered /* Alte Version mit interred: // Then go to ring newBAS with ordering c,dp(n) and create a matrix with // size(k1) colums and 2 rows, such that if [f1,f2] is a column of M then f1+f2 // is one of the polys of lin containing a pure degree 1 part and f1 is this // part interreduce this matrix (i.e. Gauss elimination on linear part, with // Then go to ring newBAS with ordering c,dp(n) and create a matrix with // size(k1) colums and 2 rows, such that if [f1,f2] is a column of M then f1+f2 // is one of the polys of lin containing a pure degree 1 part and f1 is this // part interreduce this matrix (i.e. Gauss elimination on linear part, with // rest transformed accordingly). //Ist jetzt durch direkte Substitution gemacht (schneller!) //ideal k12 = k1,k2; //matrix M = matrix(k12,2,kk);     //degree 1 part is now in row 1 //M = interred(M); //### interred zu teuer, muss nicht sein. Wenn interred angewendet //M = interred(M); //### interred zu teuer, muss nicht sein. Wenn interred angewendet //werden soll, vorher in Ring mit Ordnung (c,dp) wechseln! //Abfrage:  if( ordstr(BAS) != "c,dp("+string(n)+")" ) -z ergibt ich auch i[2]-z*i[3] mit option(redThrough) statt interred kann man hier auch NF(i,i[3])+i[3] verwenden hier lifert elimpart(i) 2 Substitutionen (x,y) elimpart(interred(i)) hier lifert elimpart(i) 2 Substitutionen (x,y) elimpart(interred(i)) aber 3 (x,y,z) Da interred oder NF aber die Laenge der polys vergroessern kann, nicht gemacht //since lin1 != 0 there are candidates for substituting variables lin2 = lin - lin1;      //difference as matrix lin2 = lin - lin1;      //difference as matrix // rest of lin, part of pure degree 1 substracted from each generator of lin } } //Now each !=0 generator of lin2 contains only constant terms or terms of //Now each !=0 generator of lin2 contains only constant terms or terms of //degree >= 2, hence lin 2 can never be used for further substitutions //We have: lin = ideal(matrix(k1)+matrix(k2)), lin2 ideal kin = matrix(k1)+matrix(k2); ideal kin = matrix(k1)+matrix(k2); //kin = polys of lin which contained a pure degree 1 part. kin = simplify(kin,2); int count=1; while ( count != 0 ) { { count = 0; for ( ii=1; ii<=n; ii++  )    //start direct substitution of var(ii) { //we look for the shortest candidate to substitute var(ii) if ( cand == 0 ) { if ( cand == 0 ) { cand = kin[kk];  //candidate for substituting var(ii) } } else { if ( size(kin[kk]) < size(cand) ) { cand = kin[kk]; if ( size(kin[kk]) < size(cand) ) { cand = kin[kk]; } } } } } if ( cand != 0 ) { p = cand/var(ii); kip = cand/p;      //normalized poly of kin w.r.t var(ii) kip = cand/p;      //normalized polynomial of kin w.r.t var(ii) eva = eva+var(ii); //var(ii) added to list of elimin. vars neva[ii] = 0; sub = sub+kip;     //poly defining substituion //## gmg: gendert 08/2008, map durch subst ersetzt sub = sub+kip;     //polynomial defining substituion //## gmg: gendert 08/2008, map durch subst ersetzt //(viel schneller) vip = var(ii) - kip;  //poly to be substituted vip = var(ii) - kip;  //polynomial to be substituted lin = subst(lin, var(ii), vip);  //subst in rest lin = simplify(lin,2); } } lin = kin+lin; for( ii=1; ii<=size(lin); ii++ ) { } for( ii=1; ii<=n; ii++ ) for( ii=1; ii<=n; ii++ ) { for( kk=1; kk<=size(eva); kk++ )
• ## Singular/LIB/primitiv.lib

 r40c648 // This library is for Singular 1.2 or newer version="$Id: primitiv.lib,v 1.22 2005-05-06 14:39:03 hannes Exp$"; version="$Id: primitiv.lib,v 1.23 2009-04-15 11:18:27 seelisch Exp$"; category="Commutative Algebra"; info=" option(redSB); //-------- Mache so lange Random-Koord.wechsel, bis letztes Poly ------------- //-------- Mache so lange Random-Koord.wechsel, bis letztes Polynom ------------- //--------------- das Minpoly eines primitiven Elements ist : ---------------- for (Fehlversuche=0; Fehlversuche
• ## Singular/LIB/qhmoduli.lib

 r40c648 /////////////////////////////////////////////////////////////////////////////// version="$Id: qhmoduli.lib,v 1.17 2009-04-14 12:08:36 Singular Exp$"; version="$Id: qhmoduli.lib,v 1.18 2009-04-15 11:17:11 seelisch Exp$"; category="Singularities"; info=" PURPOSE: compute the equations of the isometry group of the ideal I, each generator of I is fixed by the stabilizer. ASSUME:  I semiquasihomogeneous ideal wrt 'w' with an isolated singularity at 0 ASSUME:  I semiquasihomogeneous ideal w.r.t. 'w' with an isolated singularity at 0 RETURN:  list of two rings 'S1', 'S2' - 'S1' contians the equations of the stabilizer (ideal 'stabid') @*
• ## Singular/LIB/random.lib

 r40c648 //(GMG/BM, last modified 22.06.96) /////////////////////////////////////////////////////////////////////////////// version="$Id: random.lib,v 1.19 2009-04-14 12:00:14 Singular Exp$"; version="$Id: random.lib,v 1.20 2009-04-15 11:18:27 seelisch Exp$"; category="General purpose"; info=" proc sparseHomogIdeal (int k, int u, list #) "USAGE:   sparseid(k,u[,o,p,b]);  k,u,o,p,b integers RETURN:  ideal having k homogeneous generators, each of random degree in the interval [u,o], p percent of terms in degree d are 0, the remaining have random coefficients in the interval [1,b], (default: o=u, p=75, RETURN:  ideal having k homogeneous generators, each of random degree in the interval [u,o], p percent of terms in degree d are 0, the remaining have random coefficients in the interval [1,b], (default: o=u, p=75, b=30000) EXAMPLE: example sparseid; shows an example { id = maxideal(random(u, o)); // monomial basis of some degree m = sparsemat(size(id),1,p,b); // random coefficients m = sparsemat(size(id),1,p,b); // random coefficients i[ii] = (matrix(id)*m)[1,1]; } proc sparsepoly (int u, list #) "USAGE:   sparsepoly(u[,o,p,b]);  u,o,p,b integers RETURN:  poly having only terms in degree d, u<=d<=o, p percent of the terms RETURN:  poly having only terms in degree d, u<=d<=o, p percentage of the terms in degree d are 0, the remaining have random coefficients in [1,b), (defaults: o=u, p=75, b=30000)
• ## Singular/LIB/ratgb.lib

 r40c648 ////////////////////////////////////////////////////////////////////////////// version="$Id: ratgb.lib,v 1.15 2009-04-14 12:00:15 Singular Exp$"; version="$Id: ratgb.lib,v 1.16 2009-04-15 11:15:40 seelisch Exp$"; category="Noncommutative"; info=" PROCEDURES: ratstd(ideal I, int n);   compute Groebner basis in Ore localization of the basering wrt first n variables ratstd(ideal I, int n);   compute Groebner basis in Ore localization of the basering w.r.t. first n variables SUPPORT: SpezialForschungsBereich F1301 of the Austrian FWF va = L3[w][2]; for(z=1;z<=nvars(save)-is;z++) { vb[z] = va[is+z]; { vb[z] = va[is+z]; } tmp3[1] = "a"; dbprint(ppl,"// -3- running groebner"); // 3. compute G = GB(I) wrt. the elim. ord. for D // 3. compute G = GB(I) w.r.t. the elim. ord. for D setring save; //  ideal CI = imap(@RAT,CI); setring A; IAppel1; def F1 = ratstd(IAppel1,2); lead(pGBid); def F1 = ratstd(IAppel1,2); lead(pGBid); setring F1; rGBid; } setring A; IAppel2; def F1 = ratstd(IAppel2,2); lead(pGBid); def F1 = ratstd(IAppel2,2); lead(pGBid); setring F1; rGBid; } setring A; IAppel4; def F1 = ratstd(IAppel4,2); lead(pGBid); def F1 = ratstd(IAppel4,2); lead(pGBid); setring F1; rGBid; }

 r40c648 /////////////////////////////////////////////////////////////////////////////// version="$Id: realrad.lib,v 1.7 2008-12-12 11:26:34 Singular Exp$"; version="$Id: realrad.lib,v 1.8 2009-04-15 11:15:06 seelisch Exp$"; category="real algebra"; info=" list prim,prepared,nonshape,realu; int r;//counter int l;//number of first poly with degree >1 or even int l;//number of first polynomial with degree >1 or even l=size(j); for (r=1;r<=l;r++) ////////////////////////////////////////////////////////////////////////////// proc realpoly(poly f) "USAGE:    realpoly(f); a univariate poly f; "USAGE:    realpoly(f); a univariate polynomial f; RETURN:    poly f, where f is the real part of the input f EXAMPLE:   example realpoly; shows an example" } //search for a p in Q[x_n] such that f is pos. sem. definite //iff for every isolating setting S={a_1,...,a_r} holds that //if and only if for every isolating setting S={a_1,...,a_r} holds that //every f(x_1,..,x_n-1, a_i) is positiv semidefinite //recursion of variables in the Bernstein basis pf lr=(l,r) an a number m in Q RETURN:a list erg=erg1,erg2 s.th. erg1=erg1[1],erg[2] and erg1[1] are the bernstein coefficients of P wrt to erg1[2]=(l,m) and erg2[1] the bernstein coefficients of P w.r.t. to erg1[2]=(l,m) and erg2[1] is one for erg2[2]=(m,r) EXAMPLE: Bernsteincoefficients shows no example static proc search_first(ideal j,int start, int i) "USAGE:    searchfirst(j, start, i); id a reduced groebner basis wrt lex id a reduced groebner basis w.r.t. lex RETURN:    if i=1 then turns the number of the first non univariate entry with order >1 in its leading term after start
• ## Singular/LIB/redcgs.lib

 r40c648 ////////////////////////////////////////////////////////////////////////////// version="$Id: redcgs.lib,v 1.5 2009-04-07 09:30:44 seelisch Exp$"; version="$Id: redcgs.lib,v 1.6 2009-04-15 11:15:06 seelisch Exp$"; category="General purpose"; info=" subset(F,G);         If all elements of F belong to the ideal G it returns 1, and 0 otherwise. pdivi(f,F);          Pseudodivision of a poly f by an ideal F in @R. Returns a pdivi(f,F);          Pseudodivision of a polynomial f by an ideal F in @R. Returns a list (r,q,m) such that m*f=r+sum(q.G). facvar(ideal J)      Returns all the free-square factors of the elements redspec(N,W);        Given null and non-null conditions depending only on the parameters it returns a red-specification. pnormalform(f,N,W);  Reduces the poly f wrt to the null condition ideal N and the pnormalform(f,N,W);  Reduces the polynomial f w.r.t. to the null condition ideal N and the non-null condition ideal W (both depending on the parameters). buildtree(F);        Returns a list T describing a first reduced CGS of the ideal // pdivi : pseudodivision of a poly f by an ideal F in @R // pdivi : pseudodivision of a polynomial f by an ideal F in @R //         in the ring @R // input: pseudodivision, q is the ideal of quotients, and m is the factor by which f is to be multiplied. NOTE:     Pseudodivision of a poly f by an ideal F in @R. Returns a NOTE:     Pseudodivision of a polynomial f by an ideal F in @R. Returns a list (r,q,m) such that m*f=r+sum(q.G). KEYWORDS: division, reduce }; // pnormalform: reduces a polynomial wrt a red-spec dividing by N and eliminating factors in W. // pnormalform: reduces a polynomial w.r.t. a red-spec dividing by N and eliminating factors in W. //              called in the ring @R //              operates in the ring @RP //         ideal W  (depends only on the parameters) //                   (N,W) must be a red-spec (depends only on the parameters) // output: poly f2 reduced wrt to the red-spec (N,W) // output: poly f2 reduced w.r.t. to the red-spec (N,W) // note:   for security a lot of work is done. If (N,W) is already a red-spec it should be simplified proc pnormalform(poly f, ideal N, ideal W) N1 is uniquely determined and no prime component of N1 contains none of the polynomials in W1. The polynomials in W1 are prime and reduced wrt N1, and are considered non-null on the segment. w.r.t. N1, and are considered non-null on the segment. L1 contains the list of prime components of N1. NOTE:     can be called from ring @R but it works in ring @P. // redgb: given a minimal bases (gb reducing) it // reduces each polynomial wrt to the others // reduces each polynomial w.r.t. to the others proc redgb(ideal F, ideal N, ideal W) { ideal N;   // the summarized N ideal W;   // the summarized W ideal F;   // the summarized poly j (can contain a sheaf instead of ideal F;   // the summarized polynomial j (can contain a sheaf instead of // a single poly) ideal FF;  // the same as F but it can be ideal(0) // reduceR // reduces the polynomial f wrt N, in the ring @P // reduces the polynomial f w.r.t. N, in the ring @P proc reduceR(poly f, ideal N) { // redgb: given a minimal bases (gb reducing) it // reduces each polynomial wrt to the others // reduces each polynomial w.r.t. to the others proc postredgb(ideal F) {
• ## Singular/LIB/reesclos.lib

 r40c648 // compute the preimage of [p mod ker(k)] under phi in R(k-1): // as p is an element of im(phi), there is a poly h such that // as p is an element of im(phi), there is a polynomial h such that // h(vars(R(k-1)) is mapped to [p mod ker (k)], and h can be com- // puted as the normal form of a w.r.t in R(k)[Z]
• ## Singular/LIB/reszeta.lib

 r40c648 ////////////////////////////////////////////////////////////////////////////// version="$Id: reszeta.lib,v 1.13 2009-03-30 11:56:03 dreyer Exp$"; version="$Id: reszeta.lib,v 1.14 2009-04-15 11:15:06 seelisch Exp$"; category="Commutative Algebra"; info=" } //---the poly is constant //---the polynomial is constant if(size(v)==1){return(re);} //---the poly depends only on one variable or is homogeneous //---the polynomial depends only on one variable or is homogeneous //---in 2 variables if((size(v)==2)||((size(v)==3)&&(homog(p)))) if(size(v)>2){ERROR("getMinpoly:input depends on more then 2 variables");} //---the general case, the poly is considered as poly in x an y now //---the general case, the polynomial is considered as polynomial in x an y now ring T=0,(x,y),lp; ideal M,N; } poly L=f*(diff(g,y)-diff(h,x))+h*diff(f,x)-g*diff(f,y); //---according to the theory f is absolutely irreducible iff //---according to the theory f is absolutely irreducible if and only if //---L(g,h)=0 has no non-trivial solution g,h //---(g=diff(f,x),h=diff(f,y) is always a solution) //---Auxilliary procedure for fetchInTree! //---Assume E prime ideal, Z+E eqidimensional, //---ht(E)+r=ht(Z+E). Compute  P= in Z+E, and poly f, //---ht(E)+r=ht(Z+E). Compute  P= in Z+E, and polynomial f, //---such that radical(Z+E)=radical((E+P):f) int i,j,d,e;
• ## Singular/LIB/ring.lib

 r40c648 /////////////////////////////////////////////////////////////////////////////// version="$Id: ring.lib,v 1.33 2009-04-06 09:17:01 seelisch Exp$"; version="$Id: ring.lib,v 1.34 2009-04-15 11:18:27 seelisch Exp$"; category="General purpose"; info=" into the basering. If no 2nd argument is present, the names are the same as in R. If, say, f is a poly in R and the 2nd argument is the string \"R\", then f say, f is a polynomial in R and the 2nd argument is the string \"R\", then f is mapped to f_R etc. RETURN:  no return value into the basering by applying imap to all objects of R. If no 2nd argument is present, the names are the same as in R. If, say, f is a poly in R and the 3rd argument is the string \"R\", then f say, f is a polynomial in R and the 3rd argument is the string \"R\", then f is mapped to f_R etc. RETURN:  no return value matrix, map) into the basering by mapping the j-th variable of R to the j-th generator of the ideal i. If no 3rd argument is present, the names are the same as in R. If, say, f is a poly in R and the 3rd names are the same as in R. If, say, f is a polynomial in R and the 3rd argument is the string \"R\", then f is mapped to f_R etc. RETURN:  no return value.
• ## Singular/LIB/rootsmr.lib

 r40c648 // $Id: rootsmr.lib,v 1.5 2009-04-06 12:39:02 seelisch Exp$ // $Id: rootsmr.lib,v 1.6 2009-04-15 11:15:06 seelisch Exp$ // E. Tobis  12.Nov.2004, April 2004 // last change 7. May 2005 (G.-M. Greuel) //Note on complexity: Let n = no of complex roots of I (= vdim(std(I)). //Then the algorithm needs: //1 std(I) and ~n NF computations (of randcharpoly wrt I) //1 std(I) and ~n NF computations (of randcharpoly w.r.t. I) if (isparam(I)) { //Note on complexity: Let n = no of complex roots of I (= vdim(std(I)). //Then the algotithm needs: //1 std(I) and (1/2)n*(n+1)^2 ~ 1/2n^3 NF computations (of monomials wrt I) //1 std(I) and (1/2)n*(n+1)^2 ~ 1/2n^3 NF computations (of monomials w.r.t. I) if (isparam(I)) { int N = size(B); // We first compute the normal form of f wrt I // We first compute the normal form of f w.r.t. I g = reduce(f,I); int n = size(g);    //allways n <= N static proc isSquare(matrix m) // returns 1 iff m is a square matrix // returns 1 if and only if m is a square matrix { return (nrows(m)==ncols(m)); proc verify(poly p,ideal B,ideal I) "USAGE:     verify(p,B,I); p poly, B,I,ideal RETURN:    integer: 1 iff the polynomial p splits the points of V(I). RETURN:    integer: 1 if and only if the polynomial p splits the points of V(I). It's used to check the result of randcharpoly ASSUME:    I is given by a Groebner basis and B is an ordered monomial basis of r/I,
• ## Singular/LIB/rootsur.lib

 r40c648 // $Id: rootsur.lib,v 1.7 2009-04-06 12:39:02 seelisch Exp$ // $Id: rootsur.lib,v 1.8 2009-04-15 11:15:06 seelisch Exp$ // E. Tobis  12.Nov.2004, April 2004 // last change 5. May 2005 (G.-M. Greuel) whichvariable(p) The only variable of a univariate monomial (or 0) varsigns(p)      Number of sign changes in a list boundBuFou(p,a,b) Bound for number of real roots of poly p in interval (a,b) boundposDes(p)   Bound for the number of positive real roots of poly p boundDes(p)      Bound for the number of real roots of poly p allrealst(p)     Checks whether all the roots of a poly are real (via Sturm) boundBuFou(p,a,b) Bound for number of real roots of polynomial p in interval (a,b) boundposDes(p)   Bound for the number of positive real roots of polynomial p boundDes(p)      Bound for the number of real roots of polynomial p allrealst(p)     Checks whether all the roots of a polynomial are real (via Sturm) maxabs(p)        A bound for the maximum absolute value of a root of a poly allreal(p)       Checks whether all the roots of a poly are real (via St-Ha) sturm(p,a,b)     Number of real roots of a poly on an interval (via Sturm) allreal(p)       Checks whether all the roots of a polynomial are real (via St-Ha) sturm(p,a,b)     Number of real roots of a polynomial on an interval (via Sturm) sturmseq(p)      Sturm sequence of a polynomial sturmha(p,a,b)   Number of real roots of a poly in (a,b) (via Sturm-Habicht) sturmha(p,a,b)   Number of real roots of a polynomial in (a,b) (via Sturm-Habicht) sturmhaseq(p)    A Sturm-Habicht Sequence of a polynomial reverse(l)       Reverses a list nrroots(p)       The number of real roots of p isparam(p)       Returns 0 iff the polynomial has non-parametric coefficients isparam(p)       Returns 0 if and only if the polynomial has non-parametric coefficients KEYWORDS:         real roots, univariate polynomial proc allrealst(poly p) "USAGE:     allrealst(p); poly p RETURN:    int: 1 iff all the roots of p are real, 0 otherwise. RETURN:    int: 1 if and only if all the roots of p are real, 0 otherwise. Checks by using Sturm's Theorem whether all the roots of p are real ASSUME:    p is a univariate polynomial with rational coefficients proc allreal(poly p) "USAGE:     allreal(p); RETURN:    int: 1 iff all the roots of p are real, 0 otherwise RETURN:    int: 1 if and only if all the roots of p are real, 0 otherwise SEE ALSO:  allrealst EXAMPLE:   example allreal; shows an example"
• ## Singular/LIB/sing.lib

 r40c648 /////////////////////////////////////////////////////////////////////////////// version="$Id: sing.lib,v 1.33 2009-02-23 15:12:44 Singular Exp$"; version="$Id: sing.lib,v 1.34 2009-04-15 11:15:56 seelisch Exp$"; category="Singularities"; info=" deform(i);             infinitesimal deformations of ideal i dim_slocus(i);         dimension of singular locus of ideal i is_active(f,id);       is poly f an active element mod id? (id ideal/module) is_active(f,id);       is polynomial f an active element mod id? (id ideal/module) is_ci(i);              is ideal i a complete intersection? is_is(i);              is ideal i an isolated singularity? is_reg(f,id);          is poly f a regular element mod id? (id ideal/module) is_reg(f,id);          is polynomial f a regular element mod id? (id ideal/module) is_regs(i[,id]);       are gen's of ideal i regular sequence modulo id? locstd(i);             SB for local degree ordering without cancelling units RETURN:  a standard basis for a local degree ordering NOTE:    the procedure homogenizes id w.r.t. a new 1st variable @t@, computes a SB wrt (dp(1),dp) and substitutes @t@ by 1. a SB w.r.t. (dp(1),dp) and substitutes @t@ by 1. Hence the result is a SB with respect to an ordering which sorts first w.r.t. the order and then refines it with dp. This is a
• ## Singular/LIB/solve.lib

 r40c648 /////////////////////////////////////////////////////////////////////////////// version="$Id: solve.lib,v 1.38 2009-04-06 09:17:01 seelisch Exp$"; version="$Id: solve.lib,v 1.39 2009-04-15 11:24:12 seelisch Exp$"; category="Symbolic-numerical solving"; info=" ures_solve(i,[..]);     find all roots of 0-dimensional ideal i with resultants mp_res_mat(i,[..]);     multipolynomial resultant matrix of ideal i interpolate(p,v,d);     interpolate poly from evaluation points i and results j interpolate(p,v,d);     interpolate polynomial from evaluation points i and results j fglm_solve(i,[..]);     find roots of 0-dim. ideal using FGLM and lex_solve lex_solve(i,p,[..]);    find roots of reduced lexicographic standard basis list l = laguerre_solve(f); l; // check result, value of substituted poly should be near to zero // check result, value of substituted polynomial should be near to zero // remember that l contains a list of strings // in the case of a different ring } /* * returns a poly without zeroroots * returns a polynomial without zeroroots */ static proc divzero(poly f,int iv) dd++; // hier Leading-Exponent pruefen??? // oder ist das Poly immer als letztes in der Liste?!? // oder ist das Polynom immer als letztes in der Liste?!? // leadexp(ps) }
• ## Singular/LIB/standard.lib

 r40c648 //### Todo: im lokalen Fall die Hilbert-Samuel Funktion verwenden ////////////////////////////////////////////////////////////////////////////// version="$Id: standard.lib,v 1.108 2009-04-14 09:54:52 seelisch Exp$"; version="$Id: standard.lib,v 1.109 2009-04-15 11:15:56 seelisch Exp$"; category="Miscellaneous"; info=" fprintf(link,fmt,..)   writes formatted string to link printf(fmt,...)        displays formatted string weightKB(stc,dd,vl)    degree dd part of a kbase wrt. some weigths weightKB(stc,dd,vl)    degree dd part of a kbase w.r.t. some weigths qslimgb(i)             computes a standard basis with slimgb in a qring par2varRing([i])       create a ring making pars to vars, together with i
• ## Singular/LIB/stratify.lib

 r40c648 // (anne, last modified 23.5.00) last modified: 12.12.2000 ///////////////////////////////////////////////////////////////////////////// version="$Id: stratify.lib,v 1.8 2006-07-18 15:22:16 Singular Exp$"; version="$Id: stratify.lib,v 1.9 2009-04-15 11:15:56 seelisch Exp$"; category="Invariant theory"; info=" retlist[i][3]=leer; i=j-1; // retlist[..][3] is empty iff there was more than one entry to this intvec // retlist[..][3] is empty if and only if there was more than one entry to this intvec } if(j>size(stratlist)) break;
• ## Singular/LIB/surf.lib

 r40c648 // last modified 21.07.2005, Oliver Wienand /////////////////////////////////////////////////////////////////////////////// version="$Id: surf.lib,v 1.33 2009-04-06 12:39:02 seelisch Exp$"; version="$Id: surf.lib,v 1.34 2009-04-15 11:15:56 seelisch Exp$"; category="Visualization"; info=" each contains the sums of all degrees in this variable of all monomials occuring in the ideal. An entry is zero iff the corresponding variable does not occur in the ideal. An entry is zero if and only if the corresponding variable does not occur in the ideal. " {
• ## Singular/LIB/teachstd.lib

 r40c648 //GMG, last modified 28.9.01 /////////////////////////////////////////////////////////////////////////////// version="$Id: teachstd.lib,v 1.12 2009-04-14 12:00:15 Singular Exp$"; version="$Id: teachstd.lib,v 1.13 2009-04-15 11:23:27 seelisch Exp$"; category="Teaching"; info=" tail(f);               tail of f sameComponent(f,g);    test for same module component of lead(f) and lead(g) leadmonomial(f);       leading monomial as poly (also for vectors) monomialLcm(m,n);      lcm of monomials m and n as poly (also for vectors) leadmonomial(f);       leading monomial as polynomial (also for vectors) monomialLcm(m,n);      lcm of monomials m and n as polynomial (also for vectors) spoly(f[,1]);          s-polynomial of f [symmetric form] minEcart(T,h);         element g from T of minimal ecart s.t. LM(g)|LM(h)
• ## Singular/LIB/tropical.lib

 r40c648 version="$Id: tropical.lib,v 1.15 2009-04-14 12:00:15 Singular Exp$"; version="$Id: tropical.lib,v 1.16 2009-04-15 11:22:37 seelisch Exp$"; category="Tropical Geometry"; info=" @*               Thomas Markwig,  email: keilen@mathematik.uni-kl.de WARNING: WARNING: - tropicalLifting will only work with LINUX and if in addition gfan is installed. @*- drawTropicalCurve and drawTropicalNewtonSubdivision will only display the @*  tropical curve with LINUX and if in addition latex and kghostview @*- drawTropicalCurve and drawTropicalNewtonSubdivision will only display the @*  tropical curve with LINUX and if in addition latex and kghostview @*  are installed. @*- For tropicalLifting in the definition of the basering the parameter t @*- For tropicalLifting in the definition of the basering the parameter t @*  from the Puiseux series field C{{t}} must be defined as a variable, @*  while for all other procedures it must be defined as a parameter. THEORY: Fix some base field K and a bunch of lattice points v0,...,vm in the integer lattice Z^n, then this defines a toric variety as the closure of (K*)^n in the projective space P^m, where the torus is embedded via the map sending a Fix some base field K and a bunch of lattice points v0,...,vm in the integer lattice Z^n, then this defines a toric variety as the closure of (K*)^n in the projective space P^m, where the torus is embedded via the map sending a point x in (K*)^n to the point (x^v0,...,x^vm). The generic hyperplane sections are just the images of the hypersurfaces The generic hyperplane sections are just the images of the hypersurfaces in (K*)^n defined by the polynomials f=a0*x^v0+...+am*x^vm=0. Some properties of these hypersurfaces can be studied via tropicalisation. For this we suppose that K=C{{t}} is the field of Puiseux series over the of these hypersurfaces can be studied via tropicalisation. For this we suppose that K=C{{t}} is the field of Puiseux series over the field of complex numbers (or any other field with a valuation into the real numbers). One associates to the hypersurface given by f=a0*x^v0+...+am*x^vm numbers). One associates to the hypersurface given by f=a0*x^v0+...+am*x^vm the tropical hypersurface defined by the tropicalisation trop(f)=min{val(a0)+,...,val(am)+}. trop(f)=min{val(a0)+,...,val(am)+}. Here, denotes the standard scalar product of the integer vector v in Z^n with the vector x=(x1,...,xn) of variables, so that trop(f) is a piecewise linear function on R^n. The corner locus of this function (i.e. the points at which the minimum is attained a least twice) is the tropical hypersurface defined by trop(f). The theorem of Newton-Kapranov states that this tropical hypersurface is the same as if one computes pointwise the valuation of the hypersurface given by f. The analogue holds true if one replaces one equation f by an ideal I. A constructive proof of the theorem is given by an adapted version of the Newton-Puiseux algorithm. The hard part is to find a point in the variety over C{{t}} which corresponds to a given point in the linear function on R^n. The corner locus of this function (i.e. the points at which the minimum is attained a least twice) is the tropical hypersurface defined by trop(f). The theorem of Newton-Kapranov states that this tropical hypersurface is the same as if one computes pointwise the valuation of the hypersurface given by f. The analogue holds true if one replaces one equation f by an ideal I. A constructive proof of the theorem is given by an adapted version of the Newton-Puiseux algorithm. The hard part is to find a point in the variety over C{{t}} which corresponds to a given point in the tropical variety. It is the purpose of this library to provide basic means to deal with tropical varieties. Of course we cannot represent the field of Puiseux series over C in its full strength, however, in order to compute interesting examples it will be sufficient to replace the complex numbers C by the rational numbers Q and to replace Puiseux series in t by rational functions in t, i.e. we replace C{{t}} by Q(t), or sometimes even by Q[t]. It is the purpose of this library to provide basic means to deal with tropical varieties. Of course we cannot represent the field of Puiseux series over C in its full strength, however, in order to compute interesting examples it will be sufficient to replace the complex numbers C by the rational numbers Q and to replace Puiseux series in t by rational functions in t, i.e. we replace C{{t}} by Q(t), or sometimes even by Q[t]. Note, that this in particular forbids rational exponents for the t's. Moreover, in Singular no negative exponents of monomials are allowed, so that the integer vectors vi will have to have non-negative entries. Shifting all exponents by a fixed integer vector does not change the tropicalisation nor does it change the toric variety. Thus this does not Moreover, in @sc{Singular} no negative exponents of monomials are allowed, so that the integer vectors vi will have to have non-negative entries. Shifting all exponents by a fixed integer vector does not change the tropicalisation nor does it change the toric variety. Thus this does not cause any restriction. If, however, for some reason you prefer to work with general vi, then you have to pass right away to the tropicalisation of the equations, whereever If, however, for some reason you prefer to work with general vi, then you have to pass right away to the tropicalisation of the equations, whereever this is allowed -- these are linear polynomials where the constant coefficient corresponds to the valuation of the original coefficient and where the non-constant coefficient correspond to the exponents of the monomials, thus they may be rational numbers respectively negative numbers: corresponds to the valuation of the original coefficient and where the non-constant coefficient correspond to the exponents of the monomials, thus they may be rational numbers respectively negative numbers: e.g. if f=t^{1/2}*x^{-2}*y^3+2t*x*y+4  then  trop(f)=min{1/2-2x+3y,1+x+y,0}. The main tools provided in this library are as follows: @*  - tropicalLifting    implements the constructive proof of the Theorem of Newton-Kapranov and constructs a point in the variety over C{{t}} corresponding to a given point in the corresponding tropical variety associated to an ideal I; the generators of I have to be in the polynomial ring Q[t,x1,...,xn] considered as a subring of C{{t}}[x1,...,xn]; a solution will be constructed up to given order; note that several @*  - tropicalLifting    implements the constructive proof of the Theorem of Newton-Kapranov and constructs a point in the variety over C{{t}} corresponding to a given point in the corresponding tropical variety associated to an ideal I; the generators of I have to be in the polynomial ring Q[t,x1,...,xn] considered as a subring of C{{t}}[x1,...,xn]; a solution will be constructed up to given order; note that several field extensions of Q might be necessary throughout the intermediate computations; the procedures use the external program gfan @*  - drawTropicalCurve  visualises a tropical plane curve either given by a polynomial in Q(t)[x,y] or by a list of linear polynomials of the form ax+by+c with a,b in Z and c @*  - drawTropicalCurve  visualises a tropical plane curve either given by a polynomial in Q(t)[x,y] or by a list of linear polynomials of the form ax+by+c with a,b in Z and c in Q; latex must be installed on your computer @*  - tropicalJInvariant computes the tropical j-invaiant of a tropical @*  - tropicalJInvariant computes the tropical j-invaiant of a tropical elliptic curve @*  - jInvariant         computes the j-invariant of an elliptic curve @*  - weierstrassForm     computes the Weierstrass form of an elliptic curve @*  - weierstrassForm     computes the Weierstrass form of an elliptic curve PROCEDURES FOR TROPICAL LIFTING: tropicalLifting          computes a point in the tropical variety displayTropicalLifting   displays the output of tropicalLifting tropicalLifting()          computes a point in the tropical variety displayTropicalLifting()   displays the output of tropicalLifting PROCEDURES FOR DRAWING TROPICAL CURVES: tropicalCurve            computes a tropical curve and its Newton subdivision drawTropicalCurve        produces a post script image of a tropical curve drawNewtonSubdivision    produces a post script image of a Newton subdivision tropicalCurve()            computes a tropical curve and its Newton subdivision drawTropicalCurve()        produces a post script image of a tropical curve drawNewtonSubdivision()    produces a post script image of a Newton subdivision PROCEDURES FOR J-INVARIANTS: tropicalJInvariant       computes the tropical j-invariant of a tropical curve weierstrassForm          computes the Weierstrass form of a cubic polynomial jInvariant               computes the j-invariant of a cubic polynomial tropicalJInvariant()       computes the tropical j-invariant of a tropical curve weierstrassForm()          computes the Weierstrass form of a cubic polynomial jInvariant()               computes the j-invariant of a cubic polynomial GENERAL PROCEDURES: conicWithTangents  computes a conic through five points with tangents tropicalise        computes the tropicalisation of a polynomial tropicaliseSet     computes the tropicalisation several polynomials tInitialForm       computes the tInitial form of a poly in Q[t,x_1,...,x_n] tInitialIdeal      computes the tInitial ideal of an ideal in Q[t,x_1,...,x_n] initialForm        computes the initial form of poly in Q[x_1,...,x_n] initialIdeal       computes the initial ideal of an ideal in Q[x_1,...,x_n] conicWithTangents()  computes a conic through five points with tangents tropicalise()        computes the tropicalisation of a polynomial tropicaliseSet()     computes the tropicalisation several polynomials tInitialForm()       computes the tInitial form of a polynomial in Q[t,x_1,...,x_n] tInitialIdeal()      computes the tInitial ideal of an ideal in Q[t,x_1,...,x_n] initialForm()        computes the initial form of poly in Q[x_1,...,x_n] initialIdeal()       computes the initial ideal of an ideal in Q[x_1,...,x_n] PROCEDURES FOR LATEX CONVERSION: texNumber          outputs the texcommand for the leading coefficient of poly texPolynomial      outputs the texcommand for the polynomial poly texMatrix          outputs the texcommand for the matrix texDrawBasic       embeds output of texDrawTropical in a texdraw environment texDrawTropical    computes the texdraw commands for a tropical curve texDrawNewtonSubdivision   computes texdraw commands for a Newton subdivision texDrawTriangulation       computes texdraw commands for a triangulation texNumber()          outputs the texcommand for the leading coefficient of poly texPolynomial()      outputs the texcommand for the polynomial poly texMatrix()          outputs the texcommand for the matrix texDrawBasic()       embeds output of texDrawTropical in a texdraw environment texDrawTropical()    computes the texdraw commands for a tropical curve texDrawNewtonSubdivision()   computes texdraw commands for a Newton subdivision texDrawTriangulation()       computes texdraw commands for a triangulation AUXILARY PROCEDURES: radicalMemberShip     checks radical membership tInitialFormPar       computes the t-initial form of poly in Q(t)[x_1,...,x_n] tInitialFormParMax    same as tInitialFormPar, but uses maximum solveTInitialFormPar  displays approximated solution of a 0-dim ideal detropicalise         computes the detropicalisation of a linear form dualConic             computes the dual of an affine plane conic parameterSubstitute   substitutes in the poly the parameter t by t^N tropicalSubst         makes certain substitutions in a tropical polynomial randomPoly            computes a polynomial with random coefficients cleanTmp              clears /tmp from files created by other procedures radicalMemberShip()     checks radical membership tInitialFormPar()       computes the t-initial form of poly in Q(t)[x_1,...,x_n] tInitialFormParMax()    same as tInitialFormPar, but uses maximum solveTInitialFormPar()  displays approximated solution of a 0-dim ideal detropicalise()         computes the detropicalisation of a linear form dualConic()             computes the dual of an affine plane conic parameterSubstitute()   substitutes in the polynomial the parameter t by t^N tropicalSubst()         makes certain substitutions in a tropical polynomial randomPoly()            computes a polynomial with random coefficients cleanTmp()              clears /tmp from files created by other procedures KEYWORDS:        tropical curves; tropical polynomials /// - eliminatecomponents /// - findzerosAndBasictransform /// - ordermaximalideals /// - ordermaximalideals /// - verticesTropicalCurve /// - bunchOfLines /////////////////////////////////////////////////////////////////////////////// /// Procedures concerned with tropical parametrisation /// Procedures concerned with tropical parametrisation /////////////////////////////////////////////////////////////////////////////// proc tropicalLifting (ideal i,intvec w,int ordnung,list #) "USAGE:  tropicalLifting(i,w,ord[,opt]); i ideal, w intvec, ord int, opt string ASSUME:  - i is an ideal in Q[t,x_1,...,x_n], w=(w_0,w_1,...,w_n) and (w_1/w_0,...,w_n/w_0) is in the tropical variety of i, and ord is the order up to which a point in V(i) over Q{{t}} lying over (w_1/w_0,...,w_n/w_0) shall be computed; ASSUME:  - i is an ideal in Q[t,x_1,...,x_n], w=(w_0,w_1,...,w_n) and (w_1/w_0,...,w_n/w_0) is in the tropical variety of i, and ord is the order up to which a point in V(i) over Q{{t}} lying over (w_1/w_0,...,w_n/w_0) shall be computed; w_0 may NOT be ZERO @*       - the basering should not have any parameters on its own and it should have a global monomial ordering, @*       - the basering should not have any parameters on its own and it should have a global monomial ordering, e.g. ring r=0,(t,x(1..n)),dp; @*       - the first variable of the basering will be treated as the @*       - the first variable of the basering will be treated as the parameter t in the Puiseux series field @*       - the optional parameter opt should be one or more strings among @*       - the optional parameter opt should be one or more strings among the following: @*         'isZeroDimensional'  : the dimension i is zero (not to be checked); @*         'isPrime'            : the ideal is prime over Q(t)[x_1,...,x_n] @*         'isPrime'            : the ideal is prime over Q(t)[x_1,...,x_n] (not to be checked); @*         'isInTrop'           : (w_1/w_0,...,w_n/w_0) is in the tropical @*         'isInTrop'           : (w_1/w_0,...,w_n/w_0) is in the tropical variety (not to be checked); @*         'oldGfan'            : uses gfan version 0.2.1 or less @*         'findAll'            : find all solutions of a zero-dimensional @*         'oldGfan'            : uses gfan version 0.2.1 or less @*         'findAll'            : find all solutions of a zero-dimensional ideal over (w_1/w_0,...,w_n/w_0) @*         'noAbs'              : do NOT use absolute primary decomposition RETURN:  IF THE OPTION 'findAll' WAS NOT SET THEN: @*       list, containing one lifting of the given point (w_1/w_0,...,w_n/w_0) in the tropical variety of i to a point in V(i) over Puiseux in the tropical variety of i to a point in V(i) over Puiseux series field up to the first ord terms; more precisely: @*             IF THE OPTION 'noAbs' WAS NOT SET, THEN: @*       IF THE OPITON 'findAll' WAS SET, THEN: @*       list, containing ALL liftings of the given point ((w_1/w_0,...,w_n/w_0) in the tropical variety of i to a point in V(i) over Puiseux series field up to the first ord terms, if the ideal is in the tropical variety of i to a point in V(i) over Puiseux series field up to the first ord terms, if the ideal is zero-dimensional over Q{{t}}; more precisely, each entry of the list is a list l as computed more precisely, each entry of the list is a list l as computed if  'findAll' was NOT set @*       WE NOW DESCRIBE THE LIST ENTRIES IF 'findAll' WAS NOT SET: @*       - the ring l[1] contains an ideal LIFT, which contains @*       - the ring l[1] contains an ideal LIFT, which contains a point in V(i) lying over w up to the first ord terms; @*       - and if the integer l[2] is N then t has to be replaced by t^1/N @*       - and if the integer l[2] is N then t has to be replaced by t^1/N in the lift, or alternatively replace t by t^N in the defining ideal @*       - if the k+1st entry of l[3] is  non-zero, then the kth component of LIFT has to be multiplied t^(-l[3][k]/l[3][1]) AFTER substituting t @*       - if the k+1st entry of l[3] is  non-zero, then the kth component of LIFT has to be multiplied t^(-l[3][k]/l[3][1]) AFTER substituting t by t^1/N @*       - unless the option 'noResubst' was set, the kth entry of list l[4] @*       - unless the option 'noResubst' was set, the kth entry of list l[4] is a string which represents the kth generator of the ideal i where the coordinates have been replaced by the result the ideal i where the coordinates have been replaced by the result of the lift; the t-order of the kth entry should in principle be larger than the the t-order of the kth entry should in principle be larger than the t-degree of LIFT @*       - if the option 'noAbs' was set, then the string in l[5] defines a maximal ideal in the field Q[X(1),...,X(k)], where X(1),...,X(k) @*       - if the option 'noAbs' was set, then the string in l[5] defines a maximal ideal in the field Q[X(1),...,X(k)], where X(1),...,X(k) are the parameters of the ring in l[1]; the basefield of the ring in l[1] should be considered modulo this the basefield of the ring in l[1] should be considered modulo this ideal REMARK:  - it is best to use the procedure displayTropicalLifting to REMARK:  - it is best to use the procedure displayTropicalLifting to display the result @*       - the option 'findAll' cannot be used if 'noAbs' is set @*       - if the parameter 'findAll' is set AND the ideal i is zero-dimensional in Q{{t}}[x_1,...,x_n] then ALL points in V(i) lying over w are in Q{{t}}[x_1,...,x_n] then ALL points in V(i) lying over w are computed up to order ord; if the ideal is not-zero dimenisonal, then only the points in the ideal after cutting down to dimension zero will be computed @*       - the procedure requires that the program GFAN is installed on your computer; if you have GFAN version less than 0.3.0 then you must computer; if you have GFAN version less than 0.3.0 then you must use the optional parameter 'oldGfan' @*       - the procedure requires the Singular procedure absPrimdecGTZ to be @*       - the procedure requires the @sc{Singular} procedure absPrimdecGTZ to be present in the package primdec.lib, unless the option 'noAbs' is set; but even if absPrimdecGTZ is present it might be necessary to set the option 'noAbs' in order to avoid the costly absolute primary decomposition; the side effect is that the field extension which is but even if absPrimdecGTZ is present it might be necessary to set the option 'noAbs' in order to avoid the costly absolute primary decomposition; the side effect is that the field extension which is computed throughout the recursion might need more than one parameter to be described @*       - since Q is infinite, the procedure finishes with probability one @*       - you can call the procedure with Z/pZ as base field instead of Q, @*       - you can call the procedure with Z/pZ as base field instead of Q, but there are some problems you should be aware of: @*         + the Puiseux series field over the algebraic closure of Z/pZ is NOT algebraicall closed, and thus there may not exist a point in V(i) over the Puiseux series field with the desired valuation; @*         + the Puiseux series field over the algebraic closure of Z/pZ is NOT algebraicall closed, and thus there may not exist a point in V(i) over the Puiseux series field with the desired valuation; so there is no chance that the procedure produced a sensible output - e.g. if i=tx^p-tx-1 @*         + if the dimension of i over Z/pZ(t) is not zero the process of reduction to zero might not work if the characteristic is small - e.g. if i=tx^p-tx-1 @*         + if the dimension of i over Z/pZ(t) is not zero the process of reduction to zero might not work if the characteristic is small and you are unlucky @*         + the option 'noAbs' has to be used since absolute primary decomposition in Singular only works in characteristic zero @*       - the basefield should either be Q or Z/pZ for some prime p; field extensions will be computed if necessary; if you need parameters or field extensions from the beginning they should rather be simulated as variables possibly adding their relations to @*         + the option 'noAbs' has to be used since absolute primary decomposition in @sc{Singular} only works in characteristic zero @*       - the basefield should either be Q or Z/pZ for some prime p; field extensions will be computed if necessary; if you need parameters or field extensions from the beginning they should rather be simulated as variables possibly adding their relations to the ideal; the weights for the additional variables should be zero EXAMPLE: example tropicalLifting;   shows an example" noabs=1; } // this option is not documented -- it prevents the execution of gfan and // just asks for wneu to be inserted -- it can be used to check problems // with the precedure without calling gfan, if wneu is know from previous // this option is not documented -- it prevents the execution of gfan and // just asks for wneu to be inserted -- it can be used to check problems // with the precedure without calling gfan, if wneu is know from previous // computations if (#[j]=="noGfan") } } // if the basering has characteristic not equal to zero, // if the basering has characteristic not equal to zero, // then absolute factorisation // is not available, and thus we need the option noAbs { Error("The first coordinate of your input w must be NON-ZERO, since it is a DENOMINATOR!"); } } // if w_0<0, then replace w by -w, so that the "denominator" w_0 is positive if (w[1]<0) } intvec prew=w; // stores w for later reference // for our computations, w[1] represents the weight of t and this // for our computations, w[1] represents the weight of t and this // should be -w_0 !!! w[1]=-w[1]; w[1]=-1; } // if some entry of w is positive, we have to make a transformation, // if some entry of w is positive, we have to make a transformation, // which moves it to something non-positive for (j=2;j<=nvars(basering);j++) { variablen=variablen+var(j); } } map GRUNDPHI=BASERING,t,variablen; ideal i=GRUNDPHI(i); // compute the initial ideal of i and test if w is in the tropical // variety of i // compute the initial ideal of i and test if w is in the tropical // variety of i // - the last entry 1 only means that t is the last variable in the ring ideal ini=tInitialIdeal(i,w,1); if (isintrop==0) // test if w is in trop(i) only if isInTrop has not been set { { poly product=1; for (j=1;j<=nvars(basering)-1;j++) int dd=dim(i); setring GRUNDRING; // if the dimension is not zero, we cut the ideal down to dimension zero // if the dimension is not zero, we cut the ideal down to dimension zero // and compute the // t-initial ideal of the new ideal at the same time if(dd!=0) { // the procedurce cutdown computes a new ring, in which there lives a // the procedurce cutdown computes a new ring, in which there lives a // zero-dimensional // ideal which has been computed by cutting down the input with // ideal which has been computed by cutting down the input with // generic linear forms // of the type x_i1-p_1,...,x_id-p_d for some polynomials // p_1,...,p_d not depending // on the variables x_i1,...,x_id; that way we have reduced // of the type x_i1-p_1,...,x_id-p_d for some polynomials // p_1,...,p_d not depending // on the variables x_i1,...,x_id; that way we have reduced // the number of variables by dd !!! // the new zero-dimensional ideal is called i, its t-initial // the new zero-dimensional ideal is called i, its t-initial // ideal (with respect to // the new w=CUTDOWN[2]) is ini, and finally there is a list // repl in the ring // the new w=CUTDOWN[2]) is ini, and finally there is a list // repl in the ring // which contains at the polynomial p_j at position i_j and //a zero otherwise; list liftrings; // will contain the final result // if the procedure is called without 'findAll' then it may happen, that no // proper solution is found when dd>0; in that case we have // proper solution is found when dd>0; in that case we have // to start all over again; // this is controlled by the while-loop // compute the liftrings by resubstitution kk=1;  // counts the liftrings int isgood;  // test in the non-zerodimensional case int isgood;  // test in the non-zerodimensional case // if the result has the correct valuation for (jj=1;jj<=size(TP);jj++) { // the list TP contains as a first entry the ring over which the // tropical parametrisation // the list TP contains as a first entry the ring over which the // tropical parametrisation // of the (possibly cutdown ideal) i lives def LIFTRING=TP[jj][1]; // if the dimension of i originally was not zero, // if the dimension of i originally was not zero, // then we have to fill in the missing // parts of the parametrisation if (dd!=0) { // we need a ring where the parameters X_1,...,X_k // we need a ring where the parameters X_1,...,X_k // from LIFTRING are present, // and where also the variables of CUTDOWNRING live execute("ring REPLACEMENTRING=("+charstr(LIFTRING)+"),("+varstr(CUTDOWNRING)+"),dp;"); list repl=imap(CUTDOWNRING,repl); // get the replacement rules list repl=imap(CUTDOWNRING,repl); // get the replacement rules // from CUTDOWNRING ideal PARA=imap(LIFTRING,PARA);   // get the zero-dim. parametrisatio ideal PARA=imap(LIFTRING,PARA);   // get the zero-dim. parametrisatio // from LIFTRING // compute the lift of the solution of the original ideal i k=1; // the lift has as many components as GRUNDRING has variables!=t for (j=1;j<=nvars(GRUNDRING)-1;j++) for (j=1;j<=nvars(GRUNDRING)-1;j++) { // if repl[j]=0, then the corresponding variable was not eliminated if (repl[j]==0) if (repl[j]==0) { LIFT[j]=PARA[k]; // thus the lift has been LIFT[j]=PARA[k]; // thus the lift has been // computed by tropicalparametrise k++; // k checks how many entries of PARA have already been used else  // if repl[j]!=0, repl[j] contains replacement rule for the lift { LIFT[j]=repl[j]; // we still have to replace the vars LIFT[j]=repl[j]; // we still have to replace the vars // in repl[j] by the corresp. entries of PARA // replace all variables!=t (from CUTDOWNRING) for (l=1;l<=nvars(CUTDOWNRING)-1;l++) for (l=1;l<=nvars(CUTDOWNRING)-1;l++) { // substitute the kth variable by PARA[k] LIFT[j]=subst(LIFT[j],var(l),PARA[l]); LIFT[j]=subst(LIFT[j],var(l),PARA[l]); } } } setring LIFTRING; ideal LIFT=imap(REPLACEMENTRING,LIFT); // test now if the LIFT has the correct valuation !!! // note: it may happen, that when resubstituting PARA into ideal LIFT=imap(REPLACEMENTRING,LIFT); // test now if the LIFT has the correct valuation !!! // note: it may happen, that when resubstituting PARA into //       the replacement rules //       there occured some unexpected cancellation; //       there occured some unexpected cancellation;