Changeset d96d51 in git


Ignore:
Timestamp:
May 21, 2010, 7:01:36 PM (14 years ago)
Author:
Hans Schoenemann <hannes@…>
Branches:
(u'fieker-DuVal', '117eb8c30fc9e991c4decca4832b1d19036c4c65')(u'spielwiese', '45e267b9942dec9429fe249ce3e5e44ab80a6a3a')
Children:
9d32ecfbdafd318114c653ba4b319fe24cde03ae
Parents:
96b106ffe8f65be0a6179966e3d9e24e18c6e416
Message:
format

git-svn-id: file:///usr/local/Singular/svn/trunk@12812 2c84dea3-7e68-4137-9b89-c4e89433aadc
File:
1 edited

Legend:

Unmodified
Added
Removed
  • Singular/LIB/tropical.lib

    r96b106 rd96d51  
    88@*               Thomas Markwig,  email: keilen@mathematik.uni-kl.de
    99
    10 WARNING: 
     10WARNING:
    1111- tropicalLifting will only work with LINUX and if in addition gfan is installed.
    12 @*- drawTropicalCurve and drawTropicalNewtonSubdivision will only display the 
    13 @*  tropical curve with LINUX and if in addition latex and kghostview 
     12@*- drawTropicalCurve and drawTropicalNewtonSubdivision will only display the
     13@*  tropical curve with LINUX and if in addition latex and kghostview
    1414@*  are installed.
    15 @*- For tropicalLifting in the definition of the basering the parameter t 
     15@*- For tropicalLifting in the definition of the basering the parameter t
    1616@*  from the Puiseux series field C{{t}} must be defined as a variable,
    1717@*  while for all other procedures it must be defined as a parameter.
    1818
    1919THEORY:
    20   Fix some base field K and a bunch of lattice points v0,...,vm in the integer 
    21   lattice Z^n, then this defines a toric variety as the closure of (K*)^n in 
    22   the projective space P^m, where the torus is embedded via the map sending a 
     20  Fix some base field K and a bunch of lattice points v0,...,vm in the integer
     21  lattice Z^n, then this defines a toric variety as the closure of (K*)^n in
     22  the projective space P^m, where the torus is embedded via the map sending a
    2323  point x in (K*)^n to the point (x^v0,...,x^vm).
    24   The generic hyperplane sections are just the images of the hypersurfaces 
     24  The generic hyperplane sections are just the images of the hypersurfaces
    2525  in (K*)^n defined by the polynomials f=a0*x^v0+...+am*x^vm=0. Some properties
    26   of these hypersurfaces can be studied via tropicalisation. 
    27 
    28   For this we suppose that K=C{{t}} is the field of Puiseux series over the 
     26  of these hypersurfaces can be studied via tropicalisation.
     27
     28  For this we suppose that K=C{{t}} is the field of Puiseux series over the
    2929  field of complex numbers (or any other field with a valuation into the real
    30   numbers). One associates to the hypersurface given by f=a0*x^v0+...+am*x^vm 
     30  numbers). One associates to the hypersurface given by f=a0*x^v0+...+am*x^vm
    3131  the tropical hypersurface defined by the tropicalisation
    32   trop(f)=min{val(a0)+<v0,x>,...,val(am)+<vm,x>}. 
     32  trop(f)=min{val(a0)+<v0,x>,...,val(am)+<vm,x>}.
    3333  Here, <v,x> denotes the standard scalar product of the integer vector v in Z^n
    3434  with the vector x=(x1,...,xn) of variables, so that trop(f) is a piecewise
    35   linear function on R^n. The corner locus of this function (i.e. the points 
    36   at which the minimum is attained a least twice) is the tropical hypersurface 
    37   defined by trop(f). 
    38   The theorem of Newton-Kapranov states that this tropical hypersurface is 
    39   the same as if one computes pointwise the valuation of the hypersurface 
    40   given by f. The analogue holds true if one replaces one equation f by an 
    41   ideal I. A constructive proof of the theorem is given by an adapted 
    42   version of the Newton-Puiseux algorithm. The hard part is to find a point 
    43   in the variety over C{{t}} which corresponds to a given point in the 
     35  linear function on R^n. The corner locus of this function (i.e. the points
     36  at which the minimum is attained a least twice) is the tropical hypersurface
     37  defined by trop(f).
     38  The theorem of Newton-Kapranov states that this tropical hypersurface is
     39  the same as if one computes pointwise the valuation of the hypersurface
     40  given by f. The analogue holds true if one replaces one equation f by an
     41  ideal I. A constructive proof of the theorem is given by an adapted
     42  version of the Newton-Puiseux algorithm. The hard part is to find a point
     43  in the variety over C{{t}} which corresponds to a given point in the
    4444  tropical variety.
    4545
    46   It is the purpose of this library to provide basic means to deal with 
    47   tropical varieties. Of course we cannot represent the field of Puiseux 
    48   series over C in its full strength, however, in order to compute interesting 
    49   examples it will be sufficient to replace the complex numbers C by the 
    50   rational numbers Q and to replace Puiseux series in t by rational functions 
    51   in t, i.e. we replace C{{t}} by Q(t), or sometimes even by Q[t]. 
     46  It is the purpose of this library to provide basic means to deal with
     47  tropical varieties. Of course we cannot represent the field of Puiseux
     48  series over C in its full strength, however, in order to compute interesting
     49  examples it will be sufficient to replace the complex numbers C by the
     50  rational numbers Q and to replace Puiseux series in t by rational functions
     51  in t, i.e. we replace C{{t}} by Q(t), or sometimes even by Q[t].
    5252  Note, that this in particular forbids rational exponents for the t's.
    5353
    5454  Moreover, in @sc{Singular} no negative exponents of monomials are allowed, so
    55   that the integer vectors vi will have to have non-negative entries. 
    56   Shifting all exponents by a fixed integer vector does not change the 
    57   tropicalisation nor does it change the toric variety. Thus this does not 
     55  that the integer vectors vi will have to have non-negative entries.
     56  Shifting all exponents by a fixed integer vector does not change the
     57  tropicalisation nor does it change the toric variety. Thus this does not
    5858  cause any restriction.
    59   If, however, for some reason you prefer to work with general vi, then you 
    60   have to pass right away to the tropicalisation of the equations, whereever 
     59  If, however, for some reason you prefer to work with general vi, then you
     60  have to pass right away to the tropicalisation of the equations, whereever
    6161  this is allowed -- these are linear polynomials where the constant coefficient
    62   corresponds to the valuation of the original coefficient and where 
    63   the non-constant coefficient correspond to the exponents of the monomials, 
    64   thus they may be rational numbers respectively negative numbers: 
     62  corresponds to the valuation of the original coefficient and where
     63  the non-constant coefficient correspond to the exponents of the monomials,
     64  thus they may be rational numbers respectively negative numbers:
    6565  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}.
    6666
    6767  The main tools provided in this library are as follows:
    68 @*  - tropicalLifting    implements the constructive proof of the Theorem of 
    69                          Newton-Kapranov and constructs a point in the variety 
    70                          over C{{t}} corresponding to a given point in the 
    71                          corresponding tropical variety associated to an 
    72                          ideal I; the generators of I have to be in the 
    73                          polynomial ring Q[t,x1,...,xn] considered as a 
    74                          subring of C{{t}}[x1,...,xn]; a solution will be 
    75                          constructed up to given order; note that several 
     68@*  - tropicalLifting    implements the constructive proof of the Theorem of
     69                         Newton-Kapranov and constructs a point in the variety
     70                         over C{{t}} corresponding to a given point in the
     71                         corresponding tropical variety associated to an
     72                         ideal I; the generators of I have to be in the
     73                         polynomial ring Q[t,x1,...,xn] considered as a
     74                         subring of C{{t}}[x1,...,xn]; a solution will be
     75                         constructed up to given order; note that several
    7676                         field extensions of Q might be necessary throughout
    7777                         the intermediate computations; the procedures use
    7878                         the external program gfan
    79 @*  - drawTropicalCurve  visualises a tropical plane curve either given by a 
    80                          polynomial in Q(t)[x,y] or by a list of linear 
    81                          polynomials of the form ax+by+c with a,b in Z and c 
     79@*  - drawTropicalCurve  visualises a tropical plane curve either given by a
     80                         polynomial in Q(t)[x,y] or by a list of linear
     81                         polynomials of the form ax+by+c with a,b in Z and c
    8282                         in Q; latex must be installed on your computer
    83 @*  - tropicalJInvariant computes the tropical j-invaiant of a tropical 
     83@*  - tropicalJInvariant computes the tropical j-invaiant of a tropical
    8484                         elliptic curve
    8585@*  - jInvariant         computes the j-invariant of an elliptic curve
    86 @*  - weierstrassForm     computes the Weierstrass form of an elliptic curve 
     86@*  - weierstrassForm     computes the Weierstrass form of an elliptic curve
    8787
    8888PROCEDURES FOR TROPICAL LIFTING:
    89   tropicalLifting()          computes a point in the tropical variety 
     89  tropicalLifting()          computes a point in the tropical variety
    9090  displayTropicalLifting()   displays the output of tropicalLifting
    9191
     
    107107  tInitialIdeal()      computes the tInitial ideal of an ideal in Q[t,x_1,...,x_n]
    108108  initialForm()        computes the initial form of poly in Q[x_1,...,x_n]
    109   initialIdeal()       computes the initial ideal of an ideal in Q[x_1,...,x_n] 
     109  initialIdeal()       computes the initial ideal of an ideal in Q[x_1,...,x_n]
    110110
    111111PROCEDURES FOR LATEX CONVERSION:
     
    115115  texDrawBasic()       embeds output of texDrawTropical in a texdraw environment
    116116  texDrawTropical()    computes the texdraw commands for a tropical curve
    117   texDrawNewtonSubdivision()   computes texdraw commands for a Newton subdivision 
     117  texDrawNewtonSubdivision()   computes texdraw commands for a Newton subdivision
    118118  texDrawTriangulation()       computes texdraw commands for a triangulation
    119119
     
    121121  radicalMemberShip()     checks radical membership
    122122  tInitialFormPar()       computes the t-initial form of poly in Q(t)[x_1,...,x_n]
    123   tInitialFormParMax()    same as tInitialFormPar, but uses maximum 
     123  tInitialFormParMax()    same as tInitialFormPar, but uses maximum
    124124  solveTInitialFormPar()  displays approximated solution of a 0-dim ideal
    125125  detropicalise()         computes the detropicalisation of a linear form
    126126  tDetropicalise()        computes the detropicalisation of a linear form
    127   dualConic()             computes the dual of an affine plane conic 
     127  dualConic()             computes the dual of an affine plane conic
    128128  parameterSubstitute()   substitutes in the polynomial the parameter t by t^N
    129129  tropicalSubst()         makes certain substitutions in a tropical polynomial
     
    156156/// - eliminatecomponents
    157157/// - findzerosAndBasictransform
    158 /// - ordermaximalideals 
     158/// - ordermaximalideals
    159159/// - verticesTropicalCurve
    160160/// - bunchOfLines
     
    205205
    206206///////////////////////////////////////////////////////////////////////////////
    207 /// Procedures concerned with tropical parametrisation 
     207/// Procedures concerned with tropical parametrisation
    208208///////////////////////////////////////////////////////////////////////////////
    209209
    210210proc tropicalLifting (ideal i,intvec w,int ordnung,list #)
    211211"USAGE:  tropicalLifting(i,w,ord[,opt]); i ideal, w intvec, ord int, opt string
    212 ASSUME:  - i is an ideal in Q[t,x_1,...,x_n], w=(w_0,w_1,...,w_n) 
    213            and (w_1/w_0,...,w_n/w_0) is in the tropical variety of i, 
    214            and ord is the order up to which a point in V(i) over Q{{t}} 
    215            lying over (w_1/w_0,...,w_n/w_0) shall be computed; 
     212ASSUME:  - i is an ideal in Q[t,x_1,...,x_n], w=(w_0,w_1,...,w_n)
     213           and (w_1/w_0,...,w_n/w_0) is in the tropical variety of i,
     214           and ord is the order up to which a point in V(i) over Q{{t}}
     215           lying over (w_1/w_0,...,w_n/w_0) shall be computed;
    216216           w_0 may NOT be ZERO
    217 @*       - the basering should not have any parameters on its own 
    218            and it should have a global monomial ordering, 
     217@*       - the basering should not have any parameters on its own
     218           and it should have a global monomial ordering,
    219219           e.g. ring r=0,(t,x(1..n)),dp;
    220 @*       - the first variable of the basering will be treated as the 
     220@*       - the first variable of the basering will be treated as the
    221221           parameter t in the Puiseux series field
    222 @*       - the optional parameter opt should be one or more strings among 
     222@*       - the optional parameter opt should be one or more strings among
    223223           the following:
    224224@*         'isZeroDimensional'  : the dimension i is zero (not to be checked);
    225 @*         'isPrime'            : the ideal is prime over Q(t)[x_1,...,x_n] 
     225@*         'isPrime'            : the ideal is prime over Q(t)[x_1,...,x_n]
    226226                                  (not to be checked);
    227 @*         'isInTrop'           : (w_1/w_0,...,w_n/w_0) is in the tropical 
     227@*         'isInTrop'           : (w_1/w_0,...,w_n/w_0) is in the tropical
    228228                                  variety (not to be checked);
    229 @*         'oldGfan'            : uses gfan version 0.2.1 or less 
    230 @*         'findAll'            : find all solutions of a zero-dimensional 
     229@*         'oldGfan'            : uses gfan version 0.2.1 or less
     230@*         'findAll'            : find all solutions of a zero-dimensional
    231231                                  ideal over (w_1/w_0,...,w_n/w_0)
    232232@*         'noAbs'              : do NOT use absolute primary decomposition
     
    234234RETURN:  IF THE OPTION 'findAll' WAS NOT SET THEN:
    235235@*       list, containing one lifting of the given point (w_1/w_0,...,w_n/w_0)
    236                in the tropical variety of i to a point in V(i) over Puiseux 
     236               in the tropical variety of i to a point in V(i) over Puiseux
    237237               series field up to the first ord terms; more precisely:
    238238@*             IF THE OPTION 'noAbs' WAS NOT SET, THEN:
     
    249249@*       IF THE OPITON 'findAll' WAS SET, THEN:
    250250@*       list, containing ALL liftings of the given point ((w_1/w_0,...,w_n/w_0)
    251                in the tropical variety of i to a point in V(i) over Puiseux 
    252                series field up to the first ord terms, if the ideal is 
     251               in the tropical variety of i to a point in V(i) over Puiseux
     252               series field up to the first ord terms, if the ideal is
    253253               zero-dimensional over Q{{t}};
    254                more precisely, each entry of the list is a list l as computed 
     254               more precisely, each entry of the list is a list l as computed
    255255               if  'findAll' was NOT set
    256256@*       WE NOW DESCRIBE THE LIST ENTRIES IF 'findAll' WAS NOT SET:
    257 @*       - the ring l[1] contains an ideal LIFT, which contains 
     257@*       - the ring l[1] contains an ideal LIFT, which contains
    258258           a point in V(i) lying over w up to the first ord terms;
    259 @*       - and if the integer l[2] is N then t has to be replaced by t^1/N 
     259@*       - and if the integer l[2] is N then t has to be replaced by t^1/N
    260260           in the lift, or alternatively replace t by t^N in the defining ideal
    261 @*       - if the k+1st entry of l[3] is  non-zero, then the kth component of 
    262            LIFT has to be multiplied t^(-l[3][k]/l[3][1]) AFTER substituting t 
     261@*       - if the k+1st entry of l[3] is  non-zero, then the kth component of
     262           LIFT has to be multiplied t^(-l[3][k]/l[3][1]) AFTER substituting t
    263263           by t^1/N
    264 @*       - unless the option 'noResubst' was set, the kth entry of list l[4] 
     264@*       - unless the option 'noResubst' was set, the kth entry of list l[4]
    265265           is a string which represents the kth generator of
    266            the ideal i where the coordinates have been replaced by the result 
     266           the ideal i where the coordinates have been replaced by the result
    267267           of the lift;
    268            the t-order of the kth entry should in principle be larger than the 
     268           the t-order of the kth entry should in principle be larger than the
    269269           t-degree of LIFT
    270 @*       - if the option 'noAbs' was set, then the string in l[5] defines 
    271            a maximal ideal in the field Q[X(1),...,X(k)], where X(1),...,X(k) 
     270@*       - if the option 'noAbs' was set, then the string in l[5] defines
     271           a maximal ideal in the field Q[X(1),...,X(k)], where X(1),...,X(k)
    272272           are the parameters of the ring in l[1];
    273            the basefield of the ring in l[1] should be considered modulo this 
     273           the basefield of the ring in l[1] should be considered modulo this
    274274           ideal
    275 REMARK:  - it is best to use the procedure displayTropicalLifting to 
     275REMARK:  - it is best to use the procedure displayTropicalLifting to
    276276           display the result
    277277@*       - the option 'findAll' cannot be used if 'noAbs' is set
    278278@*       - if the parameter 'findAll' is set AND the ideal i is zero-dimensional
    279            in Q{{t}}[x_1,...,x_n] then ALL points in V(i) lying over w are 
     279           in Q{{t}}[x_1,...,x_n] then ALL points in V(i) lying over w are
    280280           computed up to order ord; if the ideal is not-zero dimenisonal, then
    281281           only the points in the ideal after cutting down to dimension zero
    282282           will be computed
    283283@*       - the procedure requires that the program GFAN is installed on your
    284            computer; if you have GFAN version less than 0.3.0 then you must 
     284           computer; if you have GFAN version less than 0.3.0 then you must
    285285           use the optional parameter 'oldGfan'
    286286@*       - the procedure requires the @sc{Singular} procedure absPrimdecGTZ to be
    287287           present in the package primdec.lib, unless the option 'noAbs' is set;
    288            but even if absPrimdecGTZ is present it might be necessary to set 
    289            the option 'noAbs' in order to avoid the costly absolute primary 
    290            decomposition; the side effect is that the field extension which is 
     288           but even if absPrimdecGTZ is present it might be necessary to set
     289           the option 'noAbs' in order to avoid the costly absolute primary
     290           decomposition; the side effect is that the field extension which is
    291291           computed throughout the recursion might need more than one
    292292           parameter to be described
    293293@*       - since Q is infinite, the procedure finishes with probability one
    294 @*       - you can call the procedure with Z/pZ as base field instead of Q, 
     294@*       - you can call the procedure with Z/pZ as base field instead of Q,
    295295           but there are some problems you should be aware of:
    296 @*         + the Puiseux series field over the algebraic closure of Z/pZ is 
    297              NOT algebraicall closed, and thus there may not exist a point in 
    298              V(i) over the Puiseux series field with the desired valuation; 
     296@*         + the Puiseux series field over the algebraic closure of Z/pZ is
     297             NOT algebraicall closed, and thus there may not exist a point in
     298             V(i) over the Puiseux series field with the desired valuation;
    299299             so there is no chance that the procedure produced a sensible output
    300              - e.g. if i=tx^p-tx-1 
    301 @*         + if the dimension of i over Z/pZ(t) is not zero the process of 
    302              reduction to zero might not work if the characteristic is small 
     300             - e.g. if i=tx^p-tx-1
     301@*         + if the dimension of i over Z/pZ(t) is not zero the process of
     302             reduction to zero might not work if the characteristic is small
    303303             and you are unlucky
    304 @*         + the option 'noAbs' has to be used since absolute primary 
     304@*         + the option 'noAbs' has to be used since absolute primary
    305305             decomposition in @sc{Singular} only works in characteristic zero
    306 @*       - the basefield should either be Q or Z/pZ for some prime p; 
    307            field extensions will be computed if necessary; if you need 
    308            parameters or field extensions from the beginning they should 
    309            rather be simulated as variables possibly adding their relations to 
     306@*       - the basefield should either be Q or Z/pZ for some prime p;
     307           field extensions will be computed if necessary; if you need
     308           parameters or field extensions from the beginning they should
     309           rather be simulated as variables possibly adding their relations to
    310310           the ideal; the weights for the additional variables should be zero
    311311EXAMPLE: example tropicalLifting;   shows an example"
     
    358358      noabs=1;
    359359    }
    360     // this option is not documented -- it prevents the execution of gfan and 
    361     // just asks for wneu to be inserted -- it can be used to check problems 
    362     // with the precedure without calling gfan, if wneu is know from previous 
     360    // this option is not documented -- it prevents the execution of gfan and
     361    // just asks for wneu to be inserted -- it can be used to check problems
     362    // with the precedure without calling gfan, if wneu is know from previous
    363363    // computations
    364364    if (#[j]=="noGfan")
     
    371371    }
    372372  }
    373   // if the basering has characteristic not equal to zero, 
     373  // if the basering has characteristic not equal to zero,
    374374  // then absolute factorisation
    375375  // is not available, and thus we need the option noAbs
     
    385385  {
    386386    Error("The first coordinate of your input w must be NON-ZERO, since it is a DENOMINATOR!");
    387   } 
     387  }
    388388  // if w_0<0, then replace w by -w, so that the "denominator" w_0 is positive
    389389  if (w[1]<0)
     
    392392  }
    393393  intvec prew=w; // stores w for later reference
    394   // for our computations, w[1] represents the weight of t and this 
     394  // for our computations, w[1] represents the weight of t and this
    395395  // should be -w_0 !!!
    396396  w[1]=-w[1];
     
    402402    w[1]=-1;
    403403  }
    404   // if some entry of w is positive, we have to make a transformation, 
     404  // if some entry of w is positive, we have to make a transformation,
    405405  // which moves it to something non-positive
    406406  for (j=2;j<=nvars(basering);j++)
     
    428428  {
    429429    variablen=variablen+var(j);
    430   }   
     430  }
    431431  map GRUNDPHI=BASERING,t,variablen;
    432432  ideal i=GRUNDPHI(i);
    433   // compute the initial ideal of i and test if w is in the tropical 
    434   // variety of i 
     433  // compute the initial ideal of i and test if w is in the tropical
     434  // variety of i
    435435  // - the last entry 1 only means that t is the last variable in the ring
    436436  ideal ini=tInitialIdeal(i,w,1);
    437437  if (isintrop==0) // test if w is in trop(i) only if isInTrop has not been set
    438   {   
     438  {
    439439    poly product=1;
    440440    for (j=1;j<=nvars(basering)-1;j++)
     
    454454    int dd=dim(i);
    455455    setring GRUNDRING;
    456     // if the dimension is not zero, we cut the ideal down to dimension zero 
     456    // if the dimension is not zero, we cut the ideal down to dimension zero
    457457    // and compute the
    458458    // t-initial ideal of the new ideal at the same time
    459459    if(dd!=0)
    460460    {
    461       // the procedurce cutdown computes a new ring, in which there lives a 
     461      // the procedurce cutdown computes a new ring, in which there lives a
    462462      // zero-dimensional
    463       // ideal which has been computed by cutting down the input with 
     463      // ideal which has been computed by cutting down the input with
    464464      // generic linear forms
    465       // of the type x_i1-p_1,...,x_id-p_d for some polynomials 
    466       // p_1,...,p_d not depending 
    467       // on the variables x_i1,...,x_id; that way we have reduced 
     465      // of the type x_i1-p_1,...,x_id-p_d for some polynomials
     466      // p_1,...,p_d not depending
     467      // on the variables x_i1,...,x_id; that way we have reduced
    468468      // the number of variables by dd !!!
    469       // the new zero-dimensional ideal is called i, its t-initial 
     469      // the new zero-dimensional ideal is called i, its t-initial
    470470      // ideal (with respect to
    471       // the new w=CUTDOWN[2]) is ini, and finally there is a list 
    472       // repl in the ring 
     471      // the new w=CUTDOWN[2]) is ini, and finally there is a list
     472      // repl in the ring
    473473      // which contains at the polynomial p_j at position i_j and
    474474      //a zero otherwise;
     
    493493  list liftrings; // will contain the final result
    494494  // if the procedure is called without 'findAll' then it may happen, that no
    495   // proper solution is found when dd>0; in that case we have 
     495  // proper solution is found when dd>0; in that case we have
    496496  // to start all over again;
    497497  // this is controlled by the while-loop
     
    509509    // compute the liftrings by resubstitution
    510510    kk=1;  // counts the liftrings
    511     int isgood;  // test in the non-zerodimensional case 
     511    int isgood;  // test in the non-zerodimensional case
    512512                 // if the result has the correct valuation
    513513    for (jj=1;jj<=size(TP);jj++)
    514514    {
    515       // the list TP contains as a first entry the ring over which the 
    516       // tropical parametrisation 
     515      // the list TP contains as a first entry the ring over which the
     516      // tropical parametrisation
    517517      // of the (possibly cutdown ideal) i lives
    518518      def LIFTRING=TP[jj][1];
    519       // if the dimension of i originally was not zero, 
     519      // if the dimension of i originally was not zero,
    520520      // then we have to fill in the missing
    521521      // parts of the parametrisation
    522522      if (dd!=0)
    523523      {
    524         // we need a ring where the parameters X_1,...,X_k 
     524        // we need a ring where the parameters X_1,...,X_k
    525525        // from LIFTRING are present,
    526526        // and where also the variables of CUTDOWNRING live
    527527        execute("ring REPLACEMENTRING=("+charstr(LIFTRING)+"),("+varstr(CUTDOWNRING)+"),dp;");
    528         list repl=imap(CUTDOWNRING,repl); // get the replacement rules 
     528        list repl=imap(CUTDOWNRING,repl); // get the replacement rules
    529529                                          // from CUTDOWNRING
    530         ideal PARA=imap(LIFTRING,PARA);   // get the zero-dim. parametrisatio 
     530        ideal PARA=imap(LIFTRING,PARA);   // get the zero-dim. parametrisatio
    531531                                          // from LIFTRING
    532532        // compute the lift of the solution of the original ideal i
     
    534534        k=1;
    535535        // the lift has as many components as GRUNDRING has variables!=t
    536         for (j=1;j<=nvars(GRUNDRING)-1;j++) 
     536        for (j=1;j<=nvars(GRUNDRING)-1;j++)
    537537        {
    538538          // if repl[j]=0, then the corresponding variable was not eliminated
    539           if (repl[j]==0) 
     539          if (repl[j]==0)
    540540          {
    541             LIFT[j]=PARA[k]; // thus the lift has been 
     541            LIFT[j]=PARA[k]; // thus the lift has been
    542542                             // computed by tropicalparametrise
    543543            k++; // k checks how many entries of PARA have already been used
     
    545545          else  // if repl[j]!=0, repl[j] contains replacement rule for the lift
    546546          {
    547             LIFT[j]=repl[j]; // we still have to replace the vars 
     547            LIFT[j]=repl[j]; // we still have to replace the vars
    548548                             // in repl[j] by the corresp. entries of PARA
    549549            // replace all variables!=t (from CUTDOWNRING)
    550             for (l=1;l<=nvars(CUTDOWNRING)-1;l++) 
     550            for (l=1;l<=nvars(CUTDOWNRING)-1;l++)
    551551            {
    552552              // substitute the kth variable by PARA[k]
    553               LIFT[j]=subst(LIFT[j],var(l),PARA[l]); 
     553              LIFT[j]=subst(LIFT[j],var(l),PARA[l]);
    554554            }
    555555          }
    556556        }
    557557        setring LIFTRING;
    558         ideal LIFT=imap(REPLACEMENTRING,LIFT);   
    559         // test now if the LIFT has the correct valuation !!!     
    560         // note: it may happen, that when resubstituting PARA into 
     558        ideal LIFT=imap(REPLACEMENTRING,LIFT);
     559        // test now if the LIFT has the correct valuation !!!
     560        // note: it may happen, that when resubstituting PARA into
    561561        //       the replacement rules
    562         //       there occured some unexpected cancellation; 
     562        //       there occured some unexpected cancellation;
    563563        //       we only know that for SOME
    564         //       solution of the zero-dimensional reduction NO 
    565         //       canellation will occur, 
    566         //       but for others this may very well happen; 
     564        //       solution of the zero-dimensional reduction NO
     565        //       canellation will occur,
     566        //       but for others this may very well happen;
    567567        //       this in particular means that
    568         //       we possibly MUST compute all zero-dimensional 
     568        //       we possibly MUST compute all zero-dimensional
    569569        //       solutions when cutting down!
    570570        intvec testw=precutdownw[1];
     
    590590      kill PARA;
    591591      // only if LIFT has the right valuation we have to do something
    592       if (isgood==1) 
    593       {
    594         // it remains to reverse the original substitutions, 
     592      if (isgood==1)
     593      {
     594        // it remains to reverse the original substitutions,
    595595        // where appropriate !!!
    596         // if some entry of the original w was positive, 
     596        // if some entry of the original w was positive,
    597597        // we replace the corresponding
    598598        // variable x_i by t^-w[i]*x_i, so we must now replace
     
    611611        */
    612612        // if LIFTRING contains a parameter @a, change it to a
    613         if ((noabs==0) and (defined(@a)==-1)) 
     613        if ((noabs==0) and (defined(@a)==-1))
    614614        {
    615           // pass first to a ring where a and @a 
     615          // pass first to a ring where a and @a
    616616          // are variables in order to use maps
    617617          poly mp=minpoly;
     
    622622          // replace @a by a in minpoly and in LIFT
    623623          map phi=INTERRING,t,a,a;
    624           mp=phi(mp);     
     624          mp=phi(mp);
    625625          LIFT=phi(LIFT);
    626626          // pass now to a ring whithout @a and with a as parameter
     
    629629          ideal LIFT=imap(INTERRING,LIFT);
    630630          kill INTERRING;
    631         }   
     631        }
    632632        // then export LIFT
    633         export(LIFT); 
     633        export(LIFT);
    634634        // test the  result by resubstitution
    635         setring GRUNDRING; 
     635        setring GRUNDRING;
    636636        list resubst;
    637637        if (noresubst==0)
     
    642642          }
    643643          else
    644           {     
     644          {
    645645            resubst=tropicalliftingresubstitute(substitute(i,t,t^(TP[jj][2])),list(LIFTRING),N*TP[jj][2]);
    646646          }
    647647        }
    648648        setring BASERING;
    649         // Finally, if t has been replaced by t^N, then we have to change the 
     649        // Finally, if t has been replaced by t^N, then we have to change the
    650650        // third entry of TP by multiplying by N.
    651651        if (noabs==1)
     
    663663      kill LIFTRING;
    664664    }
    665     // if dd!=0 and the procedure was called without the 
     665    // if dd!=0 and the procedure was called without the
    666666    // option findAll, then it might very well
    667     // be the case that no solution is found, since 
     667    // be the case that no solution is found, since
    668668    // only one solution for the zero-dimensional
    669     // reduction was computed and this one might have 
     669    // reduction was computed and this one might have
    670670    // had cancellations when resubstituting;
    671671    // if so we have to restart the process with the option findAll
     
    675675      "The procedure will be restarted with the option 'findAll'.";
    676676      "Go on by hitting RETURN!";
    677       findall=1;   
     677      findall=1;
    678678      noabs=0;
    679679      setring CUTDOWNRING;
     
    681681      "i";i;
    682682      "ini";tInitialIdeal(i,w,1);
    683      
     683
    684684/*
    685685      setring GRUNDRING;
     
    699699    }
    700700  }
    701   // if internally the option findall was set, then return 
     701  // if internally the option findall was set, then return
    702702  // only the first solution
    703703  if (defined(hadproblems)!=0)
     
    708708  if (voice+printlevel>=2)
    709709  {
    710      
     710
    711711      "The procedure has created a list of lists. The jth entry of this list
    712712contains a ring, an integer and an intvec.
    713713In this ring lives an ideal representing the wanted lifting,
    714714if the integer is N then in the parametrisation t has to be replaced by t^1/N,
    715 and if the ith component of the intvec is w[i] then the ith component in LIFT 
     715and if the ith component of the intvec is w[i] then the ith component in LIFT
    716716should be multiplied by t^-w[i]/N in order to get the parametrisation.
    717    
     717
    718718Suppose your list has the name L, then you can access the 1st ring via:
    719719";
    720720    if (findall==1)
    721721    {
    722       "def LIFTRing=L[1][1]; setring LIFTRing; LIFT; 
     722      "def LIFTRing=L[1][1]; setring LIFTRing; LIFT;
    723723";
    724724    }
    725725    else
    726726    {
    727       "def LIFTRing=L[1]; setring LIFTRing; LIFT; 
     727      "def LIFTRing=L[1]; setring LIFTRing; LIFT;
    728728";
    729     } 
     729    }
    730730  }
    731731  if (findall==1) // if all solutions have been computed, return a list of lists
     
    752752   def LIFTRing=LIST[1];
    753753   setring LIFTRing;
    754    // LIFT contains the first 4 terms of a point in the variety of i 
     754   // LIFT contains the first 4 terms of a point in the variety of i
    755755   // over the Puiseux series field C{{t}} whose order is -w[1]/w[0]=1
    756756   LIFT;
     
    780780   // NOTE: since the last component of v is positive, the lifting
    781781   //       must start with a negative power of t, which in Singular
    782    //       is not allowed for a variable. 
     782   //       is not allowed for a variable.
    783783   def LIFTRing3=LIST[1];
    784784   setring LIFTRing3;
     
    835835      string Kstring="Z/"+string(char(LIFTRing))+"Z";
    836836    }
    837     // this means that tropicalLifting was called with 
     837    // this means that tropicalLifting was called with
    838838    // absolute primary decomposition
    839     if (size(troplift)==4) 
    840     {     
     839    if (size(troplift)==4)
     840    {
    841841      setring LIFTRing;
    842842      "The lifting of the point in the tropical variety lives in the ring";
    843843      if ((size(LIFTpar)==0) and (N==1))
    844844      {
    845         Kstring+"[[t]]"; 
     845        Kstring+"[[t]]";
    846846      }
    847847      if ((size(LIFTpar)==0) and (N!=1))
    848848      {
    849         Kstring+"[[t^(1/"+string(N)+")]]"; 
     849        Kstring+"[[t^(1/"+string(N)+")]]";
    850850      }
    851851      if ((size(LIFTpar)!=0) and (N!=1))
    852       {   
    853         Kstring+"["+LIFTpar+"]/"+string(minpoly)+"[[t^(1/"+string(N)+")]]"; 
     852      {
     853        Kstring+"["+LIFTpar+"]/"+string(minpoly)+"[[t^(1/"+string(N)+")]]";
    854854      }
    855855      if ((size(LIFTpar)!=0) and (N==1))
    856       {   
    857         Kstring+"["+LIFTpar+"]/"+string(minpoly)+"[[t]]"; 
     856      {
     857        Kstring+"["+LIFTpar+"]/"+string(minpoly)+"[[t]]";
    858858      }
    859859    }
     
    872872      }
    873873      if ((size(LIFTpar)!=0) and (N!=1))
    874       {   
    875         Kstring+"["+LIFTpar+"]/M[[t^(1/"+string(N)+")]]"; 
     874      {
     875        Kstring+"["+LIFTpar+"]/M[[t^(1/"+string(N)+")]]";
    876876        "where M is the maximal ideal";
    877877        "M=<"+m+">";
    878878      }
    879879      if ((size(LIFTpar)!=0) and (N==1))
    880       {   
    881         Kstring+"["+LIFTpar+"]/M[[t]]"; 
     880      {
     881        Kstring+"["+LIFTpar+"]/M[[t]]";
    882882        "where M is the maximal ideal";
    883883        "M=<"+m+">";
    884       }     
     884      }
    885885    }
    886886    "";
     
    909909      }
    910910    }
    911   }     
     911  }
    912912}
    913913example
     
    923923
    924924///////////////////////////////////////////////////////////////////////////////
    925 /// Procedures concerned with drawing a tropical curve or a Newton subdivision 
     925/// Procedures concerned with drawing a tropical curve or a Newton subdivision
    926926///////////////////////////////////////////////////////////////////////////////
    927927
    928928proc tropicalCurve (def tp,list #)
    929929"USAGE:      tropicalCurve(tp[,#]); tp list, # optional list
    930 ASSUME:      tp is list of linear polynomials of the form ax+by+c 
    931              with integers a, b and a rational number c representing 
     930ASSUME:      tp is list of linear polynomials of the form ax+by+c
     931             with integers a, b and a rational number c representing
    932932             a tropical Laurent polynomial defining a tropical plane curve;
    933              alternatively tp can be a polynomial in Q(t)[x,y] defining a 
    934              tropical plane curve via the valuation map; 
    935              the basering must have a global monomial ordering, 
     933             alternatively tp can be a polynomial in Q(t)[x,y] defining a
     934             tropical plane curve via the valuation map;
     935             the basering must have a global monomial ordering,
    936936             two variables and up to one parameter!
    937 RETURN:      list, each entry i=1,...,size(l)-1 corresponds to a vertex 
     937RETURN:      list, each entry i=1,...,size(l)-1 corresponds to a vertex
    938938                   in the tropical plane curve defined by tp
    939939                   l[i][1] = x-coordinate of the ith vertex
    940940                   l[i][2] = y-coordinate of the ith vertex
    941                    l[i][3] = intmat, if j is an entry in the first row 
     941                   l[i][3] = intmat, if j is an entry in the first row
    942942                             of intmat then the ith vertex of
    943                              the tropical curve is connected to the 
     943                             the tropical curve is connected to the
    944944                             jth vertex with multiplicity given
    945945                             by the corresponding entry in the second row
    946                    l[i][4] = list of lists, the first entry of a list is 
    947                              a primitive integer vector defining the direction 
    948                              of an unbounded edge emerging from the ith vertex 
    949                              of the graph, the corresponding second entry in 
     946                   l[i][4] = list of lists, the first entry of a list is
     947                             a primitive integer vector defining the direction
     948                             of an unbounded edge emerging from the ith vertex
     949                             of the graph, the corresponding second entry in
    950950                             the list is the multiplicity of the unbounded edge
    951                    l[i][5] = a polynomial whose monomials mark the vertices 
     951                   l[i][5] = a polynomial whose monomials mark the vertices
    952952                             in the Newton polygon corresponding to the entries
    953                              in tp which take the common minimum at the ith 
    954                              vertex -- if some coefficient a or b of the 
    955                              linear polynomials in the input was negative, 
     953                             in tp which take the common minimum at the ith
     954                             vertex -- if some coefficient a or b of the
     955                             linear polynomials in the input was negative,
    956956                             then each monomial has to be shifted by
    957957                             the values in l[size(l)][3]
    958                    l[size(l)][1] = list, the entries describe the boundary 
     958                   l[size(l)][1] = list, the entries describe the boundary
    959959                                         points of the Newton subdivision
    960                    l[size(l)][2] = list, the entries are pairs of integer 
     960                   l[size(l)][2] = list, the entries are pairs of integer
    961961                                         vectors defining an interior
    962962                                         edge of the Newton subdivision
    963                    l[size(l)][3] = intvec, the monmials occuring in l[i][5] 
    964                                            have to be shifted by this vector 
    965                                            in order to represent marked 
     963                   l[size(l)][3] = intvec, the monmials occuring in l[i][5]
     964                                           have to be shifted by this vector
     965                                           in order to represent marked
    966966                                           vertices in the Newton polygon
    967 NOTE:        here the tropical polynomial is supposed to be the MINIMUM 
    968              of the linear forms in tp, unless the optional input #[1] 
     967NOTE:        here the tropical polynomial is supposed to be the MINIMUM
     968             of the linear forms in tp, unless the optional input #[1]
    969969             is the string 'max'
    970970EXAMPLE:     example tropicalCurve;   shows an example"
     
    979979    ERROR("The basering should have a global monomial ordering, e.g. ring r=(0,t),(x,y),dp;");
    980980  }
    981   // if you insert a single polynomial instead of an ideal 
     981  // if you insert a single polynomial instead of an ideal
    982982  // representing a tropicalised polynomial,
    983   // then we compute first the tropicalisation of this polynomial 
     983  // then we compute first the tropicalisation of this polynomial
    984984  // -- this feature is not documented in the above help string
    985985  if (typeof(tp)=="poly")
    986986  {
    987     // exclude the case that the basering has not precisely 
     987    // exclude the case that the basering has not precisely
    988988    // one parameter and two indeterminates
    989989    if ((npars(basering)!=1) or (nvars(basering)!=2))
    990990    {
    991       ERROR("The basering should have precisely one parameter and two indeterminates!");     
     991      ERROR("The basering should have precisely one parameter and two indeterminates!");
    992992    }
    993993    poly f=tp;
     
    998998  if (nvars(basering) != 2)
    999999  {
    1000     ERROR("The basering should have precisely two indeterminates!");     
    1001   }
    1002   // -1) Exclude the pathological case that the defining 
     1000    ERROR("The basering should have precisely two indeterminates!");
     1001  }
     1002  // -1) Exclude the pathological case that the defining
    10031003  //     tropical polynomial has only one term,
    10041004  //     so that the tropical variety is not defined.
     
    10081008    intmat M[2][1]=0,0;
    10091009    return(list(list(0,0,M,list(),detropicalise(tp[1])),list(list(leadexp(detropicalise(tp[1]))),list())));
    1010   }   
    1011   // 0) If the input was a list of linear polynomials, 
     1010  }
     1011  // 0) If the input was a list of linear polynomials,
    10121012  //    then some coefficient of x or y can be negative,
    1013   //    i.e. the input corresponds to the tropical curve 
     1013  //    i.e. the input corresponds to the tropical curve
    10141014  //    of a Laurent polynomial. In that case we should
    1015   //    add some ax+by, so that all coefficients are positive. 
     1015  //    add some ax+by, so that all coefficients are positive.
    10161016  //    This does not change the tropical curve.
    1017   //    however, we have to save (a,b), since the Newton 
     1017  //    however, we have to save (a,b), since the Newton
    10181018  //    polygone has to be shifted by (-a,-b).
    10191019  poly aa,bb; // koeffizienten
     
    10271027    {
    10281028      bb=koeffizienten(tp[i],2);
    1029     }   
     1029    }
    10301030  }
    10311031  if ((aa!=0) or (bb!=0))
     
    10361036    }
    10371037  }
    1038   // 1) compute the vertices of the tropical curve 
     1038  // 1) compute the vertices of the tropical curve
    10391039  //    defined by tp and the Newton subdivision
    10401040  list vtp=verticesTropicalCurve(tp,#);
    1041   //    if vtp is empty, then the Newton polygone is just 
     1041  //    if vtp is empty, then the Newton polygone is just
    10421042  //    a line segment and constitutes a bunch of lines
    10431043  //    which can be computed by bunchOfLines
     
    10461046    return(bunchOfLines(tp));
    10471047  }
    1048   // 2) store all vertices belonging to the ith part of the 
     1048  // 2) store all vertices belonging to the ith part of the
    10491049  //    Newton subdivision in the list vtp[i] as 4th entry,
    10501050  //    and store those, which are not corners of the ith subdivision polygon
    10511051  //    in vtp[i][6]
    1052   poly nwt; 
     1052  poly nwt;
    10531053  list boundaryNSD;  // stores the boundary of a Newton subdivision
    1054   intmat zwsp[2][1]; // used for intermediate storage   
     1054  intmat zwsp[2][1]; // used for intermediate storage
    10551055  for (i=1;i<=size(vtp);i++)
    10561056  {
    10571057    k=1;
    1058     nwt=vtp[i][3]; // the polynomial representing the 
     1058    nwt=vtp[i][3]; // the polynomial representing the
    10591059    // ith part of the Newton subdivision
    1060     // store the vertices of the ith part of the 
     1060    // store the vertices of the ith part of the
    10611061    // Newton subdivision in the list newton
    1062     list newton; 
     1062    list newton;
    10631063    while (nwt!=0)
    10641064    {
     
    10671067      k++;
    10681068    }
    1069     boundaryNSD=findOrientedBoundary(newton);// a list of the vertices 
    1070                                              // of the Newton subdivision 
    1071                                              // as integer vectors (only those 
    1072                                              // on the boundary, and oriented 
     1069    boundaryNSD=findOrientedBoundary(newton);// a list of the vertices
     1070                                             // of the Newton subdivision
     1071                                             // as integer vectors (only those
     1072                                             // on the boundary, and oriented
    10731073                                             // clockwise)
    10741074    vtp[i][4]=boundaryNSD[1];
    10751075    vtp[i][5]=boundaryNSD[2];
    1076     vtp[i][6]=zwsp; // the entries of the first row will denote to which 
    1077                     // vertex the ith one is connected 
    1078                     // and the entries of the second row will denote 
     1076    vtp[i][6]=zwsp; // the entries of the first row will denote to which
     1077                    // vertex the ith one is connected
     1078                    // and the entries of the second row will denote
    10791079                    //with which multiplicity
    10801080    kill newton; // we kill the superflous list
    10811081  }
    1082   // 3) Next we build for each part of the Newton 
     1082  // 3) Next we build for each part of the Newton
    10831083  //    subdivision the list of all pairs of vertices on the
    10841084  //    boundary, which are involved, including those which are not corners
     
    10971097    kill ipairs;
    10981098  }
    1099   // 4) Check for all pairs of verticies in the Newton diagram if they 
     1099  // 4) Check for all pairs of verticies in the Newton diagram if they
    11001100  //    occur in two different parts of the Newton subdivision
    1101   int deleted; // if a pair occurs in two NSD, it can be removed 
     1101  int deleted; // if a pair occurs in two NSD, it can be removed
    11021102               // from both - deleted is then set to 1
    1103   list inneredges; // contains the list of all pairs contained in two NSD 
     1103  list inneredges; // contains the list of all pairs contained in two NSD
    11041104                   // - these are inner the edges of NSD
    11051105  int ggt;
    11061106  d=1;  // counts the inner edges
    11071107  for (i=1;i<=size(pairs)-1;i++)
    1108   { 
     1108  {
    11091109    for (j=i+1;j<=size(pairs);j++)
    11101110    {
     
    11131113        deleted=0;
    11141114        for (l=size(pairs[j]);l>=1 and deleted==0;l--)
    1115         { 
     1115        {
    11161116          if (((pairs[i][k][1]==pairs[j][l][1]) and (pairs[i][k][2]==pairs[j][l][2])) or ((pairs[i][k][1]==pairs[j][l][2]) and (pairs[i][k][2]==pairs[j][l][1])))
    11171117          {
     
    11191119            d++;
    11201120            ggt=abs(gcd(pairs[i][k][1][1]-pairs[i][k][2][1],pairs[i][k][1][2]-pairs[i][k][2][2]));
    1121             zwsp=j,ggt;   // and it is recorded that the ith and jth 
     1121            zwsp=j,ggt;   // and it is recorded that the ith and jth
    11221122                          // vertex should be connected with mult ggt
    11231123            vtp[i][6]=intmatconcat(vtp[i][6],zwsp);
    11241124            zwsp=i,ggt;
    11251125            vtp[j][6]=intmatconcat(vtp[j][6],zwsp);
    1126             pairs[i]=delete(pairs[i],k);  // finally the pair is deleted 
     1126            pairs[i]=delete(pairs[i],k);  // finally the pair is deleted
    11271127                                          // from both sets of pairs
    11281128            pairs[j]=delete(pairs[j],l);
     
    11641164    }
    11651165  }
    1166   // 6.3) Order the vertices such that passing from one to the next we 
     1166  // 6.3) Order the vertices such that passing from one to the next we
    11671167  //      travel along the boundary of the Newton polytope clock wise.
    11681168  boundaryNSD=findOrientedBoundary(vertices);
    11691169  list orderedvertices=boundaryNSD[1];
    11701170  // 7) Find the unbounded edges emerging from a vertex in the tropical curve.
    1171   //    For this we check the remaining pairs for the ith NSD. 
     1171  //    For this we check the remaining pairs for the ith NSD.
    11721172  //    Each pair is ordered according
    1173   //    to the order in which the vertices occur in orderedvertices. 
     1173  //    to the order in which the vertices occur in orderedvertices.
    11741174  //    The direction of the
    1175   //    unbounded edge is then the outward pointing primitive normal 
     1175  //    unbounded edge is then the outward pointing primitive normal
    11761176  //    vector to the vector
    11771177  //    pointing from the first vertex in a pair to the second one.
     
    11831183  for (i=1;i<=size(pairs);i++)
    11841184  {
    1185     list ubedges; // stores the unbounded edges 
     1185    list ubedges; // stores the unbounded edges
    11861186    k=1; // counts the unbounded edges
    11871187    for (j=1;j<=size(pairs[i]);j++)
    11881188    {
    11891189      // computes the position of the vertices in the
    1190       pos1=positionInList(orderedvertices,pairs[i][j][1]); 
     1190      pos1=positionInList(orderedvertices,pairs[i][j][1]);
    11911191      // pair in the list orderedvertices
    1192       pos2=positionInList(orderedvertices,pairs[i][j][2]); 
     1192      pos2=positionInList(orderedvertices,pairs[i][j][2]);
    11931193      if (((pos1>pos2) and !((pos1==size(orderedvertices)) and (pos2==1))) or ((pos2==size(orderedvertices)) and (pos1==1)))  // reorders them if necessary
    11941194      {
     
    11981198      }
    11991199      // the vector pointing from vertex 1 in the pair to vertex2
    1200       normalvector=pairs[i][j][2]-pairs[i][j][1]; 
     1200      normalvector=pairs[i][j][2]-pairs[i][j][1];
    12011201      ggt=gcd(normalvector[1],normalvector[2]);   // the gcd of the entries
    12021202      zw=normalvector[2];    // create the outward pointing normal vector
     
    12301230    kill ubedges;
    12311231  }
    1232   // 8) Store the computed information for the ith part 
     1232  // 8) Store the computed information for the ith part
    12331233  //    of the NSD in the list graph[i].
    12341234  list graph,gr;
     
    12361236  {
    12371237    // the first coordinate of the ith vertex of the tropical curve
    1238     gr[1]=vtp[i][1]; 
     1238    gr[1]=vtp[i][1];
    12391239    // the second coordinate of the ith vertex of the tropical curve
    1240     gr[2]=vtp[i][2]; 
     1240    gr[2]=vtp[i][2];
    12411241    // to which vertices is the ith vertex of the tropical curve connected
    1242     gr[3]=vtp[i][6]; 
    1243     // the directions unbounded edges emerging from the ith 
     1242    gr[3]=vtp[i][6];
     1243    // the directions unbounded edges emerging from the ith
    12441244    // vertex of the trop. curve
    1245     gr[4]=vtp[i][7]; 
    1246     // the vertices of the boundary of the ith part of the NSD 
    1247     gr[5]=vtp[i][3]; 
     1245    gr[4]=vtp[i][7];
     1246    // the vertices of the boundary of the ith part of the NSD
     1247    gr[5]=vtp[i][3];
    12481248    graph[i]=gr;
    12491249  }
     
    12641264    }
    12651265  }
    1266   // 10) Finally store the boundary vertices and 
     1266  // 10) Finally store the boundary vertices and
    12671267  //     the inner edges as last entry in the list graph.
    12681268  //     This represents the NSD.
     
    12811281// the coordinates of the first vertex are graph[1][1],graph[1][2];
    12821282   graph[1][1],graph[1][2];
    1283 // the first vertex is connected to the vertices 
     1283// the first vertex is connected to the vertices
    12841284//     graph[1][3][1,1..ncols(graph[1][3])]
    12851285   intmat M=graph[1][3];
    12861286   M[1,1..ncols(graph[1][3])];
    1287 // the weights of the edges to these vertices are 
     1287// the weights of the edges to these vertices are
    12881288//     graph[1][3][2,1..ncols(graph[1][3])]
    12891289   M[2,1..ncols(graph[1][3])];
    12901290// from the first vertex emerge size(graph[1][4]) unbounded edges
    12911291   size(graph[1][4]);
    1292 // the primitive integral direction vector of the first unbounded edge 
     1292// the primitive integral direction vector of the first unbounded edge
    12931293//     of the first vertex
    12941294   graph[1][4][1][1];
    12951295// the weight of the first unbounded edge of the first vertex
    12961296   graph[1][4][1][2];
    1297 // the monomials which are part of the Newton subdivision of the first vertex 
     1297// the monomials which are part of the Newton subdivision of the first vertex
    12981298   graph[1][5];
    1299 // connecting the points in graph[size(graph)][1] we get 
     1299// connecting the points in graph[size(graph)][1] we get
    13001300//     the boundary of the Newton polytope
    13011301   graph[size(graph)][1];
    1302 // an entry in graph[size(graph)][2] is a pair of points 
     1302// an entry in graph[size(graph)][2] is a pair of points
    13031303//     in the Newton polytope bounding an inner edge
    13041304   graph[size(graph)][2][1];
     
    13091309proc drawTropicalCurve (def f,list #)
    13101310"USAGE:      drawTropicalCurve(f[,#]); f poly or list, # optional list
    1311 ASSUME:      f is list of linear polynomials of the form ax+by+c with 
    1312              integers a, b and a rational number c representing a tropical 
     1311ASSUME:      f is list of linear polynomials of the form ax+by+c with
     1312             integers a, b and a rational number c representing a tropical
    13131313             Laurent polynomial defining a tropical plane curve;
    1314              alternatively f can be a polynomial in Q(t)[x,y] defining 
    1315              a tropical plane curve via the valuation map; 
    1316              the basering must have a global monomial ordering, two 
     1314             alternatively f can be a polynomial in Q(t)[x,y] defining
     1315             a tropical plane curve via the valuation map;
     1316             the basering must have a global monomial ordering, two
    13171317             variables and up to one parameter!
    13181318RETURN:      NONE
    1319 NOTE:        - the procedure creates the files /tmp/tropicalcurveNUMBER.tex and 
    1320                /tmp/tropicalcurveNUMBER.ps, where NUMBER is a random four 
    1321                digit integer; 
     1319NOTE:        - the procedure creates the files /tmp/tropicalcurveNUMBER.tex and
     1320               /tmp/tropicalcurveNUMBER.ps, where NUMBER is a random four
     1321               digit integer;
    13221322               moreover it displays the tropical curve via kghostview;
    1323                if you wish to remove all these files from /tmp, 
     1323               if you wish to remove all these files from /tmp,
    13241324               call the procedure cleanTmp
    13251325@*           - edges with multiplicity greater than one carry this multiplicity
    13261326@*           - if # is empty, then the tropical curve is computed w.r.t. minimum,
    1327                if #[1] is the string 'max', then it is computed w.r.t. maximum 
    1328 @*           - if the last optional argument is 'onlytexfile' then only the 
    1329                latex file is produced; this option should be used if kghostview 
     1327               if #[1] is the string 'max', then it is computed w.r.t. maximum
     1328@*           - if the last optional argument is 'onlytexfile' then only the
     1329               latex file is produced; this option should be used if kghostview
    13301330               is not installed on your system
    1331 @*           - note that lattice points in the Newton subdivision which are 
    1332                black correspond to markings of the marked subdivision, 
     1331@*           - note that lattice points in the Newton subdivision which are
     1332               black correspond to markings of the marked subdivision,
    13331333               while lattice points in grey are not marked
    13341334EXAMPLE:     example drawTropicalCurve  shows an example"
     
    13481348  if (typeof(f)=="poly")
    13491349  {
    1350     // exclude the case that the basering has not precisely 
     1350    // exclude the case that the basering has not precisely
    13511351    // one parameter and two indeterminates
    13521352    if ((npars(basering)!=1) or (nvars(basering)!=2))
    13531353    {
    1354       ERROR("The basering should have precisely one parameter and two indeterminates!");     
     1354      ERROR("The basering should have precisely one parameter and two indeterminates!");
    13551355    }
    13561356    // if the characteristic of the base field is not 0 then replace the base field
     
    13711371      texf="\\mbox{\\tt The defining equation was not handed over!}";
    13721372      list graph=f;
    1373     }   
     1373    }
    13741374    else
    13751375    { // write the tropical polynomial defined by f
    13761376      if (size(#)==0)
    1377       {     
     1377      {
    13781378        texf="\\min\\{";
    13791379      }
     
    13841384      for (j=1;j<=size(f);j++)
    13851385      {
    1386         texf=texf+texPolynomial(f[j]);   
     1386        texf=texf+texPolynomial(f[j]);
    13871387        if (j<size(f))
    13881388        {
     
    13931393          texf=texf+"\\}";
    13941394        }
    1395       }   
     1395      }
    13961396      list graph=tropicalCurve(f,#); // the graph of the tropical polynomial f
    13971397    }
     
    14111411\\addtolength{\\topmargin}{-\\headheight}
    14121412\\addtolength{\\topmargin}{-\\topskip}
    1413 \\setlength{\\textheight}{267mm} 
     1413\\setlength{\\textheight}{267mm}
    14141414\\addtolength{\\textheight}{\\topskip}
    14151415\\addtolength{\\textheight}{-\\footskip}
    14161416\\addtolength{\\textheight}{-30pt}
    1417 \\setlength{\\oddsidemargin}{-1in} 
     1417\\setlength{\\oddsidemargin}{-1in}
    14181418\\addtolength{\\oddsidemargin}{20mm}
    14191419\\setlength{\\evensidemargin}{\\oddsidemargin}
    1420 \\setlength{\\textwidth}{170mm} 
     1420\\setlength{\\textwidth}{170mm}
    14211421
    14221422\\begin{document}
    14231423   \\parindent0cm
    14241424   \\begin{center}
    1425       \\large\\bf The Tropicalisation of 
     1425      \\large\\bf The Tropicalisation of
    14261426
    14271427      \\bigskip
     
    14491449
    14501450   \\begin{center}
    1451        "+texDrawNewtonSubdivision(graph,#)+" 
     1451       "+texDrawNewtonSubdivision(graph,#)+"
    14521452   \\end{center}
    14531453\\end{document}";
     
    14561456    int rdnum=random(1000,9999);
    14571457    write(":w /tmp/tropicalcurve"+string(rdnum)+".tex",TEXBILD);
    1458     system("sh","cd /tmp; latex /tmp/tropicalcurve"+string(rdnum)+".tex; dvips /tmp/tropicalcurve"+string(rdnum)+".dvi -o; /bin/rm tropicalcurve"+string(rdnum)+".log;  /bin/rm tropicalcurve"+string(rdnum)+".aux;  /bin/rm tropicalcurve"+string(rdnum)+".ps?;  /bin/rm tropicalcurve"+string(rdnum)+".dvi; kghostview tropicalcurve"+string(rdnum)+".ps &"); 
     1458    system("sh","cd /tmp; latex /tmp/tropicalcurve"+string(rdnum)+".tex; dvips /tmp/tropicalcurve"+string(rdnum)+".dvi -o; /bin/rm tropicalcurve"+string(rdnum)+".log;  /bin/rm tropicalcurve"+string(rdnum)+".aux;  /bin/rm tropicalcurve"+string(rdnum)+".ps?;  /bin/rm tropicalcurve"+string(rdnum)+".dvi; kghostview tropicalcurve"+string(rdnum)+".ps &");
    14591459  }
    14601460  else
     
    14831483proc drawNewtonSubdivision (def f,list #)
    14841484"USAGE:   drawTropicalCurve(f[,#]); f poly, # optional list
    1485 ASSUME:   f is list of linear polynomials of the form ax+by+c with integers 
    1486           a, b and a rational number c representing a tropical Laurent 
     1485ASSUME:   f is list of linear polynomials of the form ax+by+c with integers
     1486          a, b and a rational number c representing a tropical Laurent
    14871487          polynomial defining a tropical plane curve;
    1488           alternatively f can be a polynomial in Q(t)[x,y] defining a tropical 
    1489           plane curve via the valuation map; 
    1490           the basering must have a global monomial ordering, two variables 
     1488          alternatively f can be a polynomial in Q(t)[x,y] defining a tropical
     1489          plane curve via the valuation map;
     1490          the basering must have a global monomial ordering, two variables
    14911491          and up to one parameter!
    14921492RETURN:   NONE
    1493 NOTE:     - the procedure creates the files /tmp/newtonsubdivisionNUMBER.tex, 
    1494             and /tmp/newtonsubdivisionNUMBER.ps, where NUMBER is a random 
    1495             four digit integer; 
     1493NOTE:     - the procedure creates the files /tmp/newtonsubdivisionNUMBER.tex,
     1494            and /tmp/newtonsubdivisionNUMBER.ps, where NUMBER is a random
     1495            four digit integer;
    14961496            moreover it desplays the tropical curve defined by f via kghostview;
    1497             if you wish to remove all these files from /tmp, call the procedure 
     1497            if you wish to remove all these files from /tmp, call the procedure
    14981498            cleanTmp;
    1499 @*          if # is empty, then the tropical curve is computed w.r.t. minimum, 
    1500             if #[1] is the string 'max', then it is computed w.r.t. maximum 
    1501 @*        - note that lattice points in the Newton subdivision which are black 
    1502             correspond to markings of the marked subdivision, while lattice 
     1499@*          if # is empty, then the tropical curve is computed w.r.t. minimum,
     1500            if #[1] is the string 'max', then it is computed w.r.t. maximum
     1501@*        - note that lattice points in the Newton subdivision which are black
     1502            correspond to markings of the marked subdivision, while lattice
    15031503            points in grey are not marked
    15041504EXAMPLE:     example drawNewtonSubdivision;   shows an example"
     
    15141514  { // write the tropical polynomial defined by f
    15151515    if (size(#)==0)
    1516     {     
     1516    {
    15171517      texf="\\min\\{";
    15181518    }
     
    15231523    for (j=1;j<=size(f);j++)
    15241524    {
    1525       texf=texf+texPolynomial(f[j]);   
     1525      texf=texf+texPolynomial(f[j]);
    15261526      if (j<size(f))
    15271527      {
     
    15321532        texf=texf+"\\}";
    15331533      }
    1534     }   
     1534    }
    15351535    list graph=tropicalCurve(f,#); // the graph of the tropical polynomial f
    15361536  }
     
    15401540   \\parindent0cm
    15411541   \\begin{center}
    1542       \\large\\bf The Newtonsubdivison of 
     1542      \\large\\bf The Newtonsubdivison of
    15431543      \\begin{displaymath}
    15441544          f="+texf+"
     
    15481548
    15491549   \\begin{center}
    1550 "+texDrawNewtonSubdivision(graph)+ 
     1550"+texDrawNewtonSubdivision(graph)+
    15511551"   \\end{center}
    15521552
     
    15541554  int rdnum=random(1000,9999);
    15551555  write(":w /tmp/newtonsubdivision"+string(rdnum)+".tex",TEXBILD);
    1556   system("sh","cd /tmp; latex /tmp/newtonsubdivision"+string(rdnum)+".tex; dvips /tmp/newtonsubdivision"+string(rdnum)+".dvi -o; /bin/rm newtonsubdivision"+string(rdnum)+".log;  /bin/rm newtonsubdivision"+string(rdnum)+".aux;  /bin/rm newtonsubdivision"+string(rdnum)+".ps?;  /bin/rm newtonsubdivision"+string(rdnum)+".dvi; kghostview newtonsubdivision"+string(rdnum)+".ps &"); 
     1556  system("sh","cd /tmp; latex /tmp/newtonsubdivision"+string(rdnum)+".tex; dvips /tmp/newtonsubdivision"+string(rdnum)+".dvi -o; /bin/rm newtonsubdivision"+string(rdnum)+".log;  /bin/rm newtonsubdivision"+string(rdnum)+".aux;  /bin/rm newtonsubdivision"+string(rdnum)+".ps?;  /bin/rm newtonsubdivision"+string(rdnum)+".dvi; kghostview newtonsubdivision"+string(rdnum)+".ps &");
    15571557//  return(TEXBILD);
    15581558}
     
    15791579proc tropicalJInvariant (def f,list #)
    15801580"USAGE:      tropicalJInvariant(f[,#]); f poly or list, # optional list
    1581 ASSUME:      f is list of linear polynomials of the form ax+by+c with integers 
    1582              a, b and a rational number c representing a tropical Laurent 
     1581ASSUME:      f is list of linear polynomials of the form ax+by+c with integers
     1582             a, b and a rational number c representing a tropical Laurent
    15831583             polynomial defining a tropical plane curve;
    1584              alternatively f can be a polynomial in Q(t)[x,y] defining a 
    1585              tropical plane curve via the valuation map; 
    1586 @*           the basering must have a global monomial ordering, two variables 
     1584             alternatively f can be a polynomial in Q(t)[x,y] defining a
     1585             tropical plane curve via the valuation map;
     1586@*           the basering must have a global monomial ordering, two variables
    15871587             and up to one parameter!
    1588 RETURN:      number, if the graph underlying the tropical curve has precisely 
    1589                      one loop then its weighted lattice length is returned, 
     1588RETURN:      number, if the graph underlying the tropical curve has precisely
     1589                     one loop then its weighted lattice length is returned,
    15901590                     otherwise the result will be -1
    1591 NOTE:        - if the tropical curve is elliptic and its embedded graph has 
    1592                precisely one loop, then the weigthed lattice length of 
     1591NOTE:        - if the tropical curve is elliptic and its embedded graph has
     1592               precisely one loop, then the weigthed lattice length of
    15931593               the loop is its tropical j-invariant
    1594 @*           - the procedure checks if the embedded graph of the tropical 
    1595                curve has genus one, but it does NOT check if the loop can 
    1596                be resolved, so that the curve is not a proper tropical 
    1597                elliptic curve 
    1598 @*           - if the embedded graph of a tropical elliptic curve has more 
    1599                than one loop, then all but one can be resolved, but this is 
    1600                not observed by this procedure, so it will not compute 
     1594@*           - the procedure checks if the embedded graph of the tropical
     1595               curve has genus one, but it does NOT check if the loop can
     1596               be resolved, so that the curve is not a proper tropical
     1597               elliptic curve
     1598@*           - if the embedded graph of a tropical elliptic curve has more
     1599               than one loop, then all but one can be resolved, but this is
     1600               not observed by this procedure, so it will not compute
    16011601               the j-invariant
    16021602@*           - if # is empty, then the tropical curve is computed w.r.t. minimum,
    1603                if #[1] is the string 'max', then it is computed w.r.t. maximum 
    1604 @*           - the tropicalJInvariant of a plane tropical cubic is the 
    1605                'cycle length' of the cubic as introduced in the paper: 
    1606                Eric Katz, Hannah Markwig, Thomas Markwig: The j-invariant 
     1603               if #[1] is the string 'max', then it is computed w.r.t. maximum
     1604@*           - the tropicalJInvariant of a plane tropical cubic is the
     1605               'cycle length' of the cubic as introduced in the paper:
     1606               Eric Katz, Hannah Markwig, Thomas Markwig: The j-invariant
    16071607               of a cubic tropical plane curve.
    16081608EXAMPLE:     example tropicalJInvariant;   shows an example"
     
    16181618    {
    16191619      if (typeof(f[1])=="list")
    1620       {       
     1620      {
    16211621        list graph=f;
    16221622      }
     
    16301630        {
    16311631          ERROR("This is no valid input.");
    1632         }       
     1632        }
    16331633      }
    16341634    }
     
    16471647  genus=-genus/2; // we have counted each bounded edge twice
    16481648  genus=genus+size(graph); // the genus is 1-#bounded_edges+#vertices
    1649   // 3) if the embedded graph has not genus one, 
     1649  // 3) if the embedded graph has not genus one,
    16501650  //    we cannot compute the j-invariant
    16511651  if(genus!=1)
     
    16591659  else
    16601660  {
    1661     intmat nullmat[2][1];  // used to set 
    1662     // 4) find a vertex which has only one bounded edge, 
    1663     //    if none exists zero is returned, 
     1661    intmat nullmat[2][1];  // used to set
     1662    // 4) find a vertex which has only one bounded edge,
     1663    //    if none exists zero is returned,
    16641664    //    otherwise the number of the vertex in the list graph
    1665     int nonloopvertex=findNonLoopVertex(graph);   
     1665    int nonloopvertex=findNonLoopVertex(graph);
    16661666    int dv; //checks if vert. has been found to which nonloopvertex is connected
    1667     intmat delvert; // takes for a moment graph[i][3] of the vertex 
     1667    intmat delvert; // takes for a moment graph[i][3] of the vertex
    16681668                    // to which nonloopvertex is connected
    1669     // 5) delete successively vertices in the graph which 
     1669    // 5) delete successively vertices in the graph which
    16701670    //    have only one bounded edge
    16711671    while (nonloopvertex>0)
    16721672    {
    1673       // find the only vertex to which the nonloopvertex 
     1673      // find the only vertex to which the nonloopvertex
    16741674      // is connected, when it is found
    16751675      // delete the connection in graph[i][3] and set dv=1
     
    16841684            {
    16851685              delvert=graph[i][3];
    1686               delvert=intmatcoldelete(delvert,j); // delete the connection (note 
     1686              delvert=intmatcoldelete(delvert,j); // delete the connection (note
    16871687                                                  // there must have been two!)
    16881688              dv=1;
     
    16921692        }
    16931693      }
    1694       graph[nonloopvertex][3]=nullmat; // the only connection of nonloopvertex 
     1694      graph[nonloopvertex][3]=nullmat; // the only connection of nonloopvertex
    16951695                                       // is killed
    1696       nonloopvertex=findNonLoopVertex(graph); // find the next vertex 
     1696      nonloopvertex=findNonLoopVertex(graph); // find the next vertex
    16971697                                              // which has only one edge
    16981698    }
     
    17001700    intvec loop,weights; // encodes the loop and the edges
    17011701    i=1;
    1702     //    start by finding some vertex which belongs to the loop 
    1703     while (loop==0) 
     1702    //    start by finding some vertex which belongs to the loop
     1703    while (loop==0)
    17041704    {
    17051705      // if graph[i][3] of a vertex in the loop has 2 columns, all others have 1
    1706       if (ncols(graph[i][3])==1) 
     1706      if (ncols(graph[i][3])==1)
    17071707      {
    17081708        i++;
     
    17101710      else
    17111711      {
    1712         loop[1]=i; // a starting vertex is found 
    1713         loop[2]=graph[i][3][1,1]; // it is connected to vertex with this number 
     1712        loop[1]=i; // a starting vertex is found
     1713        loop[2]=graph[i][3][1,1]; // it is connected to vertex with this number
    17141714        weights[2]=graph[i][3][2,1]; // and the edge has this weight
    17151715      }
     
    17191719    while (j!=i)  // the loop ends with the same vertex with which it starts
    17201720    {
    1721       // the first row of graph[j][3] has two entries 
     1721      // the first row of graph[j][3] has two entries
    17221722      // corresponding to the two vertices
    1723       // to which the active vertex j is connected; 
     1723      // to which the active vertex j is connected;
    17241724      // one is loop[k-1], i.e. the one which
    17251725      // precedes j in the loop; we have to choose the other one
    1726       if (graph[j][3][1,1]==loop[k-1]) 
     1726      if (graph[j][3][1,1]==loop[k-1])
    17271727      {
    17281728        loop[k+1]=graph[j][3][1,2];
     
    17351735      }
    17361736      j=loop[k+1]; // set loop[k+1] the new active vertex
    1737       k++; 
    1738     }   
     1737      k++;
     1738    }
    17391739    // 7) compute for each edge in the loop the lattice length
    1740     poly xcomp,ycomp; // the x- and y-components of the vectors 
     1740    poly xcomp,ycomp; // the x- and y-components of the vectors
    17411741                      // connecting two vertices of the loop
    1742     number nenner;    // the product of the denominators of 
     1742    number nenner;    // the product of the denominators of
    17431743                      // the x- and y-components
    17441744    number jinvariant;  // the j-invariant
    1745     int eins,zwei,ggt; 
     1745    int eins,zwei,ggt;
    17461746    for (i=1;i<=size(loop)-1;i++) // compute the lattice length for each edge
    17471747    {
    1748       xcomp=graph[loop[i]][1]-graph[loop[i+1]][1]; 
    1749       ycomp=graph[loop[i]][2]-graph[loop[i+1]][2]; 
     1748      xcomp=graph[loop[i]][1]-graph[loop[i+1]][1];
     1749      ycomp=graph[loop[i]][2]-graph[loop[i+1]][2];
    17501750      nenner=denominator(leadcoef(xcomp))*denominator(leadcoef(ycomp));
    1751       execute("eins="+string(numerator(leadcoef(nenner*xcomp)))+";"); 
    1752       execute("zwei="+string(numerator(leadcoef(nenner*ycomp)))+";"); 
     1751      execute("eins="+string(numerator(leadcoef(nenner*xcomp)))+";");
     1752      execute("zwei="+string(numerator(leadcoef(nenner*ycomp)))+";");
    17531753      ggt=gcd(eins,zwei); // the lattice length is the "gcd"
    17541754                          // of the x-component and the y-component
    1755       jinvariant=jinvariant+ggt/(nenner*weights[i+1]); // divided by the 
     1755      jinvariant=jinvariant+ggt/(nenner*weights[i+1]); // divided by the
    17561756                                                       // weight of the edge
    17571757    }
    1758     return(jinvariant);   
     1758    return(jinvariant);
    17591759  }
    17601760}
     
    17701770// the curve can have arbitrary degree
    17711771   tropicalJInvariant(t*(x7+y7+1)+1/t*(x4+y4+x2+y2+x3y+xy3)+1/t7*x2y2);
    1772 // the procedure does not realise, if the embedded graph of the tropical 
     1772// the procedure does not realise, if the embedded graph of the tropical
    17731773//     curve has a loop that can be resolved
    17741774   tropicalJInvariant(1+x+y+xy+tx2y+txy2);
    17751775// but it does realise, if the curve has no loop at all ...
    17761776   tropicalJInvariant(x+y+1);
    1777 // or if the embedded graph has more than one loop - even if only one 
     1777// or if the embedded graph has more than one loop - even if only one
    17781778//     cannot be resolved
    17791779   tropicalJInvariant(1+x+y+xy+tx2y+txy2+t3x5+t3y5+tx2y2+t2xy4+t2yx4);
     
    17841784proc weierstrassForm (poly f,list #)
    17851785"USAGE:      weierstrassForm(wf[,#]); wf poly, # list
    1786 ASSUME:      wf is a a polynomial whose Newton polygon has precisely one 
    1787              interior lattice point, so that it defines an elliptic curve 
     1786ASSUME:      wf is a a polynomial whose Newton polygon has precisely one
     1787             interior lattice point, so that it defines an elliptic curve
    17881788             on the toric surface corresponding to the Newton polygon
    17891789RETURN:      poly, the Weierstrass normal form of the polynomial
     
    17911791               to Fernando Rodriguez Villegas, villegas@math.utexas.edu
    17921792@*           - the characteristic of the base field should not be 2 or 3
    1793 @*           - if an additional argument # is given, a simplified Weierstrass 
     1793@*           - if an additional argument # is given, a simplified Weierstrass
    17941794               form is computed
    17951795EXAMPLE:     example weierstrassForm;   shows an example"
     
    18521852
    18531853proc jInvariant (poly f,list #)
    1854 "USAGE:      jInvariant(f[,#]); f poly, # list 
    1855 ASSUME:      - f is a a polynomial whose Newton polygon has precisely one 
    1856                interior lattice point, so that it defines an elliptic curve 
     1854"USAGE:      jInvariant(f[,#]); f poly, # list
     1855ASSUME:      - f is a a polynomial whose Newton polygon has precisely one
     1856               interior lattice point, so that it defines an elliptic curve
    18571857               on the toric surface corresponding to the Newton polygon
    1858 @*           - it the optional argument # is present the base field should be 
    1859                Q(t) and the optional argument should be one of the following 
     1858@*           - it the optional argument # is present the base field should be
     1859               Q(t) and the optional argument should be one of the following
    18601860               strings:
    1861 @*             'ord'   : then the return value is of type integer, 
     1861@*             'ord'   : then the return value is of type integer,
    18621862                         namely the order of the j-invariant
    1863 @*             'split' : then the return value is a list of two polynomials, 
     1863@*             'split' : then the return value is a list of two polynomials,
    18641864                         such that the quotient of these two is the j-invariant
    18651865RETURN:      poly, the j-invariant of the elliptic curve defined by poly
    1866 NOTE:        the characteristic of the base field should not be 2 or 3, 
     1866NOTE:        the characteristic of the base field should not be 2 or 3,
    18671867             unless the input is a plane cubic
    18681868EXAMPLE:     example jInvariant;   shows an example"
     
    18901890   echo=2;
    18911891   ring r=(0,t),(x,y),dp;
    1892 // jInvariant computes the j-invariant of a cubic 
     1892// jInvariant computes the j-invariant of a cubic
    18931893   jInvariant(x+y+x2y+y3+1/t*xy);
    1894 // if the ground field has one parameter t, then we can instead 
     1894// if the ground field has one parameter t, then we can instead
    18951895//    compute the order of the j-invariant
    18961896   jInvariant(x+y+x2y+y3+1/t*xy,"ord");
     
    19001900   poly h=x22y11+x19y10+x17y9+x16y9+x12y7+x9y6+x7y5+x2y3+x14y8;
    19011901// its j-invariant is
    1902    jInvariant(h); 
     1902   jInvariant(h);
    19031903}
    19041904
     
    19191919@*                 l[6] = a list containing the vertices of the tropical conic f
    19201920@*                 l[7] = a list containing lists with vertices of the tangents
    1921 @*                 l[8] = a string which contains the latex-code to draw the 
     1921@*                 l[8] = a string which contains the latex-code to draw the
    19221922                          tropical conic and its tropicalised tangents
    19231923@*                 l[9] = if # is non-empty, this is the same data for the dual
     
    19431943  ring LINRING=(0,t),(x,y,a(1..6)),lp;
    19441944  list points=imap(BASERING,points);
    1945   ideal I; // the ideal will contain the linear equations given by the conic 
     1945  ideal I; // the ideal will contain the linear equations given by the conic
    19461946           // and the points
    19471947  for (i=1;i<=5;i++)
     
    19641964  ring tRING=0,t,ls;
    19651965  list pointdenom=imap(BASERING,pointdenom);
    1966   list pointnum=imap(BASERING,pointnum); 
     1966  list pointnum=imap(BASERING,pointnum);
    19671967  intvec pointcoordinates;
    19681968  for (i=1;i<=size(pointdenom);i++)
     
    20402040   We consider the concic through the following five points:
    20412041   \\begin{displaymath}
    2042 "; 
     2042";
    20432043  string texf=texDrawTropical(graphf,list("",scalefactor));
    20442044  for (i=1;i<=size(points);i++)
     
    20772077\\end{document}";
    20782078  setring BASERING;
    2079   // If # non-empty, compute the dual conic and the tangents 
    2080   // through the dual points 
     2079  // If # non-empty, compute the dual conic and the tangents
     2080  // through the dual points
    20812081  // corresponding to the tangents of the given conic.
    20822082  if (size(#)>0)
    20832083  {
    20842084    list dualpoints;
    2085     for (i=1;i<=size(points);i++) 
     2085    for (i=1;i<=size(points);i++)
    20862086    {
    20872087      dualpoints[i]=list(leadcoef(tangents[i])/substitute(tangents[i],x,0,y,0),leadcoef(tangents[i]-lead(tangents[i]))/substitute(tangents[i],x,0,y,0));
     
    21072107// conic[2] is the equation of the conic f passing through the five points
    21082108   conic[2];
    2109 // conic[3] is a list containing the equations of the tangents 
     2109// conic[3] is a list containing the equations of the tangents
    21102110//          through the five points
    21112111   conic[3];
    21122112// conic[4] is an ideal representing the tropicalisation of the conic f
    21132113   conic[4];
    2114 // conic[5] is a list containing the tropicalisation 
     2114// conic[5] is a list containing the tropicalisation
    21152115//          of the five tangents in conic[3]
    21162116   conic[5];
    2117 // conic[6] is a list containing the vertices of the tropical conic 
     2117// conic[6] is a list containing the vertices of the tropical conic
    21182118   conic[6];
    21192119// conic[7] is a list containing the vertices of the five tangents
    21202120   conic[7];
    2121 // conic[8] contains the latex code to draw the tropical conic and 
    2122 //          its tropicalised tangents; it can written in a file, processed and 
    2123 //          displayed via kghostview 
    2124    write(":w /tmp/conic.tex",conic[8]);   
    2125    system("sh","cd /tmp; latex /tmp/conic.tex; dvips /tmp/conic.dvi -o; 
     2121// conic[8] contains the latex code to draw the tropical conic and
     2122//          its tropicalised tangents; it can written in a file, processed and
     2123//          displayed via kghostview
     2124   write(":w /tmp/conic.tex",conic[8]);
     2125   system("sh","cd /tmp; latex /tmp/conic.tex; dvips /tmp/conic.dvi -o;
    21262126            kghostview conic.ps &");
    2127 // with an optional argument the same information for the dual conic is computed 
     2127// with an optional argument the same information for the dual conic is computed
    21282128//         and saved in conic[9]
    21292129   conic=conicWithTangents(points,1);
    21302130   conic[9][2]; // the equation of the dual conic
    21312131}
    2132  
     2132
    21332133///////////////////////////////////////////////////////////////////////////////
    21342134/// Procedures concerned with tropicalisation
     
    21392139ASSUME:      f is a polynomial in Q(t)[x_1,...,x_n]
    21402140RETURN:      list, the linear forms of the tropicalisation of f
    2141 NOTE:        if # is empty, then the valuation of t will be 1, 
    2142 @*           if # is the string 'max' it will be -1; 
    2143 @*           the latter supposes that we consider the maximum of the 
     2141NOTE:        if # is empty, then the valuation of t will be 1,
     2142@*           if # is the string 'max' it will be -1;
     2143@*           the latter supposes that we consider the maximum of the
    21442144             computed linear forms, the former that we consider their minimum
    21452145EXAMPLE:     example tropicalise;   shows an example"
     
    21642164    {
    21652165      tropicalf[i]=tropicalf[i]+exp[j]*var(j);
    2166     }   
     2166    }
    21672167    f=f-lead(f);
    21682168  }
     
    22042204/////////////////////////////////////////////////////////////////////////
    22052205
    2206 proc tInitialForm (poly f, intvec w) 
     2206proc tInitialForm (poly f, intvec w)
    22072207"USAGE:      tInitialForm(f,w); f a polynomial, w an integer vector
    22082208ASSUME:      f is a polynomial in Q[t,x_1,...,x_n] and w=(w_0,w_1,...,w_n)
    22092209RETURN:      poly, the t-initialform of f(t,x) w.r.t. w evaluated at t=1
    2210 NOTE:        the t-initialform is the sum of the terms with MAXIMAL 
     2210NOTE:        the t-initialform is the sum of the terms with MAXIMAL
    22112211             weighted order w.r.t. w
    22122212EXAMPLE:     example tInitialForm;   shows an example"
     
    22182218  // do the same for the remaining part of f and compare the results
    22192219  // keep only the smallest ones
    2220   int vglgewicht; 
    2221   f=f-lead(f); 
     2220  int vglgewicht;
     2221  f=f-lead(f);
    22222222  while (f!=0)
    22232223  {
     
    22342234        initialf=initialf+lead(f);
    22352235      }
    2236     }   
     2236    }
    22372237    f=f-lead(f);
    22382238  }
     
    22542254proc tInitialIdeal (ideal i,intvec w,list #)
    22552255"USAGE:      tInitialIdeal(i,w); i ideal, w intvec
    2256 ASSUME:      i is an ideal in Q[t,x_1,...,x_n] and w=(w_0,...,w_n) 
     2256ASSUME:      i is an ideal in Q[t,x_1,...,x_n] and w=(w_0,...,w_n)
    22572257RETURN:      ideal ini, the t-initial ideal of i with respect to w"
    22582258{
    22592259  // THE PROCEDURE WILL BE CALLED FROM OTHER PROCEDURES INSIDE THIS LIBRARY;
    2260   // IN THIS CASE THE VARIABLE t WILL INDEED BE THE LAST VARIABLE INSTEAD OF 
     2260  // IN THIS CASE THE VARIABLE t WILL INDEED BE THE LAST VARIABLE INSTEAD OF
    22612261  // THE FIRST,
    22622262  // AND WE THEREFORE HAVE TO MOVE IT BACK TO THE FRONT!
     
    22822282  // ... and compute a standard basis with
    22832283  // respect to the homogenised ordering defined by w. Since the generators
    2284   // of i will be homogeneous it we can instead take the ordering wp 
    2285   // with the weightvector (0,w) replaced by (M,...,M)+(0,w) for some 
    2286   // large M, so that all entries are positive 
    2287   int M=-minInIntvec(w)[1]+1; // find M such that w[j]+M is 
     2284  // of i will be homogeneous it we can instead take the ordering wp
     2285  // with the weightvector (0,w) replaced by (M,...,M)+(0,w) for some
     2286  // large M, so that all entries are positive
     2287  int M=-minInIntvec(w)[1]+1; // find M such that w[j]+M is
    22882288                              // strictly positive for all j
    22892289  intvec whomog=M;
     
    22932293  }
    22942294  execute("ring WEIGHTRING=("+charstr(basering)+"),("+varstr(basering)+"),(wp("+string(whomog)+"));");
    2295   // map i to the new ring and compute a GB of i, then dehomogenise i, 
    2296   // so that we can be sure, that the 
     2295  // map i to the new ring and compute a GB of i, then dehomogenise i,
     2296  // so that we can be sure, that the
    22972297  // initial forms of the generators generate the initial ideal
    22982298  ideal i=subst(groebner(imap(HOMOGRING,i)),@s,1);
     
    25482548proc texDrawBasic (list texdraw)
    25492549"USAGE:      texDrawBasic(texdraw); list texdraw
    2550 ASSUME:      texdraw is a list of strings representing texdraw commands 
    2551              (as produced by texDrawTropical) which should be embedded into 
     2550ASSUME:      texdraw is a list of strings representing texdraw commands
     2551             (as produced by texDrawTropical) which should be embedded into
    25522552             a texdraw environment
    25532553RETURN:      string, a texdraw environment enclosing the input
     
    25692569    \\end{texdraw}";
    25702570  return(texdrawtp);
    2571 } 
     2571}
    25722572example
    25732573{
     
    25862586ASSUME:  graph is the output of tropicalCurve
    25872587RETURN:  string, the texdraw code of the tropical plane curve encoded by graph
    2588 NOTE:    - if the list # is non-empty, the first entry should be a string; 
    2589            if this string is 'max', then the tropical curve is considered 
     2588NOTE:    - if the list # is non-empty, the first entry should be a string;
     2589           if this string is 'max', then the tropical curve is considered
    25902590           with respect to the maximum
    2591 @*       - the procedure computes a scalefactor for the texdraw command which 
    2592            should help to display the curve in the right way; this may, 
    2593            however, be a bad idea if several texDrawTropical outputs are 
    2594            put together to form one image; the scalefactor can be prescribed 
     2591@*       - the procedure computes a scalefactor for the texdraw command which
     2592           should help to display the curve in the right way; this may,
     2593           however, be a bad idea if several texDrawTropical outputs are
     2594           put together to form one image; the scalefactor can be prescribed
    25952595           by the further optional entry of type poly
    2596 @*       - one can add a string as last opional argument to the list #; 
    2597            it can be used to insert further texdraw commands (e.g. to have 
    2598            a lighter image as when called from inside conicWithTangents); 
     2596@*       - one can add a string as last opional argument to the list #;
     2597           it can be used to insert further texdraw commands (e.g. to have
     2598           a lighter image as when called from inside conicWithTangents);
    25992599@*       - the list # is optional and may as well be empty
    26002600EXAMPLE:     example texDrawTropical;   shows an example"
    26012601{
    2602   // there is one possible argument, which is not explained to the user; 
     2602  // there is one possible argument, which is not explained to the user;
    26032603  // it is used to draw several tropical curves; there we want to suppress
    2604   // the weights sometimes; this is done by handing over the string "noweights" 
    2605   int i,j; 
     2604  // the weights sometimes; this is done by handing over the string "noweights"
     2605  int i,j;
    26062606  int noweights; // controls if weights should be drawn or not
    26072607  for (i=1;i<=size(#);i++)
     
    26162616    }
    26172617  }
    2618   // deal first with the pathological case that 
     2618  // deal first with the pathological case that
    26192619  // the input polynomial was a monomial
    2620   // and does therefore not define a tropical curve, 
    2621   // and check if the Newton polytope is 
     2620  // and does therefore not define a tropical curve,
     2621  // and check if the Newton polytope is
    26222622  // a line segment so that the curve defines a bunch of lines
    26232623  int bunchoflines;
    26242624  // if the boundary of the Newton polytope consists of a single point
    2625   if (size(graph[size(graph)][1])==1) 
     2625  if (size(graph[size(graph)][1])==1)
    26262626  {
    26272627    return(string());
     
    26362636    }
    26372637    // then the Newton polytope is a line segment
    2638     if ((size(graph[size(graph)][1])-size(syz(M)))==1) 
     2638    if ((size(graph[size(graph)][1])-size(syz(M)))==1)
    26392639    {
    26402640      bunchoflines=1;
     
    26672667  int nachkomma=2; // number of decimals for the scalefactor
    26682668  number sf=1; // correction factor for scalefactor
    2669   // if no scale factor was handed over to the procedure, use the 
     2669  // if no scale factor was handed over to the procedure, use the
    26702670  // one computed by minScaleFactor;
    26712671  // check first if a scale factor has been handed over
     
    26752675  {
    26762676    // if the scalefactor as polynomial was handed over, get it
    2677     if (typeof(#[i])=="poly") 
     2677    if (typeof(#[i])=="poly")
    26782678    {
    26792679      poly scalefactor=#[2];
    26802680      scfpresent=1;
    26812681    }
    2682     // if the procedure is called for drawing more than one tropical curve 
     2682    // if the procedure is called for drawing more than one tropical curve
    26832683    // then scalefactor,sf,nachkomma,minx,miny,maxx,maxy,centerx,centery
    26842684    // has been handed over to the procedure
     
    26972697    }
    26982698    i++;
    2699   }   
     2699  }
    27002700  // if no scalefactor was handed over we take the one computed in SCF
    27012701  if (scfpresent==0)
     
    27122712  {
    27132713    // if the curve is a bunch of lines no vertex has to be drawn
    2714     if (bunchoflines==0) 
     2714    if (bunchoflines==0)
    27152715    {
    27162716      texdrawtp=texdrawtp+"
     
    27182718    }
    27192719    // draw the bounded edges emerging from the ith vertex
    2720     for (j=1;j<=ncols(graph[i][3]);j++) 
    2721     {
    2722       // don't draw it twice - and if there is only one vertex 
     2720    for (j=1;j<=ncols(graph[i][3]);j++)
     2721    {
     2722      // don't draw it twice - and if there is only one vertex
    27232723      //                       and graph[i][3][1,1] is thus 0, nothing is done
    2724       if (i<graph[i][3][1,j]) 
    2725       {                       
     2724      if (i<graph[i][3][1,j])
     2725      {
    27262726        texdrawtp=texdrawtp+"
    27272727       \\move ("+decimal((graph[i][1]-centerx)/sf)+" "+decimal((graph[i][2]-centery)/sf)+") \\lvec ("+decimal((graph[graph[i][3][1,j]][1]-centerx)/sf)+" "+decimal((graph[graph[i][3][1,j]][2]-centery)/sf)+")";
     
    27362736    // draw the unbounded edges emerging from the ith vertex
    27372737    // they should not be too long
    2738     for (j=1;j<=size(graph[i][4]);j++) 
    2739     {     
     2738    for (j=1;j<=size(graph[i][4]);j++)
     2739    {
    27402740      relxy=shorten(list(decimal((3*graph[i][4][j][1][1]/scalefactor)*sf),decimal((3*graph[i][4][j][1][2]/scalefactor)*sf),string(5*sf/2)));
    27412741      texdrawtp=texdrawtp+"
     
    28362836  // check if scaling is necessary
    28372837  if (scalefactor<1)
    2838   {   
     2838  {
    28392839    subdivision=subdivision+"
    28402840       \\relunitscale"+ decimal(scalefactor);
     
    28442844  {
    28452845    subdivision=subdivision+"
    2846         \\move ("+string(boundary[i][1])+" "+string(boundary[i][2])+")       
     2846        \\move ("+string(boundary[i][1])+" "+string(boundary[i][2])+")
    28472847        \\lvec ("+string(boundary[i+1][1])+" "+string(boundary[i+1][2])+")";
    2848   } 
     2848  }
    28492849  subdivision=subdivision+"
    2850         \\move ("+string(boundary[size(boundary)][1])+" "+string(boundary[size(boundary)][2])+")       
     2850        \\move ("+string(boundary[size(boundary)][1])+" "+string(boundary[size(boundary)][2])+")
    28512851        \\lvec ("+string(boundary[1][1])+" "+string(boundary[1][2])+")
    28522852
     
    28552855  {
    28562856    subdivision=subdivision+"
    2857         \\move ("+string(inneredges[i][1][1])+" "+string(inneredges[i][1][2])+")       
     2857        \\move ("+string(inneredges[i][1][1])+" "+string(inneredges[i][1][2])+")
    28582858        \\lvec ("+string(inneredges[i][2][1])+" "+string(inneredges[i][2][2])+")";
    28592859  }
     
    28662866      {
    28672867        if (scalefactor > 2)
    2868         {     
     2868        {
    28692869          subdivision=subdivision+"
    28702870        \\move ("+string(i)+" "+string(j)+") \\fcir f:0.6 r:"+decimal(2/(10*scalefactor),size(string(int(scalefactor)))+1);
     
    28762876        }
    28772877      }
    2878     } 
     2878    }
    28792879    if ((shiftvector[1]!=0) or (shiftvector[2]!=0))
    28802880    {
     
    28832883    }
    28842884  }
    2885   // deal with the pathological cases 
     2885  // deal with the pathological cases
    28862886  if (size(boundary)==1) // then the Newton polytope is a point
    28872887  {
     
    29382938  {
    29392939    if (scalefactor > 2)
    2940     {     
     2940    {
    29412941      subdivision=subdivision+"
    2942        \\move ("+string(markings[i][1])+" "+string(markings[i][2])+") 
     2942       \\move ("+string(markings[i][1])+" "+string(markings[i][2])+")
    29432943       \\fcir f:0 r:"+decimal(2/(8*scalefactor),size(string(int(scalefactor)))+1);
    29442944    }
     
    29462946    {
    29472947      subdivision=subdivision+"
    2948        \\move ("+string(markings[i][1])+" "+string(markings[i][2])+") 
     2948       \\move ("+string(markings[i][1])+" "+string(markings[i][2])+")
    29492949       \\fcir f:0 r:"+decimal(2/(16*scalefactor),size(string(int(scalefactor)))+1);
    29502950    }
    29512951  }
    29522952  // enclose subdivision in the texdraw environment
    2953   string texsubdivision="     
     2953  string texsubdivision="
    29542954    \\begin{texdraw}
    2955        \\drawdim cm  \\relunitscale 1 
     2955       \\drawdim cm  \\relunitscale 1
    29562956       \\linewd 0.05"
    29572957    +subdivision+"
     
    29672967   poly f=x+y+x2y+xy2+1/t*xy;
    29682968   list graph=tropicalCurve(f);
    2969 // compute the texdraw code of the Newton subdivision of the tropical curve 
     2969// compute the texdraw code of the Newton subdivision of the tropical curve
    29702970   texDrawNewtonSubdivision(graph);
    29712971}
     
    29752975proc texDrawTriangulation (list triang,list polygon)
    29762976"USAGE:      texDrawTriangulation(triang,polygon);  triang,polygon list
    2977 ASSUME:      polygon is a list of integer vectors describing the 
     2977ASSUME:      polygon is a list of integer vectors describing the
    29782978             lattice points of a marked polygon;
    2979              triang is a list of integer vectors describing a 
     2979             triang is a list of integer vectors describing a
    29802980             triangulation of the marked polygon
    2981              in the sense that an integer vector of the form (i,j,k) describes 
     2981             in the sense that an integer vector of the form (i,j,k) describes
    29822982             the triangle formed by polygon[i], polygon[j] and polygon[k]
    2983 RETURN:      string, a texdraw code for the triangulation described 
     2983RETURN:      string, a texdraw code for the triangulation described
    29842984                     by triang without the texdraw environment
    29852985EXAMPLE:     example texDrawTriangulation;   shows an example"
     
    29902990   ";
    29912991  int i,j; // indices
    2992   list pairs,markings; // stores edges of the triangulation, respecively 
    2993   // the marked points for each triangle store the edges and marked 
     2992  list pairs,markings; // stores edges of the triangulation, respecively
     2993  // the marked points for each triangle store the edges and marked
    29942994  // points of the triangle
    29952995  for (i=1;i<=size(triang);i++)
     
    30003000    markings[3*i-2]=triang[i][1];
    30013001    markings[3*i-1]=triang[i][2];
    3002     markings[3*i]=triang[i][3];   
     3002    markings[3*i]=triang[i][3];
    30033003  }
    30043004  // delete redundant pairs which occur more than once
     
    30333033  {
    30343034    latex=latex+"
    3035         \\move ("+string(polygon[markings[i]][1])+" "+string(polygon[markings[i]][2])+")       
     3035        \\move ("+string(polygon[markings[i]][1])+" "+string(polygon[markings[i]][2])+")
    30363036        \\fcir f:0 r:0.08";
    30373037  }
     
    30403040  {
    30413041    latex=latex+"
    3042         \\move ("+string(polygon[pairs[i][1]][1])+" "+string(polygon[pairs[i][1]][2])+")       
     3042        \\move ("+string(polygon[pairs[i][1]][1])+" "+string(polygon[pairs[i][1]][2])+")
    30433043        \\lvec ("+string(polygon[pairs[i][2]][1])+" "+string(polygon[pairs[i][2]][2])+")";
    30443044  }
     
    30473047  {
    30483048    latex=latex+"
    3049         \\move ("+string(polygon[i][1])+" "+string(polygon[i][2])+")       
     3049        \\move ("+string(polygon[i][1])+" "+string(polygon[i][2])+")
    30503050        \\fcir f:0.7 r:0.04";
    30513051  }
     
    30563056   "EXAMPLE:";
    30573057   echo=2;
    3058    // the lattice polygon spanned by the points (0,0), (3,0) and (0,3) 
     3058   // the lattice polygon spanned by the points (0,0), (3,0) and (0,3)
    30593059   // with all integer points as markings
    30603060   list polygon=intvec(1,1),intvec(3,0),intvec(2,0),intvec(1,0),intvec(0,0),
    30613061                intvec(2,1),intvec(0,1),intvec(1,2),intvec(0,2),intvec(0,3);
    3062    // define a triangulation by connecting the only interior point 
     3062   // define a triangulation by connecting the only interior point
    30633063   //        with the vertices
    30643064   list triang=intvec(1,2,5),intvec(1,5,10),intvec(1,2,10);
     
    30683068
    30693069///////////////////////////////////////////////////////////////////////////////
    3070 /// Auxilary Procedures 
     3070/// Auxilary Procedures
    30713071///////////////////////////////////////////////////////////////////////////////
    30723072
     
    30743074"USAGE:  radicalMemberShip (f,i); f poly, i ideal
    30753075RETURN:  int, 1 if f is in the radical of i, 0 else
    3076 EXAMPLE:     example radicalMemberShip;   shows an example" 
     3076EXAMPLE:     example radicalMemberShip;   shows an example"
    30773077{
    30783078  def BASERING=basering;
     
    31143114{
    31153115  // compute first the t-order of the leading coefficient of f (leitkoef[1]) and
    3116   // the rational constant corresponding to this order in leadkoef(f) 
     3116  // the rational constant corresponding to this order in leadkoef(f)
    31173117  // (leitkoef[2])
    31183118  list leitkoef=simplifyToOrder(f);
     
    31243124  // do the same for the remaining part of f and compare the results
    31253125  // keep only the smallest ones
    3126   int vglgewicht; 
    3127   f=f-lead(f); 
     3126  int vglgewicht;
     3127  f=f-lead(f);
    31283128  while (f!=0)
    31293129  {
    3130     leitkoef=simplifyToOrder(f);   
     3130    leitkoef=simplifyToOrder(f);
    31313131    vglgewicht=leitkoef[1]+scalarproduct(w,leadexp(f));
    31323132    if (vglgewicht<gewicht)
     
    31433143        initialf=initialf+koef*leadmonom(f);
    31443144      }
    3145     }   
     3145    }
    31463146    f=f-lead(f);
    31473147  }
     
    31683168{
    31693169  // compute first the t-order of the leading coefficient of f (leitkoef[1]) and
    3170   // the rational constant corresponding to this order in leadkoef(f) 
     3170  // the rational constant corresponding to this order in leadkoef(f)
    31713171  // (leitkoef[2])
    3172   list leitkoef=simplifyToOrder(f); 
     3172  list leitkoef=simplifyToOrder(f);
    31733173  execute("poly koef="+leitkoef[2]+";");
    31743174  // take in lead(f) only the term of lowest t-order and set t=1
     
    31793179  // keep only the largest ones
    31803180  int vglgewicht;
    3181   f=f-lead(f); 
     3181  f=f-lead(f);
    31823182  while (f!=0)
    31833183  {
     
    31973197        initialf=initialf+koef*leadmonom(f);
    31983198      }
    3199     }   
     3199    }
    32003200    f=f-lead(f);
    32013201  }
     
    32163216proc solveTInitialFormPar (ideal i)
    32173217"USAGE:      solveTInitialFormPar(i); i ideal
    3218 ASSUME:      i is a zero-dimensional ideal in Q(t)[x_1,...,x_n] generated 
    3219              by the (1,w)-homogeneous elements for some integer vector w 
     3218ASSUME:      i is a zero-dimensional ideal in Q(t)[x_1,...,x_n] generated
     3219             by the (1,w)-homogeneous elements for some integer vector w
    32203220             - i.e. by the (1,w)-initialforms of polynomials
    32213221RETURN:      none
    3222 NOTE:        the procedure just displays complex approximations 
     3222NOTE:        the procedure just displays complex approximations
    32233223             of the solution set of i
    32243224EXAMPLE:     example solveTInitialFormPar;   shows an example"
     
    32453245/////////////////////////////////////////////////////////////////////////
    32463246
    3247 proc detropicalise (def p) 
     3247proc detropicalise (def p)
    32483248"USAGE:   detropicalise(f); f poly or f list
    3249 ASSUME:   if f is of type poly then t is a linear polynomial with 
    3250           an arbitrary constant term and positive integer coefficients 
     3249ASSUME:   if f is of type poly then t is a linear polynomial with
     3250          an arbitrary constant term and positive integer coefficients
    32513251          as further coefficients;
    32523252@*        if f is of type list then f is a list of polynomials of
    32533253          the type just described in before
    32543254RETURN:   poly, the detropicalisation of f ignoring the constant parts
    3255 NOTE:     the output will be a monomial and the constant coefficient 
     3255NOTE:     the output will be a monomial and the constant coefficient
    32563256          has been ignored
    32573257EXAMPLE:  example detropicalise;   shows an example"
     
    32613261  {
    32623262    if (leadmonom(p)!=1)
    3263     { 
     3263    {
    32643264      dtp=dtp*leadmonom(p)^int(leadcoef(p));
    32653265    }
     
    32783278/////////////////////////////////////////////////////////////////////////
    32793279
    3280 proc tDetropicalise (def p) 
     3280proc tDetropicalise (def p)
    32813281"USAGE:   tDetropicalise(f); f poly or f list
    3282 ASSUME:   if f is of type poly then f is a linear polynomial with an 
    3283           integer constant term and positive integer coefficients 
     3282ASSUME:   if f is of type poly then f is a linear polynomial with an
     3283          integer constant term and positive integer coefficients
    32843284          as further coefficients;
    32853285@*        if f is of type list then it is a list of polynomials of
    3286           the type just described in before 
     3286          the type just described in before
    32873287RETURN:   poly, the detropicalisation of f over the field Q(t)
    32883288NOTE:     the output will be a term where the coeffiecient is a Laurent
     
    32933293  if (typeof(p)=="list")
    32943294  {
    3295     int i;   
     3295    int i;
    32963296    for (i=1;i<=size(p);i++)
    32973297    {
     
    33053305    {
    33063306      if (leadmonom(p)!=1)
    3307       { 
     3307      {
    33083308        dtp=dtp*leadmonom(p)^int(leadcoef(p));
    33093309      }
     
    33633363proc parameterSubstitute (poly f,int N)
    33643364"USAGE:   parameterSubstitute(f,N); f poly, N int
    3365 ASSUME:   f is a polynomial in Q(t)[x_1,...,x_n] describing 
     3365ASSUME:   f is a polynomial in Q(t)[x_1,...,x_n] describing
    33663366          a plane curve over Q(t)
    33673367RETURN:   poly f with t replaced by t^N
     
    34173417   poly f=t2x+1/t*y-1;
    34183418   tropicalSubst(f,2,x,x+t,y,tx+y+t2);
    3419    // The procedure can be used to study the effect of a transformation of 
     3419   // The procedure can be used to study the effect of a transformation of
    34203420   // the form x -> x+t^b, with b a rational number, on the tropicalisation and
    34213421   // the j-invariant of a cubic over the Puiseux series.
    34223422   f=t7*y3+t3*y2+t*(x3+xy2+y+1)+xy;
    3423    // - the j-invariant, and hence its valuation, 
     3423   // - the j-invariant, and hence its valuation,
    34243424   //   does not change under the transformation
    34253425   jInvariant(f,"ord");
    3426    // - b=3/2, then the cycle length of the tropical cubic equals -val(j-inv)   
    3427    list g32=tropicalSubst(f,2,x,x+t3,y,y); 
     3426   // - b=3/2, then the cycle length of the tropical cubic equals -val(j-inv)
     3427   list g32=tropicalSubst(f,2,x,x+t3,y,y);
    34283428   tropicalJInvariant(g32);
    34293429   // - b=1, then it is still true, but only just ...
     
    34383438
    34393439proc randomPoly (int d,int ug, int og, list #)
    3440 "USAGE:      randomPoly(d,ug,og[,#]);   d, ug, og int, # list 
     3440"USAGE:      randomPoly(d,ug,og[,#]);   d, ug, og int, # list
    34413441ASSUME:      the basering has a parameter t
    3442 RETURN:      poly, a polynomial of degree d where the coefficients are 
     3442RETURN:      poly, a polynomial of degree d where the coefficients are
    34433443                   of the form t^j with j a random integer between ug and og
    3444 NOTE:        if an optional argument # is given, then the coefficients are 
    3445              instead either of the form t^j as above or they are zero, 
     3444NOTE:        if an optional argument # is given, then the coefficients are
     3445             instead either of the form t^j as above or they are zero,
    34463446             and this is chosen randomly
    34473447EXAMPLE:     example randomPoly;   shows an example"
     
    34603460  {
    34613461    if (size(#)!=0)
    3462     {     
     3462    {
    34633463      k=random(0,1);
    34643464    }
    34653465    if (k==0)
    3466     {     
     3466    {
    34673467      j=random(ug,og);
    34683468      randomPolynomial=randomPolynomial+t^j*m[i];
     
    34943494RETURN:  none"
    34953495{
    3496   system("sh","cd /tmp; /bin/rm -f tropicalcurve*; /bin/rm -f tropicalnewtonsubdivision*"); 
     3496  system("sh","cd /tmp; /bin/rm -f tropicalcurve*; /bin/rm -f tropicalnewtonsubdivision*");
    34973497}
    34983498
     
    35513551static proc cutdown (ideal jideal,intvec wvec,int dimension,list #)
    35523552"USAGE:      cutdown(i,w,d); i ideal, w intvec, d int, # list
    3553 ASSUME:      i an ideal in Q[t,x_1,...,x_n], (w_1,...,w_n) is in the tropical 
    3554              variety of jideal and d=dim(i)>0, in Q(t)[x]; the optional 
    3555              parameter # can contain the string 'isPrime' to indicate that 
    3556              the input ideal is prime and no minimal associated primes have 
     3553ASSUME:      i an ideal in Q[t,x_1,...,x_n], (w_1,...,w_n) is in the tropical
     3554             variety of jideal and d=dim(i)>0, in Q(t)[x]; the optional
     3555             parameter # can contain the string 'isPrime' to indicate that
     3556             the input ideal is prime and no minimal associated primes have
    35573557             to be computed
    3558 RETURN:      list, the first entry is a ring, namely the basering where some 
    3559                    variables have been eliminated, and the ring contains 
     3558RETURN:      list, the first entry is a ring, namely the basering where some
     3559                   variables have been eliminated, and the ring contains
    35603560                   the ideal i (with the same variables eliminated),
    3561                    the t-initial ideal ini of i (w.r.t. the weight vector 
    3562                    where the entries corresponding to the deleted variables 
    3563                    have been eliminated) and a list repl where for each 
     3561                   the t-initial ideal ini of i (w.r.t. the weight vector
     3562                   where the entries corresponding to the deleted variables
     3563                   have been eliminated) and a list repl where for each
    35643564                   eliminated variable there is one entry, namely a polynomial
    3565                    in the remaining variables and t that explains how 
    3566                    resubstitution of a solution for the new i gives a solution 
     3565                   in the remaining variables and t that explains how
     3566                   resubstitution of a solution for the new i gives a solution
    35673567                   for the old i; the second entry is the weight vector
    3568                    wvec with the components corresponding to the eliminated 
     3568                   wvec with the components corresponding to the eliminated
    35693569                   variables removed
    3570 NOTE:        needs the libraries random.lib and primdec.lib; 
     3570NOTE:        needs the libraries random.lib and primdec.lib;
    35713571             is called from tropicalLifting"
    3572 { 
    3573   // IDEA: i is an ideal of dimension d; we want to cut it with d random linear 
     3572{
     3573  // IDEA: i is an ideal of dimension d; we want to cut it with d random linear
    35743574  //       forms in such a way that the resulting
    35753575  //       ideal is 0-dim and still contains w in the tropical variety
    3576   // NOTE: t is the last variable in the basering 
     3576  // NOTE: t is the last variable in the basering
    35773577  ideal pideal;  //this is the ideal we want to return
    35783578  ideal cutideal;
     
    35923592  for (j1=1;j1<=nvars(basering)-1;j1++)
    35933593  {
    3594     variablen=variablen+var(j1); // read the set of variables 
     3594    variablen=variablen+var(j1); // read the set of variables
    35953595                                 // (needed to make the quotring later)
    3596     product=product*var(j1); // make product of all variables 
     3596    product=product*var(j1); // make product of all variables
    35973597                             // (needed for the initial-monomial-check later
    3598   }   
     3598  }
    35993599  execute("ring QUOTRING=("+charstr(basering)+",t),("+string(variablen)+"),dp;");
    36003600  setring BASERING;
     
    36033603  {
    36043604    setring QUOTRING;
    3605     ideal jideal=imap(BASERING,jideal); 
    3606     list primp=minAssGTZ(jideal); //compute the primary decomposition 
     3605    ideal jideal=imap(BASERING,jideal);
     3606    list primp=minAssGTZ(jideal); //compute the primary decomposition
    36073607    for (j1=1;j1<=size(primp);j1++)
    3608     {     
     3608    {
    36093609      for(j2=1;j2<=size(primp[j1]);j2++)
    36103610      {
    36113611        // clear all denominators
    36123612        primp[j1][j2]=primp[j1][j2]/content(primp[j1][j2]);
    3613       }       
     3613      }
    36143614    }
    36153615    setring BASERING;
    36163616    list primp=imap(QUOTRING,primp);
    36173617    // if i is not primary itself
    3618     // go through the list of min. ass. primes and find the first 
     3618    // go through the list of min. ass. primes and find the first
    36193619    // one which has w in its tropical variety
    3620     if (size(primp)>1) 
     3620    if (size(primp)>1)
    36213621    {
    36223622      j1=1;
     
    36253625        //compute the t-initial of the associated prime
    36263626        // - the last entry 1 only means that t is the last variable in the ring
    3627         primini=tInitialIdeal(primp[j1],wvec,1); 
    3628         // check if it contains a monomial (resp if the product of var 
     3627        primini=tInitialIdeal(primp[j1],wvec,1);
     3628        // check if it contains a monomial (resp if the product of var
    36293629        // is in the radical)
    3630         if (radicalMemberShip(product,primini)==0) 
    3631         { 
     3630        if (radicalMemberShip(product,primini)==0)
     3631        {
    36323632          // if w is in the tropical variety of the prime, we take that
    36333633          jideal=primp[j1];
     
    36363636          setring BASERING;
    36373637          winprim=1; // and stop the checking
    3638         } 
     3638        }
    36393639        j1=j1+1;  //else we look at the next associated prime
    36403640      }
     
    36433643    {
    36443644      jideal=primp[1]; //if i is primary itself we take its prime instead
    3645     } 
     3645    }
    36463646  }
    36473647  // now we start as a first try to intersect with a hyperplane parallel to
    36483648  // coordinate axes, because this would make our further computations
    3649   // a lot easier. 
    3650   // We choose a subset of our n variables of size d=dim(ideal). 
     3649  // a lot easier.
     3650  // We choose a subset of our n variables of size d=dim(ideal).
    36513651  // For each of these
    3652   // variables, we want to fix a value: x_i= a_i*t^-w_i. 
     3652  // variables, we want to fix a value: x_i= a_i*t^-w_i.
    36533653  // This will only work if the
    3654   // projection of the d-dim variety to the other n-d variables 
     3654  // projection of the d-dim variety to the other n-d variables
    36553655  // is the whole n-d plane.
    3656   // Then a general choice for a_i will intersect the variety 
     3656  // Then a general choice for a_i will intersect the variety
    36573657  // in finitely many points.
    3658   // If the projection is not the whole n-d plane, 
     3658  // If the projection is not the whole n-d plane,
    36593659  // then a general choice will not work.
    3660   // We could determine if we picked a good 
     3660  // We could determine if we picked a good
    36613661  // d-subset of variables using elimination
    3662   // (NOTE, there EXIST d variables such that 
     3662  // (NOTE, there EXIST d variables such that
    36633663  // a random choice of a_i's would work!).
    3664   // But since this involves many computations, 
     3664  // But since this involves many computations,
    36653665  // we prefer to choose randomly and just
    3666   // try in the end if our intersected ideal 
    3667   // satisfies our requirements. If this does not 
     3666  // try in the end if our intersected ideal
     3667  // satisfies our requirements. If this does not
    36683668  // work, we give up this try and use our second intersection idea, which
    36693669  // will work for a Zariksi-open subset (i.e. almost always).
    36703670  //
    3671   // As random subset of d variables we choose 
     3671  // As random subset of d variables we choose
    36723672  // those for which the absolute value of the
    3673   // wvec-coordinate is smallest, because this will 
     3673  // wvec-coordinate is smallest, because this will
    36743674  // give us the smallest powers of t and hence
    3675   // less effort in following computations. 
     3675  // less effort in following computations.
    36763676  // Note that the smallest absolute value have those
    3677   // which are biggest, because wvec is negative. 
     3677  // which are biggest, because wvec is negative.
    36783678  //print("first try");
    36793679  intvec wminust=intvecdelete(wvec,1);
     
    36823682  A[1,1..size(wminust)]=-wminust;
    36833683  A[2,1..size(wminust)]=1..size(wminust);
    3684   // sort this matrix in order to get 
     3684  // sort this matrix in order to get
    36853685  // the d biggest entries and their position in wvec
    3686   A=sortintmat(A); 
    3687   // we construct a vector which has 1 at entry j if j belongs to the list 
     3686  A=sortintmat(A);
     3687  // we construct a vector which has 1 at entry j if j belongs to the list
    36883688  // of the d biggest entries of wvec and a 0 else
    36893689  for (j1=1;j1<=nvars(basering)-1;j1++) //go through the variables
     
    36943694      {
    36953695        setvec[j1]=1;//put a 1
    3696       }       
    3697     } 
    3698   }
    3699   // using this 0/1-vector we produce 
    3700   // a random constant (i.e. coeff in Q times something in t) 
    3701   // for each of the biggest variables, 
     3696      }
     3697    }
     3698  }
     3699  // using this 0/1-vector we produce
     3700  // a random constant (i.e. coeff in Q times something in t)
     3701  // for each of the biggest variables,
    37023702  // we add the forms x_i-random constant to the ideal
    3703   // and we save the constant at the i-th place of 
     3703  // and we save the constant at the i-th place of
    37043704  // a list we want to return for later computations
    37053705  j3=0;
     
    37123712    {
    37133713      if(setvec[j1]==1)//if x_i belongs to the biggest variables
    3714       {     
     3714      {
    37153715        if ((j3==1) and ((char(basering)==0) or (char(basering)>3)))
    3716         {       
     3716        {
    37173717          randomp1=random(1,3);
    3718           randomp=t^(A[1,j2])*randomp1;// make a random constant 
     3718          randomp=t^(A[1,j2])*randomp1;// make a random constant
    37193719                                       // --- first we try small numbers
    3720         }   
     3720        }
    37213721        if ((j3==2) and ((char(basering)==0) or (char(basering)>100)))
    37223722        {
    37233723          randomp1=random(1,100);
    3724           randomp=t^(A[1,j2])*randomp1;// make a random constant 
     3724          randomp=t^(A[1,j2])*randomp1;// make a random constant
    37253725                                       // --- next we try bigger numbers
    3726         }   
     3726        }
    37273727        else
    37283728        {
     
    37363736      else
    37373737      {
    3738         ergl[j1]=0; //if the variable is not among the d biggest ones, 
     3738        ergl[j1]=0; //if the variable is not among the d biggest ones,
    37393739                    //save 0 in the list
    37403740        erglini[j1]=0;
    3741       }       
     3741      }
    37423742    }
    37433743      // print(ergl);print(pideal);
    3744       // now we check if we made a good choice of pideal, i.e. if dim=0 and 
     3744      // now we check if we made a good choice of pideal, i.e. if dim=0 and
    37453745      // wvec is still in the tropical variety
    37463746      // change to quotring where we compute dimension
     
    37493749    {
    37503750      if(setvec[j1]==1)
    3751       {     
    3752         cutideal=cutideal,var(j1)-ergl[j1];//add all forms to the ideal 
    3753       }     
     3751      {
     3752        cutideal=cutideal,var(j1)-ergl[j1];//add all forms to the ideal
     3753      }
    37543754    }
    37553755    setring QUOTRING;
     
    37633763    {
    37643764      // compute the t-initial of the associated prime
    3765       // - the last 1 just means that the variable t is 
     3765      // - the last 1 just means that the variable t is
    37663766      //   the last variable in the ring
    37673767      pini=tInitialIdeal(cutideal,wvec ,1);
    37683768      //print("initial");
    37693769      //print(pini);
    3770       // and if the initial w.r.t. t contains no monomial 
     3770      // and if the initial w.r.t. t contains no monomial
    37713771      // as we want (checked with
    37723772      // radical-membership of the product of all variables)
    3773       if (radicalMemberShip(product,pini)==0) 
    3774       {
    3775         // we made the right choice and now 
    3776         // we substitute the variables in the ideal   
     3773      if (radicalMemberShip(product,pini)==0)
     3774      {
     3775        // we made the right choice and now
     3776        // we substitute the variables in the ideal
    37773777        // to get an ideal in less variables
    3778         // also we make a projected vector 
     3778        // also we make a projected vector
    37793779        // from wvec only the components of the remaining variables
    37803780        wvecp=wvec;
    3781         variablen=0;   
     3781        variablen=0;
    37823782        j2=0;
    37833783        for(j1=1;j1<=nvars(basering)-1;j1++)
     
    37923792          else
    37933793          {
    3794             variablen=variablen+var(j1); // read the set of remaining variables 
     3794            variablen=variablen+var(j1); // read the set of remaining variables
    37953795                                         // (needed to make quotring later)
    3796           }   
    3797         }     
     3796          }
     3797        }
    37983798        // return pideal, the initial and the list ergl which tells us
    37993799        // which variables we replaced by which form
     
    38053805        export(ini);
    38063806        export(repl);
    3807         return(list(BASERINGLESS1,wvecp)); 
     3807        return(list(BASERINGLESS1,wvecp));
    38083808      }
    38093809    }
    38103810  }
    38113811  // this is our second try to cut down, which we only use if the first try
    3812   // didn't work out. We intersect with d general hyperplanes 
     3812  // didn't work out. We intersect with d general hyperplanes
    38133813  // (i.e. we don't choose
    38143814  // them to be parallel to coordinate hyperplanes anymore. This works out with
    38153815  // probability 1.
    38163816  //
    3817   // We choose general hyperplanes, i.e. linear forms which involve all x_i. 
    3818   // Each x_i has to be multiplied bz t^(w_i) in order 
    3819   // to get the same weight (namely 0) 
     3817  // We choose general hyperplanes, i.e. linear forms which involve all x_i.
     3818  // Each x_i has to be multiplied bz t^(w_i) in order
     3819  // to get the same weight (namely 0)
    38203820  // for each term. As we cannot have negative exponents, we multiply
    3821   // the whole form by t^minimumw. Notice that then in the first form, 
     3821  // the whole form by t^minimumw. Notice that then in the first form,
    38223822  // there is one term without t- the term of the variable
    38233823  // x_i such that w_i is minimal. That is, we can solve for this variable.
    3824   // In the second form, we can replace that variable, 
    3825   // and divide by t as much as possible. 
    3826   // Then there is again one term wihtout t - 
    3827   // the term of the variable with second least w. 
     3824  // In the second form, we can replace that variable,
     3825  // and divide by t as much as possible.
     3826  // Then there is again one term wihtout t -
     3827  // the term of the variable with second least w.
    38283828  // So we can solve for this one again and also replace it in the first form.
    3829   // Since all our coefficients are chosen randomly, 
    3830   // we can also from the beginning on 
    3831   // choose the set of variables which belong to the d smallest entries of wvec 
    3832   // (t not counting) and pick random forms g_i(t,x') 
    3833   // (where x' is the set of remaining variables) 
    3834   // and set x_i=g_i(t,x'). 
     3829  // Since all our coefficients are chosen randomly,
     3830  // we can also from the beginning on
     3831  // choose the set of variables which belong to the d smallest entries of wvec
     3832  // (t not counting) and pick random forms g_i(t,x')
     3833  // (where x' is the set of remaining variables)
     3834  // and set x_i=g_i(t,x').
    38353835  //
    38363836  // make a matrix with first row wvec (without t) and second row 1..n
    38373837  //print("second try");
    38383838  setring BASERING;
    3839   A[1,1..size(wminust)]=wminust; 
     3839  A[1,1..size(wminust)]=wminust;
    38403840  A[2,1..size(wminust)]=1..size(wminust);
    3841   // sort this matrix in otder to get the d smallest entries 
     3841  // sort this matrix in otder to get the d smallest entries
    38423842  // (without counting the t-entry)
    38433843  A=sortintmat(A);
     
    38453845  setvec=0;
    38463846  setvec[nvars(basering)-1]=0;
    3847   // we construct a vector which has 1 at entry j if j belongs to the list of 
     3847  // we construct a vector which has 1 at entry j if j belongs to the list of
    38483848  // the d smallest entries of wvec and a 0 else
    38493849  for (j1=1;j1<=nvars(basering)-1;j1++) //go through the variables
     
    38653865    {
    38663866      j2=j2+1;
    3867       wvecp=intvecdelete(wvecp,j1+2-j2);// delete the components 
     3867      wvecp=intvecdelete(wvecp,j1+2-j2);// delete the components
    38683868                                        // we substitute from wvec
    38693869    }
    38703870    else
    38713871    {
    3872       variablen=variablen+var(j1); // read the set of remaining variables 
     3872      variablen=variablen+var(j1); // read the set of remaining variables
    38733873                                   // (needed to make the quotring later)
    38743874    }
    3875   } 
     3875  }
    38763876  setring BASERING;
    38773877  execute("ring BASERINGLESS2=("+charstr(BASERING)+"),("+string(variablen)+",t),(dp("+string(ncols(variablen))+"),lp(1));");
    3878   // using the 0/1-vector which tells us which variables belong 
     3878  // using the 0/1-vector which tells us which variables belong
    38793879  // to the set of smallest entries of wvec
    3880   // we construct a set of d random linear 
    3881   // polynomials of the form x_i=g_i(t,x'), 
     3880  // we construct a set of d random linear
     3881  // polynomials of the form x_i=g_i(t,x'),
    38823882  // where the set of all x_i is the set of
    3883   // all variables which are in the list of smallest 
     3883  // all variables which are in the list of smallest
    38843884  // entries in wvec, and x' are the other variables.
    3885   // We add these d random linear polynomials to 
    3886   // the ideal pideal, i.e. we intersect 
     3885  // We add these d random linear polynomials to
     3886  // the ideal pideal, i.e. we intersect
    38873887  // with these and hope to get something
    3888   // 0-dim which still contains wvec in its 
    3889   // tropical variety. Also, we produce a list ergl 
     3888  // 0-dim which still contains wvec in its
     3889  // tropical variety. Also, we produce a list ergl
    38903890  // with g_i at the i-th position.
    38913891  // This is a list we want to return.
     
    38933893  setring BASERING;
    38943894  pideal=jideal;
    3895   for(j1=1;j1<=dimension;j1++)//go through the list of variables 
     3895  for(j1=1;j1<=dimension;j1++)//go through the list of variables
    38963896  { // corres to the d smallest in wvec
    38973897    if ((char(basering)==0) or (char(basering)>3))
    3898     { 
     3898    {
    38993899      randomp1=random(1,3);
    39003900      randomp=randomp1*t^(-A[1,j1]);
     
    39093909      if(setvec[j2]==0)//if x_j belongs to the set x'
    39103910      {
    3911         // add a random term with the suitable power 
     3911        // add a random term with the suitable power
    39123912        // of t to the random linear form
    39133913        if ((char(basering)==0) or (char(basering)>3))
     
    39343934    }
    39353935  //print(ergl);
    3936   // Again, we have to test if we made a good choice 
    3937   // to intersect,i.e. we have to check whether 
     3936  // Again, we have to test if we made a good choice
     3937  // to intersect,i.e. we have to check whether
    39383938  // pideal is 0-dim and contains wvec in the tropical variety.
    39393939  cutideal=pideal;
     
    39423942    if(setvec[j1]==1)
    39433943    {
    3944       cutideal=cutideal,var(j1)-ergl[j1];//add all forms to the ideal 
    3945     }   
     3944      cutideal=cutideal,var(j1)-ergl[j1];//add all forms to the ideal
     3945    }
    39463946  }
    39473947  setring QUOTRING;
     
    39553955  {
    39563956    // compute the t-initial of the associated prime
    3957     // - the last 1 just means that the variable t 
     3957    // - the last 1 just means that the variable t
    39583958    // is the last variable in the ring
    39593959    pini=tInitialIdeal(cutideal,wvec ,1);
     
    39623962    // and if the initial w.r.t. t contains no monomial as we want (checked with
    39633963    // radical-membership of the product of all variables)
    3964     if (radicalMemberShip(product,pini)==0) 
     3964    if (radicalMemberShip(product,pini)==0)
    39653965    {
    39663966      // we want to replace the variables x_i by the forms -g_i in
    3967       // our ideal in order to return an ideal with less variables 
     3967      // our ideal in order to return an ideal with less variables
    39683968      // first we substitute the chosen variables
    39693969      for(j1=1;j1<=nvars(basering)-1;j1++)
     
    39823982      export(ini);
    39833983      export(repl);
    3984       return(list(BASERINGLESS2,wvecp)); 
     3984      return(list(BASERINGLESS2,wvecp));
    39853985    }
    39863986  }
    39873987  // now we try bigger numbers
    3988   while (1) //a never-ending loop which will stop with prob. 1 
     3988  while (1) //a never-ending loop which will stop with prob. 1
    39893989  { // as we find a suitable ideal with that prob
    39903990    setring BASERING;
    39913991    pideal=jideal;
    3992     for(j1=1;j1<=dimension;j1++)//go through the list of variables 
     3992    for(j1=1;j1<=dimension;j1++)//go through the list of variables
    39933993    { // corres to the d smallest in wvec
    39943994      randomp1=random(1,100);
    39953995      randomp=randomp1*t^(-A[1,j1]);
    39963996      for(j2=1;j2<=nvars(basering)-1;j2++)//go through all variables
    3997       { 
     3997      {
    39983998        if(setvec[j2]==0)//if x_j belongs to the set x'
    39993999        {
    4000           // add a random term with the suitable power 
     4000          // add a random term with the suitable power
    40014001          // of t to the random linear form
    40024002          if ((char(basering)==0) or (char(basering)>100))
    4003           { 
     4003          {
    40044004            randomp2=random(1,100);
    40054005            randomp1=randomp1+randomp2*var(j2);
     
    40224022      }
    40234023    //print(ergl);
    4024     // Again, we have to test if we made a good choice to 
    4025     // intersect,i.e. we have to check whether 
     4024    // Again, we have to test if we made a good choice to
     4025    // intersect,i.e. we have to check whether
    40264026    // pideal is 0-dim and contains wvec in the tropical variety.
    40274027    cutideal=pideal;
     
    40304030      if(setvec[j1]==1)
    40314031      {
    4032         cutideal=cutideal,var(j1)-ergl[j1];//add all forms to the ideal 
    4033       }     
     4032        cutideal=cutideal,var(j1)-ergl[j1];//add all forms to the ideal
     4033      }
    40344034    }
    40354035    setring QUOTRING;
     
    40394039    //print(dimp);
    40404040    kill cutideal;
    4041     setring BASERING; 
     4041    setring BASERING;
    40424042    if (dimp==0) // if it is 0 as we want
    40434043    {
    40444044      // compute the t-initial of the associated prime
    4045       // - the last 1 just means that the variable t 
     4045      // - the last 1 just means that the variable t
    40464046      // is the last variable in the ring
    40474047      pini=tInitialIdeal(cutideal,wvec ,1);
    40484048      //print("initial");
    40494049      //print(pini);
    4050       // and if the initial w.r.t. t contains no monomial 
     4050      // and if the initial w.r.t. t contains no monomial
    40514051      // as we want (checked with
    40524052      // radical-membership of the product of all variables)
    4053       if (radicalMemberShip(product,pini)==0) 
     4053      if (radicalMemberShip(product,pini)==0)
    40544054      {
    40554055        // we want to replace the variables x_i by the forms -g_i in
     
    40624062            pideal=subst(pideal,var(j1),ergl[j1]);//substitute it
    40634063            pini=subst(pini,var(j1),erglini[j1]);
    4064           }   
    4065         }   
     4064          }
     4065        }
    40664066        // return pideal and the list ergl which tells us
    40674067        // which variables we replaced by which form
     
    40734073        export(ini);
    40744074        export(repl);
    4075         return(list(BASERINGLESS2,wvecp)); 
     4075        return(list(BASERINGLESS2,wvecp));
    40764076      }
    40774077    }
     
    40844084static proc tropicalparametriseNoabs (ideal i,intvec ww,int ordnung,int gfanold,int nogfan,list #)
    40854085"USAGE:  tropicalparametriseNoabs(i,tw,ord,gf,ng[,#]); i ideal, tw intvec, ord int, gf,ng int, # opt. list
    4086 ASSUME:  - i is an ideal in Q[t,x_1,...,x_n,X_1,...,X_k], 
    4087            tw=(w_0,w_1,...,w_n,0,...,0) and (w_0,...,w_n,0,...,0) is in 
    4088            the tropical variety of i, and ord is the order up to which a point 
    4089            in V(i) over C((t)) lying over w shall be computed; 
     4086ASSUME:  - i is an ideal in Q[t,x_1,...,x_n,X_1,...,X_k],
     4087           tw=(w_0,w_1,...,w_n,0,...,0) and (w_0,...,w_n,0,...,0) is in
     4088           the tropical variety of i, and ord is the order up to which a point
     4089           in V(i) over C((t)) lying over w shall be computed;
    40904090         - moreover, k should be zero if the procedure is not called recursively;
    4091          - the point in the tropical variety is supposed to lie in the NEGATIVE 
     4091         - the point in the tropical variety is supposed to lie in the NEGATIVE
    40924092           orthant;
    4093          - the ideal is zero-dimensional when considered 
     4093         - the ideal is zero-dimensional when considered
    40944094           in (Q(t)[X_1,...,X_k]/m)[x_1,...,x_n],
    4095            where m=#[2] is a maximal ideal in Q(t)[X_1,...,X_k]; 
     4095           where m=#[2] is a maximal ideal in Q(t)[X_1,...,X_k];
    40964096         - gf is 0 if version 2.2 or larger is used and it is 1 else
    4097          - ng is 1 if gfan should not be executed 
     4097         - ng is 1 if gfan should not be executed
    40984098RETURN:  list, l[1] = ring Q(0,X_1,...,X_r)[[t]]
    40994099               l[2] = int
    41004100               l[3] = string
    41014101NOTE:    - the procedure is also called recursively by itself, and
    4102            if it is called in the first recursion, the list # is empty, 
    4103            otherwise #[1] is an integer, one more than the number 
     4102           if it is called in the first recursion, the list # is empty,
     4103           otherwise #[1] is an integer, one more than the number
    41044104           of true variables x_1,...,x_n,
    41054105           and #[2] will contain the maximal ideal m in the variables X_1,...X_k
     
    41074107           work correctly in K[t,x_1,...,x_n] where K=Q[X_1,...,X_k]/m is a field
    41084108           extension of Q;
    4109          - the ring l[1] contains an ideal PARA, which contains the 
    4110            parametrisation of a point in V(i) lying over w up to the 
     4109         - the ring l[1] contains an ideal PARA, which contains the
     4110           parametrisation of a point in V(i) lying over w up to the
    41114111           first ord terms;
    4112          - the string m=l[3] contains the code of the maximal ideal m, 
    4113            by which we have to divide Q[X_1,...,X_r] in order to have 
     4112         - the string m=l[3] contains the code of the maximal ideal m,
     4113           by which we have to divide Q[X_1,...,X_r] in order to have
    41144114           the appropriate field extension over which the parametrisation lives;
    4115          - and if the integer l[2] is N then t has to be replaced by t^1/N in 
    4116            the parametrisation, or alternatively replace t by t^N in the 
     4115         - and if the integer l[2] is N then t has to be replaced by t^1/N in
     4116           the parametrisation, or alternatively replace t by t^N in the
    41174117           defining ideal
    4118          - the procedure REQUIRES that the program GFAN is installed on 
     4118         - the procedure REQUIRES that the program GFAN is installed on
    41194119           your computer"
    41204120{
     
    41244124  if (size(#)==2) // this means the precedure has been called recursively
    41254125  {
    4126     // how many variables are true variables, and how many come 
     4126    // how many variables are true variables, and how many come
    41274127    // from the field extension
    41284128    // only true variables have to be transformed
     
    41304130    ideal gesamt_m=std(#[2]); // stores all maxideals used for field extensions
    41314131    // find the zeros of the w-initial ideal and transform the ideal i;
    4132     // findzeros and basictransformideal need to know how 
     4132    // findzeros and basictransformideal need to know how
    41334133    // many of the variables are true variables
    41344134    list m_ring=findzeros(i,ww,anzahlvariablen);
     
    41374137  else // the procedure has been called by tropicalLifting
    41384138  {
    4139     // how many variables are true variables, and how many come from 
     4139    // how many variables are true variables, and how many come from
    41404140    // the field extension only true variables have to be transformed
    41414141    int anzahlvariablen=nvars(basering);
     
    41444144    ideal ini=#[1];
    41454145    // find the zeros of the w-initial ideal and transform the ideal i;
    4146     // we should hand the t-initial ideal ine to findzeros, 
     4146    // we should hand the t-initial ideal ine to findzeros,
    41474147    // since we know it already
    41484148    list m_ring=findzeros(i,ww,ini);
     
    41664166    list a=btr[2];
    41674167    ideal m=btr[3];
    4168     gesamt_m=gesamt_m+m; // add the newly found maximal 
     4168    gesamt_m=gesamt_m+m; // add the newly found maximal
    41694169                         // ideal to the previous ones
    41704170  }
    41714171  // check if there is a solution which has the n-th component zero,
    4172   // if so, then eliminate the n-th variable from sat(i+x_n,t), 
     4172  // if so, then eliminate the n-th variable from sat(i+x_n,t),
    41734173  // otherwise leave i as it is;
    4174   // then check if the (remaining) ideal has as solution 
     4174  // then check if the (remaining) ideal has as solution
    41754175  // where the n-1st component is zero,
    41764176  // and procede as before; do the same for the remaining variables;
    4177   // this way we make sure that the remaining ideal has 
     4177  // this way we make sure that the remaining ideal has
    41784178  // a solution which has no component zero;
    41794179  intvec deletedvariables;    // the jth entry is set 1, if we eliminate x_j
    41804180  int numberdeletedvariables; // the number of eliminated variables
    41814181  ideal variablen;  // will contain the variables which are not eliminated
    4182   intvec tw=ww;     // in case some variables are deleted, 
     4182  intvec tw=ww;     // in case some variables are deleted,
    41834183                    // we have to store the old weight vector
    41844184  deletedvariables[anzahlvariablen]=0;
    4185   ideal I,LI; 
     4185  ideal I,LI;
    41864186  i=i+m; // if a field extension was necessary, then i has to be extended by m
    41874187  for (jj=anzahlvariablen-1;jj>=1;jj--)  // the variable t is the last one !!!
     
    41904190    LI=subst(I,var(nvars(basering)),0);
    41914191    //size(deletedvariables)=anzahlvariablen(before elim.)
    4192     for (kk=1;kk<=size(deletedvariables)-1;kk++) 
     4192    for (kk=1;kk<=size(deletedvariables)-1;kk++)
    41934193    {
    41944194      LI=subst(LI,var(kk),0);
    41954195    }
    4196     if (size(LI)==0) // if no power of t is in lead(I) 
     4196    if (size(LI)==0) // if no power of t is in lead(I)
    41974197    { // (where the X(i) are considered as field elements)
    4198       // get rid of var(jj)   
     4198      // get rid of var(jj)
    41994199      i=eliminate(I,var(jj));
    42004200      deletedvariables[jj]=1;
    4201       anzahlvariablen--; // if a variable is eliminated, 
     4201      anzahlvariablen--; // if a variable is eliminated,
    42024202                         // then the number of true variables drops
    42034203      numberdeletedvariables++;
     
    42094209  }
    42104210  variablen=invertorder(variablen);
    4211   // store also the additional variables and t, 
     4211  // store also the additional variables and t,
    42124212  // since they for sure have not been eliminated
    42134213  for (jj=anzahlvariablen+numberdeletedvariables-1;jj<=nvars(basering);jj++)
     
    42154215    variablen=variablen+var(jj);
    42164216  }
    4217   // if some variables have been eliminated, 
     4217  // if some variables have been eliminated,
    42184218  // then pass to a new ring which has less variables,
    42194219  // but if no variables are left, then we are done
    42204220  def BASERING=basering;
    4221   if ((numberdeletedvariables>0) and (anzahlvariablen>1)) // if only t remains, 
     4221  if ((numberdeletedvariables>0) and (anzahlvariablen>1)) // if only t remains,
    42224222  { // all true variables are gone
    42234223    execute("ring NEURING=("+charstr(basering)+"),("+string(variablen)+"),(dp("+string(size(variablen)-1)+"),lp(1));");
    42244224    ideal i=imap(BASERING,i);
    4225     ideal gesamt_m=imap(BASERING,gesamt_m);   
    4226   }
    4227   // now we have to compute a point ww on the tropical variety 
     4225    ideal gesamt_m=imap(BASERING,gesamt_m);
     4226  }
     4227  // now we have to compute a point ww on the tropical variety
    42284228  // of the transformed ideal i;
    4229   // of course, we only have to do so, if we have not yet 
     4229  // of course, we only have to do so, if we have not yet
    42304230  // reached the order up to which we
    42314231  // were supposed to do our computations
    4232   if ((ordnung>1) and (anzahlvariablen>1)) // if only t remains, 
     4232  if ((ordnung>1) and (anzahlvariablen>1)) // if only t remains,
    42334233  { // all true variables are gone
    42344234    def PREGFANRING=basering;
    42354235    if (nogfan!=1)
    4236     {     
     4236    {
    42374237      // pass to a ring which has variables which are suitable for gfan
    42384238      execute("ring GFANRING=("+charstr(basering)+"),(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z),dp;");
    4239       ideal phiideal=b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z; 
     4239      ideal phiideal=b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z;
    42404240      phiideal[nvars(PREGFANRING)]=a; // map t to a
    4241       map phi=PREGFANRING,phiideal; 
     4241      map phi=PREGFANRING,phiideal;
    42424242      ideal i=phi(i);
    4243       // homogenise the ideal i with the first not yet 
    4244       // used variable in our ring, since gfan 
    4245       // only handles homogenous ideals; in principle 
     4243      // homogenise the ideal i with the first not yet
     4244      // used variable in our ring, since gfan
     4245      // only handles homogenous ideals; in principle
    42464246      // for this one has first to compute a
    4247       // standard basis of i and homogenise that, 
    4248       // but for the tropical variety (says Anders) 
     4247      // standard basis of i and homogenise that,
     4248      // but for the tropical variety (says Anders)
    42494249      // it suffices to homogenise an arbitrary system of generators
    4250       // i=groebner(i); 
     4250      // i=groebner(i);
    42514251      i=homog(i,maxideal(1)[nvars(PREGFANRING)+1]);
    42524252      // if gfan version >= 0.3.0 is used and the characteristic
     
    42604260        write(":a /tmp/gfaninput","{"+string(i)+"}");
    42614261      }
    4262       else 
     4262      else
    42634263      {
    42644264        // write the ideal to a file which gfan takes as input and call gfan
     
    42814281        string trop=read("/tmp/gfanoutput");
    42824282        setring PREGFANRING;
    4283         intvec wneu=-1;    // this integer vector will store 
     4283        intvec wneu=-1;    // this integer vector will store
    42844284                           // the point on the tropical variety
    42854285        wneu[nvars(basering)]=0;
     
    42944294        "IF YOU WANT wneu TO BE TESTED, THEN SET goon=0;";
    42954295        ~
    4296           // THIS IS NOT NECESSARY !!!! IF WE COMPUTE NOT ONLY THE 
     4296          // THIS IS NOT NECESSARY !!!! IF WE COMPUTE NOT ONLY THE
    42974297          // TROPICAL PREVARIETY
    4298           // test, if wneu really is in the tropical variety   
     4298          // test, if wneu really is in the tropical variety
    42994299        while (goon==0)
    43004300        {
     
    43134313      {
    43144314        system("sh","gfan_tropicallifting -n "+string(anzahlvariablen)+" --noMult -c < /tmp/gfaninput > /tmp/gfanoutput");
    4315         // read the result from gfan and store it to a string, 
     4315        // read the result from gfan and store it to a string,
    43164316        // which in a later version
    43174317        // should be interpreded by Singular
     
    43264326    }
    43274327  }
    4328   // if we have not yet computed our parametrisation 
     4328  // if we have not yet computed our parametrisation
    43294329  // up to the required order and
    4330   // zero is not yet a solution, then we have 
     4330  // zero is not yet a solution, then we have
    43314331  // to go on by calling the procedure recursively;
    43324332  // if all variables were deleted, then i=0 and thus anzahlvariablen==0
    43334333  if ((ordnung>1) and (anzahlvariablen>1))
    4334   {   
    4335     // we call the procedure with the transformed ideal i, 
     4334  {
     4335    // we call the procedure with the transformed ideal i,
    43364336    // the new weight vector, with the
    4337     // required order lowered by one, and with 
     4337    // required order lowered by one, and with
    43384338    // additional parameters, namely the number of
    4339     // true variables and the maximal ideal that 
     4339    // true variables and the maximal ideal that
    43404340    // was computed so far to describe the field extension
    43414341    list PARALIST=tropicalparametriseNoabs(i,wneu,ordnung-1,gfanold,nogfan,anzahlvariablen,gesamt_m);
    4342     // the output will be a ring, in which the 
     4342    // the output will be a ring, in which the
    43434343    // parametrisation lives, and a string, which contains
    43444344    // the maximal ideal that describes the necessary field extension
     
    43474347    string PARAm=PARALIST[3];
    43484348    setring PARARing;
    4349     // if some variables have been eliminated in before, 
    4350     // then we have to insert zeros 
     4349    // if some variables have been eliminated in before,
     4350    // then we have to insert zeros
    43514351    // into the parametrisation for those variables
    43524352    if (numberdeletedvariables>0)
     
    43544354      ideal PARAneu=PARA;
    43554355      int k;
    4356       for (jj=1;jj<=anzahlvariablen+numberdeletedvariables-1;jj++) // t admits 
     4356      for (jj=1;jj<=anzahlvariablen+numberdeletedvariables-1;jj++) // t admits
    43574357      { // no parametrisation
    43584358        if (deletedvariables[jj]!=1)
     
    43684368    }
    43694369  }
    4370   // otherwise we are done and we can start to compute 
     4370  // otherwise we are done and we can start to compute
    43714371  // the last step of the parametrisation
    43724372  else
     
    43744374    // we store the information on m in a string
    43754375    string PARAm=string(gesamt_m);
    4376     // we define the weight of t, i.e. in the parametrisation t 
     4376    // we define the weight of t, i.e. in the parametrisation t
    43774377    // has to be replaced by t^1/tweight
    43784378    int tweight=-tw[1];
    4379     // if additional variables were necessary, 
     4379    // if additional variables were necessary,
    43804380    // we introduce them now as parameters;
    4381     // in any case the parametrisation ring will 
    4382     // have only one variable, namely t, 
    4383     // and its order will be local, so that it 
     4381    // in any case the parametrisation ring will
     4382    // have only one variable, namely t,
     4383    // and its order will be local, so that it
    43844384    // displays the lowest term in t first
    43854385    if (anzahlvariablen+numberdeletedvariables<nvars(basering))
     
    43924392    }
    43934393    ideal PARA; // will contain the parametrisation
    4394     // we start by initialising the entries to be zero; 
     4394    // we start by initialising the entries to be zero;
    43954395    // one entry for each true variable
    4396     // here we also have to consider the variables 
     4396    // here we also have to consider the variables
    43974397    // that we have eliminated in before
    43984398    for (jj=1;jj<=anzahlvariablen+numberdeletedvariables-1;jj++)
     
    44014401    }
    44024402  }
    4403   // we now have to change the parametrisation by 
     4403  // we now have to change the parametrisation by
    44044404  // reverting the transformations that we have done
    44054405  list a=imap(BASERING,a);
    4406   if (defined(wneu)==0) // when tropicalparametriseNoabs is called for the 
    4407   { // last time, it does not enter the part, where wneu is defined and the 
     4406  if (defined(wneu)==0) // when tropicalparametriseNoabs is called for the
     4407  { // last time, it does not enter the part, where wneu is defined and the
    44084408    intvec wneu=-1;     // variable t should have weight -1
    44094409  }
     
    44124412    PARA[jj]=(PARA[jj]+a[jj+1])*t^(tw[jj+1]*tweight/ww[1]);
    44134413  }
    4414   // if we have reached the stop-level, i.e. either 
     4414  // if we have reached the stop-level, i.e. either
    44154415  // we had only to compute up to order 1
    4416   // or zero was a solution of the ideal, then we have 
     4416  // or zero was a solution of the ideal, then we have
    44174417  // to export the computed parametrisation
    44184418  // otherwise it has already been exported before
    44194419  // note, if all variables were deleted, then i==0 and thus testaufnull==0
    44204420  if ((ordnung==1) or (anzahlvariablen==1))
    4421   {   
     4421  {
    44224422    export(PARA);
    44234423  }
    44244424  // kill the gfan files in /tmp
    4425   system("sh","cd /tmp; /usr/bin/touch gfaninput; /usr/bin/touch gfanoutput; /bin/rm gfaninput; /bin/rm gfanoutput"); 
    4426   // we return a list which contains the 
     4425  system("sh","cd /tmp; /usr/bin/touch gfaninput; /usr/bin/touch gfanoutput; /bin/rm gfaninput; /bin/rm gfanoutput");
     4426  // we return a list which contains the
    44274427  // parametrisation ring (with the parametrisation ideal)
    4428   // and the string representing the maximal ideal 
     4428  // and the string representing the maximal ideal
    44294429  // describing the necessary field extension
    44304430  return(list(PARARing,tweight,PARAm));
     
    44354435static proc findzeros (ideal i,intvec w,list #)
    44364436"USAGE:      findzeros(i,w[,#]); i ideal, w intvec, # an optional list
    4437 ASSUME:      i is an ideal in Q[t,x_1,...,x_n,X_n+1,...,X_m] and 
     4437ASSUME:      i is an ideal in Q[t,x_1,...,x_n,X_n+1,...,X_m] and
    44384438             w=(w_0,...,w_n,0,...,0) is in the tropical variety of i
    4439 RETURN:      list, l[1] = is polynomial ring containing an associated maximal 
    4440                           ideal m of the w-initial ideal of i which does not 
     4439RETURN:      list, l[1] = is polynomial ring containing an associated maximal
     4440                          ideal m of the w-initial ideal of i which does not
    44414441                          contain any monomial and where the variables
    4442                           which do not lead to a field extension have already 
    4443                           been eliminated, and containing a list a such that 
    4444                           the non-zero entries of a correspond to the values 
     4442                          which do not lead to a field extension have already
     4443                          been eliminated, and containing a list a such that
     4444                          the non-zero entries of a correspond to the values
    44454445                          of the zero of the associated maximal ideal for the
    44464446                          eliminated variables
    44474447                   l[2] = number of variables which have not been eliminated
    4448                    l[3] = intvec, if the entry is one then the corresponding 
     4448                   l[3] = intvec, if the entry is one then the corresponding
    44494449                                  variable has not been eliminated
    4450 NOTE:        the procedure is called from inside the recursive procedure 
     4450NOTE:        the procedure is called from inside the recursive procedure
    44514451             tropicalparametriseNoabs;
    4452              if it is called in the first recursion, the list #[1] contains 
    4453              the t-initial ideal of i w.r.t. w, otherwise #[1] is an integer, 
     4452             if it is called in the first recursion, the list #[1] contains
     4453             the t-initial ideal of i w.r.t. w, otherwise #[1] is an integer,
    44544454             one more than the number of true variables x_1,...,x_n"
    44554455{
    4456   def BASERING=basering; 
     4456  def BASERING=basering;
    44574457  // set anzahlvariablen to the number of true variables
    44584458  if (typeof(#[1])=="int")
     
    44604460    int anzahlvariablen=#[1];
    44614461    // compute the initial ideal of i
    4462     // - the last 1 just means that the variable t is the last 
     4462    // - the last 1 just means that the variable t is the last
    44634463    //   variable in the ring
    44644464    ideal ini=tInitialIdeal(i,w,1);
     
    44674467  {
    44684468    int anzahlvariablen=nvars(basering);
    4469     ideal ini=#[1]; // the t-initial ideal has been computed 
     4469    ideal ini=#[1]; // the t-initial ideal has been computed
    44704470                    // in before and was handed over
    44714471  }
    4472   // move to a polynomial ring with global monomial ordering 
     4472  // move to a polynomial ring with global monomial ordering
    44734473  // - the variable t is superflous
    44744474  ideal variablen;
    44754475  for (int j=1;j<=nvars(basering)-1;j++)
    4476   {   
     4476  {
    44774477    variablen=variablen+var(j);
    44784478  }
     
    44804480  ideal ini=imap(BASERING,ini);
    44814481  // compute the associated primes of the initialideal
    4482   // ordering the maximal ideals shall help to avoid 
     4482  // ordering the maximal ideals shall help to avoid
    44834483  // unneccessary field extensions
    44844484  list maximalideals=ordermaximalidealsNoabs(minAssGTZ(std(ini)),anzahlvariablen);
    44854485  ideal m=maximalideals[1][1];              // the first associated maximal ideal
    44864486  int neuvar=maximalideals[1][2];           // the number of new variables needed
    4487   intvec neuevariablen=maximalideals[1][3]; // the information which variable 
     4487  intvec neuevariablen=maximalideals[1][3]; // the information which variable
    44884488                                            // leads to a new one
    4489   list a=maximalideals[1][4];               // a_k is the kth component of a 
     4489  list a=maximalideals[1][4];               // a_k is the kth component of a
    44904490                                            // zero of m, if it is not zero
    4491   // eliminate from m the superflous variables, that is those ones, 
     4491  // eliminate from m the superflous variables, that is those ones,
    44924492  // which do not lead to a new variable
    44934493  poly elimvars=1;
     
    44994499    }
    45004500  }
    4501   m=eliminate(m,elimvars); 
    4502   export(a); 
     4501  m=eliminate(m,elimvars);
     4502  export(a);
    45034503  export(m);
    45044504  list m_ring=INITIALRING,neuvar,neuevariablen;
     
    45124512static proc basictransformideal (ideal i,intvec w,list m_ring,list #)
    45134513"USAGE:  basictransformideal(i,w,m_ring[,#]); i ideal, w intvec, m_ring list, # an optional list
    4514 ASSUME:  i is an ideal in Q[t,x_1,...,x_n,X_1,...,X_k], 
    4515          w=(w_0,...,w_n,0,...,0) is in the tropical variety of i, and 
     4514ASSUME:  i is an ideal in Q[t,x_1,...,x_n,X_1,...,X_k],
     4515         w=(w_0,...,w_n,0,...,0) is in the tropical variety of i, and
    45164516         m_ring contains a ring containing a maximal ideal m needed
    4517          to describe the field extension over which a corresponding 
    4518          associated maximal ideal of the initialideal of i, considered 
    4519          in (Q[X_1,...,X_k]/m_alt)(t)[x_1,...,x_n], has a zero, and 
     4517         to describe the field extension over which a corresponding
     4518         associated maximal ideal of the initialideal of i, considered
     4519         in (Q[X_1,...,X_k]/m_alt)(t)[x_1,...,x_n], has a zero, and
    45204520         containing a list a describing the zero of m, and m_ring contains
    45214521         the information how many new variables are needed for m
     
    45244524                      l[3] = ideal, the maximal ideal m
    45254525               or l[1] = ring which contains the ideals i and m, and the list a
    4526 NOTE:    the procedure is called from inside the recursive procedure 
     4526NOTE:    the procedure is called from inside the recursive procedure
    45274527         tropicalparametriseNoabs;
    4528          if it is called in the first recursion, the list # is empty, 
     4528         if it is called in the first recursion, the list # is empty,
    45294529         otherwise #[1] is an integer, the number of true variables x_1,...,x_n;
    4530          during the procedure we check if a field extension is necessary 
    4531          to express a zero (a_1,...,a_n) of m; if so, we have to introduce 
    4532          new variables and a list containing a ring is returned, otherwise 
    4533          the list containing i, a and m is returned; 
    4534          the ideal m will be changed during the procedure since all variables 
     4530         during the procedure we check if a field extension is necessary
     4531         to express a zero (a_1,...,a_n) of m; if so, we have to introduce
     4532         new variables and a list containing a ring is returned, otherwise
     4533         the list containing i, a and m is returned;
     4534         the ideal m will be changed during the procedure since all variables
    45354535         which reduce to a polynomial in X_1,...,X_k modulo m will be eliminated,
    45364536         while the others are replaced by new variables X_k+1,...,X_k'"
     
    45444544    wdegs[j]=deg(i[j],intvec(w[2..size(w)],w[1]));
    45454545  }
    4546   // how many variables are true variables, 
     4546  // how many variables are true variables,
    45474547  // and how many come from the field extension
    45484548  // only real variables have to be transformed
     
    45594559  // get the information if any new variables are needed from m_ring
    45604560  int neuvar=m_ring[2];  // number of variables which have to be added
    4561   intvec neuevariablen=m_ring[3];  // [i]=1, if for the ith comp. 
     4561  intvec neuevariablen=m_ring[3];  // [i]=1, if for the ith comp.
    45624562                                   // of a zero of m a new variable is needed
    45634563  def MRING=m_ring[1];   // MRING contains a and m
    4564   list a=imap(MRING,a);  // (a_1,...,a_n)=(a[2],...,a[n+1]) will be 
     4564  list a=imap(MRING,a);  // (a_1,...,a_n)=(a[2],...,a[n+1]) will be
    45654565                         // a common zero of the ideal m
    4566   ideal m=std(imap(MRING,m)); // m is zero, if neuvar==0, 
     4566  ideal m=std(imap(MRING,m)); // m is zero, if neuvar==0,
    45674567                              // otherwise we change the ring anyway
    4568   // if a field extension is needed, then extend the polynomial 
     4568  // if a field extension is needed, then extend the polynomial
    45694569  // ring by new variables X_k+1,...,X_k';
    45704570  if (neuvar>0)
    45714571  {
    4572     // change to a ring where for each variable needed 
     4572    // change to a ring where for each variable needed
    45734573    // in m a new variable has been introduced
    45744574    ideal variablen;
     
    45814581    // map i into the new ring
    45824582    ideal i=imap(BASERING,i);
    4583     // define a map phi which maps the true variables, which are not 
     4583    // define a map phi which maps the true variables, which are not
    45844584    // reduced to polynomials in the additional variables modulo m, to
    4585     // the corresponding newly introduced variables, and which maps 
     4585    // the corresponding newly introduced variables, and which maps
    45864586    // the old additional variables to themselves
    45874587    ideal phiideal;
    45884588    k=1;
    4589     for (j=2;j<=size(neuevariablen);j++)  // starting with 2, since the 
     4589    for (j=2;j<=size(neuevariablen);j++)  // starting with 2, since the
    45904590    { // first entry corresponds to t
    45914591      if(neuevariablen[j]==1)
     
    45964596      else
    45974597      {
    4598         phiideal[j-1]=0; 
     4598        phiideal[j-1]=0;
    45994599      }
    46004600    }
     
    46034603      phiideal=phiideal,X(1..nvars(BASERING)-anzahlvariablen);
    46044604    }
    4605     map phi=MRING,phiideal; 
    4606     // map m and a to the new ring via phi, so that the true variables 
     4605    map phi=MRING,phiideal;
     4606    // map m and a to the new ring via phi, so that the true variables
    46074607    // in m and a are replaced by
    46084608    // the corresponding newly introduced variables
     
    46104610    list a=phi(a);
    46114611  }
    4612   // replace now the zeros among the a_j by the corresponding 
     4612  // replace now the zeros among the a_j by the corresponding
    46134613  // newly introduced variables;
    4614   // note that no component of a can be zero 
     4614  // note that no component of a can be zero
    46154615  // since the maximal ideal m contains no variable!
    4616   // moreover, substitute right away in the ideal i 
     4616  // moreover, substitute right away in the ideal i
    46174617  // the true variable x_j by (a_j+x_j)*t^w_j
    46184618  zaehler=nvars(BASERING)-anzahlvariablen+1;
    4619   for (j=1;j<=anzahlvariablen;j++) 
     4619  for (j=1;j<=anzahlvariablen;j++)
    46204620  {
    46214621    if ((a[j]==0) and (j!=1))  // a[1]=0, since t->t^w_0
    4622     {       
     4622    {
    46234623      a[j]=X(zaehler);
    46244624      zaehler++;
     
    46274627    {
    46284628      if (j!=1) // corresponds to  x_(j-1) --  note t is the last variable
    4629       {       
     4629      {
    46304630        i[k]=substitute(i[k],var(j-1),(a[j]+var(j-1))*t^(-w[j]));
    46314631      }
     
    46394639  for (j=1;j<=ncols(i);j++)
    46404640  {
    4641     if (wdegs[j]<0) // if wdegs[j]==0 there is no need to divide, and 
     4641    if (wdegs[j]<0) // if wdegs[j]==0 there is no need to divide, and
    46424642    { // we made sure that it is no positive
    46434643      i[j]=i[j]/t^(-wdegs[j]);
    46444644    }
    46454645  }
    4646   // since we want to consider i now in the ring 
     4646  // since we want to consider i now in the ring
    46474647  // (Q[X_1,...,X_k']/m)[t,x_1,...,x_n]
    4648   // we can  reduce i modulo m, so that "constant terms" 
     4648  // we can  reduce i modulo m, so that "constant terms"
    46494649  // which are "zero" since they
    46504650  // are in m will disappear; simplify(...,2) then really removes them
    46514651  i=simplify(reduce(i,m),2);
    4652   // if new variables have been introduced, we have 
     4652  // if new variables have been introduced, we have
    46534653  // to return the ring containing i, a and m
    46544654  // otherwise we can simply return a list containing i, a and m
     
    46714671static proc testw (ideal i,intvec w,int anzahlvariablen,list #)
    46724672"USAGE:      testw(i,w,n); i ideal, w intvec, n number
    4673 ASSUME:      i is an ideal in Q[t,x_1,...,x_n,X_1,...,X_k] and 
    4674              w=(w_0,...,w_n,0,...,0)           
    4675 RETURN:      int b, 0 if the t-initial ideal of i considered in 
     4673ASSUME:      i is an ideal in Q[t,x_1,...,x_n,X_1,...,X_k] and
     4674             w=(w_0,...,w_n,0,...,0)
     4675RETURN:      int b, 0 if the t-initial ideal of i considered in
    46764676                    Q(X_1,...,X_k)[t,x_1,...,x_n] is monomial free, 1 else
    46774677NOTE:        the procedure is called by tinitialform"
     
    46874687    ideal tin=tInitialIdeal(i,w,1);
    46884688  }
    4689  
     4689
    46904690  int j;
    46914691  ideal variablen;
     
    47194719  def BASERING=basering;
    47204720  if (anzahlvariablen<nvars(basering))
    4721   {   
     4721  {
    47224722    execute("ring TINRING=("+charstr(basering)+","+string(Parameter)+"),("+string(variablen)+"),dp;");
    47234723  }
     
    47294729  poly monom=imap(BASERING,monom);
    47304730  return(radicalMemberShip(monom,tin));
    4731 } 
     4731}
    47324732
    47334733/////////////////////////////////////////////////////////////////////////
     
    47354735static proc simplifyToOrder (poly f)
    47364736"USAGE:      simplifyToOrder(f); f a polynomial
    4737 ASSUME:      f is a polynomial in Q(t)[x_1,...,x_n] 
     4737ASSUME:      f is a polynomial in Q(t)[x_1,...,x_n]
    47384738RETURN:      list, l[1] = t-order of leading term of f
    47394739                   l[2] = the rational coefficient of the term of lowest t-order
     
    47584758static proc scalarproduct (intvec w,intvec v)
    47594759"USAGE:      scalarproduct(w,v); w,v intvec
    4760 ASSUME:      w and v are integer vectors of the same length 
     4760ASSUME:      w and v are integer vectors of the same length
    47614761RETURN:      int, the scalarproduct of v and w
    47624762NOTE:        the procedure is called by tropicalparametriseNoabs"
     
    48164816"USAGE:      ordermaximalidealsNoabs(minassi); minassi list
    48174817ASSUME:      minassi is a list of maximal ideals
    4818 RETURN:      list, the procedure orders the maximal ideals in minassi according 
    4819                    to how many new variables are needed to describe the zeros 
     4818RETURN:      list, the procedure orders the maximal ideals in minassi according
     4819                   to how many new variables are needed to describe the zeros
    48204820                   of the ideal
    48214821                   l[j][1] = jth maximal ideal
    48224822                   l[j][2] = the number of variables needed
    4823                    l[j][3] = intvec, if for the kth variable a new variable is 
    4824                                      needed to define the corresponding zero of 
     4823                   l[j][3] = intvec, if for the kth variable a new variable is
     4824                                     needed to define the corresponding zero of
    48254825                                     l[j][1], then the k+1st entry is one
    4826                    l[j][4] = list, if for the kth variable no new variable is 
    4827                                    needed to define the corresponding zero of 
     4826                   l[j][4] = list, if for the kth variable no new variable is
     4827                                   needed to define the corresponding zero of
    48284828                                   l[j][1], then its value is the k+1st entry
    48294829NOTE:        if a maximal ideal contains a variable, it is removed from the list;
     
    48344834  int pruefer;       // is set one if a maximal ideal contains a variable
    48354835  list minassisort;  // will contain the output
    4836   for (j=1;j<=size(minassi);j++){minassisort[j]=0;} // initialise minassisort 
     4836  for (j=1;j<=size(minassi);j++){minassisort[j]=0;} // initialise minassisort
    48374837                                                    // to fix its initial length
    48384838  list zwischen;     // needed for reordering
    48394839  list a;// (a_1,...,a_n)=(a[2],...,a[n+1]) will be a common zero of the ideal m
    48404840  poly nf;           // normalform of a variable w.r.t. m
    4841   intvec neuevariablen; // ith entry is 1, if for the ith component of a zero 
     4841  intvec neuevariablen; // ith entry is 1, if for the ith component of a zero
    48424842                        // of m a new variable is needed
    48434843  intvec testvariablen; // integer vector of length n=number of variables
    4844   // compute for each maximal ideal the number of new variables, 
     4844  // compute for each maximal ideal the number of new variables,
    48454845  // which are needed to describe
    4846   // its zeros -- note, a new variable is needed if modulo 
    4847   // the maximal ideal it does not reduce 
     4846  // its zeros -- note, a new variable is needed if modulo
     4847  // the maximal ideal it does not reduce
    48484848  // to something which only depends on the following variables;
    4849   // if no new variable is needed, then store the value 
    4850   // a variable reduces to in the list a; 
     4849  // if no new variable is needed, then store the value
     4850  // a variable reduces to in the list a;
    48514851  for (j=size(minassi);j>=1;j--)
    48524852  {
    4853     a[1]=poly(0);         // the first entry in a and in neuevariablen 
     4853    a[1]=poly(0);         // the first entry in a and in neuevariablen
    48544854                          // corresponds to the variable t,
    48554855    neuevariablen[1]=0;   // which is not present in the INITIALRING
     
    48594859    {
    48604860      nf=reduce(var(k),minassi[j]);
    4861       // if a variable reduces to zero, then the maximal ideal 
     4861      // if a variable reduces to zero, then the maximal ideal
    48624862      // contains a variable and we can delete it
    48634863      if (nf==0)
     
    48654865        pruefer=1;
    48664866      }
    4867       // set the entries of testvariablen corresponding to the first 
     4867      // set the entries of testvariablen corresponding to the first
    48684868      // k variables to 1, and the others to 0
    48694869      for (l=1;l<=nvars(basering);l++)
    48704870      {
    48714871        if (l<=k)
    4872         {         
     4872        {
    48734873          testvariablen[l]=1;
    48744874        }
     
    48784878        }
    48794879      }
    4880       // if the variable x_j reduces to a polynomial 
     4880      // if the variable x_j reduces to a polynomial
    48814881      // in x_j+1,...,x_n,X_1,...,X_k modulo m
    4882       // then we can eliminate x_j from the maximal ideal 
     4882      // then we can eliminate x_j from the maximal ideal
    48834883      // (since we do not need any
    4884       // further field extension to express a_j) and a_j 
     4884      // further field extension to express a_j) and a_j
    48854885      // will just be this normalform,
    48864886      // otherwise we have to introduce a new variable in order to express a_j;
     
    48894889        a[k+1]=nf; // a_k is the normal form of the kth variable modulo m
    48904890        neuevariablen[k+1]=0;  // no new variable is needed
    4891       }   
     4891      }
    48924892      else
    48934893      {
    4894         a[k+1]=poly(0); // a_k is set to zero until we have 
     4894        a[k+1]=poly(0); // a_k is set to zero until we have
    48954895                        // introduced the new variable
    48964896        neuevariablen[k+1]=1;
     
    49004900    // if the maximal ideal contains a variable, we simply delete it
    49014901    if (pruefer==0)
    4902     {     
     4902    {
    49034903      minassisort[j]=list(minassi[j],neuvar,neuevariablen,a);
    49044904    }
    4905     // otherwise we store the information on a, 
     4905    // otherwise we store the information on a,
    49064906    // neuevariablen and neuvar together with the ideal
    49074907    else
     
    49124912    }
    49134913  }
    4914   // sort the maximal ideals ascendingly according to 
     4914  // sort the maximal ideals ascendingly according to
    49154915  // the number of new variables needed to
    49164916  // express the zero of the maximal ideal
     
    49194919    l=j;
    49204920    for (k=j-1;k>=1;k--)
    4921     {     
     4921    {
    49224922      if (minassisort[l][2]<minassisort[k][2])
    49234923      {
     
    49374937"USAGE:  displaypoly(p,N,wj,w1); p poly, N, wj, w1 int
    49384938ASSUME:  p is a polynomial in r=(0,X(1..k)),t,ls
    4939 RETURN:  string, the string of t^-wj/w1*p(t^1/N) 
     4939RETURN:  string, the string of t^-wj/w1*p(t^1/N)
    49404940NOTE:    the procedure is called from displayTropicalLifting"
    49414941{
     
    49554955  {
    49564956    if (koeffizienten[j-ord(p)+1]!=0)
    4957     {     
     4957    {
    49584958      if ((j-(N*wj)/w1)==0)
    49594959      {
     
    50055005static proc displaycoef (poly p)
    50065006"USAGE:      displaycoef(p); p poly
    5007 RETURN:      string, the string of p where brackets around 
     5007RETURN:      string, the string of p where brackets around
    50085008                     have been added if they were missing
    50095009NOTE:        the procedure is called from displaypoly"
     
    50775077static proc tropicalliftingresubstitute (ideal i,list liftring,int N,list #)
    50785078"USAGE:   tropicalliftingresubstitute(i,L,N[,#]); i ideal, L list, N int, # string
    5079 ASSUME:   i is an ideal and L[1] is a ring which contains the lifting of a 
    5080           point in the tropical variety of i computed with tropicalLifting; 
    5081           t has to be replaced by t^1/N in the lifting; #[1]=m is the string 
    5082           of the maximal ideal defining the necessary field extension as 
     5079ASSUME:   i is an ideal and L[1] is a ring which contains the lifting of a
     5080          point in the tropical variety of i computed with tropicalLifting;
     5081          t has to be replaced by t^1/N in the lifting; #[1]=m is the string
     5082          of the maximal ideal defining the necessary field extension as
    50835083          computed by tropicalLifting, if #[1] is present
    50845084RETURN:   string, the lifting has been substituted into i
     
    51035103      ideal i=imap(BASERING,i);
    51045104    }
    5105   } 
     5105  }
    51065106  else
    51075107  {
     
    51165116  }
    51175117  // map the resulting i back to LIFTRing;
    5118   // if noAbs, then reduce i modulo the maximal ideal 
     5118  // if noAbs, then reduce i modulo the maximal ideal
    51195119  // before going back to LIFTRing
    51205120  if ((size(parstr(LIFTRing))!=0) and size(#)>0)
     
    51335133  for (j=1;j<=ncols(i);j++)
    51345134  {
    5135     SUBSTTEST[j]=displaypoly(i[j],N,0,1); 
     5135    SUBSTTEST[j]=displaypoly(i[j],N,0,1);
    51365136  }
    51375137  return(SUBSTTEST);
     
    51435143/// - eliminatecomponents
    51445144/// - findzerosAndBasictransform
    5145 /// - ordermaximalideals 
     5145/// - ordermaximalideals
    51465146///////////////////////////////////////////////////////////////////////////////
    51475147
    51485148static proc tropicalparametrise (ideal i,intvec ww,int ordnung,int gfanold,int findall,int nogfan,list #)
    51495149"USAGE:  tropicalparametrise(i,tw,ord,gf,fa,ng[,#]); i ideal, tw intvec, ord int, gf,fa,ng int, # opt. list
    5150 ASSUME:  - i is an ideal in Q[t,x_1,...,x_n,@a], tw=(w_0,w_1,...,w_n,0) 
    5151            and (w_0,...,w_n,0) is in the tropical variety of i, 
    5152            and ord is the order up to which a point in V(i) 
    5153            over K{{t}} lying over w shall be computed; 
    5154          - moreover, @a should be not be there if the procedure is not 
     5150ASSUME:  - i is an ideal in Q[t,x_1,...,x_n,@a], tw=(w_0,w_1,...,w_n,0)
     5151           and (w_0,...,w_n,0) is in the tropical variety of i,
     5152           and ord is the order up to which a point in V(i)
     5153           over K{{t}} lying over w shall be computed;
     5154         - moreover, @a should be not be there if the procedure is not
    51555155           called recursively;
    51565156         - the point in the tropical variety is supposed to lie in the
    51575157           NEGATIVE orthant;
    5158          - the ideal is zero-dimensional when considered in 
    5159            (K(t)[@a]/m)[x_1,...,x_n], where m=#[2] is a maximal ideal in K[@a]; 
     5158         - the ideal is zero-dimensional when considered in
     5159           (K(t)[@a]/m)[x_1,...,x_n], where m=#[2] is a maximal ideal in K[@a];
    51605160         - gf is 0 if version 2.2 or larger is used and it is 1 else
    51615161         - fa is 1 if all solutions should be found
     
    51645164               l[2] = int
    51655165NOTE:    - the procedure is also called recursively by itself, and
    5166            if it is called in the first recursion, the list # is empty, 
    5167            otherwise #[1] is an integer, one more than the number of 
    5168            true variables x_1,...,x_n, and #[2] will contain the maximal 
    5169            ideal m in the variable @a by which the ring K[t,x_1,...,x_n,@a] 
    5170            should be divided to work correctly in L[t,x_1,...,x_n] where 
     5166           if it is called in the first recursion, the list # is empty,
     5167           otherwise #[1] is an integer, one more than the number of
     5168           true variables x_1,...,x_n, and #[2] will contain the maximal
     5169           ideal m in the variable @a by which the ring K[t,x_1,...,x_n,@a]
     5170           should be divided to work correctly in L[t,x_1,...,x_n] where
    51715171           L=Q[@a]/m is a field extension of K
    5172          - the ring l[1] contains an ideal PARA, which contains the 
    5173            parametrisation of a point in V(i) lying over w up to the first 
     5172         - the ring l[1] contains an ideal PARA, which contains the
     5173           parametrisation of a point in V(i) lying over w up to the first
    51745174           ord terms;
    5175          - the string m contains the code of the maximal ideal m, by which we 
     5175         - the string m contains the code of the maximal ideal m, by which we
    51765176           have to divide K[@a] in order to have the appropriate field extension
    51775177           over which the parametrisation lives;
    51785178         - and if the integer l[3] is N then t has to be replaced by t^1/N in the
    5179            parametrisation, or alternatively replace t by t^N in the defining 
     5179           parametrisation, or alternatively replace t by t^N in the defining
    51805180           ideal
    5181          - the procedure REQUIRES that the program GFAN is installed 
     5181         - the procedure REQUIRES that the program GFAN is installed
    51825182           on your computer"
    51835183{
     
    51855185  int recursively; // is set 1 if the procedure is called recursively by itself
    51865186  int ii,jj,kk,ll,jjj,kkk,lll;
    5187   if (typeof(#[1])=="int") // this means the precedure has been 
     5187  if (typeof(#[1])=="int") // this means the precedure has been
    51885188  { // called recursively
    5189     // how many variables are true variables, and how many come 
     5189    // how many variables are true variables, and how many come
    51905190    // from the field extension
    51915191    // only true variables have to be transformed
    51925192    int anzahlvariablen=#[1];
    51935193    // find the zeros of the w-initial ideal and transform the ideal i;
    5194     // findzeros and basictransformideal need to know 
     5194    // findzeros and basictransformideal need to know
    51955195    // how many of the variables are true variables
    51965196    // and do the basic transformation as well
     
    52005200  else // the procedure has been called by tropicalLifting
    52015201  {
    5202     // how many variables are true variables, and 
     5202    // how many variables are true variables, and
    52035203    // how many come from the field extension
    52045204    // only true variables have to be transformed
    52055205    int anzahlvariablen=nvars(basering);
    5206     list zerolist; // will carry the zeros which are 
    5207     //computed in the recursion steps   
     5206    list zerolist; // will carry the zeros which are
     5207    //computed in the recursion steps
    52085208    // the initial ideal of i has been handed over as #[1]
    52095209    ideal ini=#[1];
    52105210    // find the zeros of the w-initial ideal and transform the ideal i;
    5211     // we should hand the t-initial ideal ine to findzeros, 
     5211    // we should hand the t-initial ideal ine to findzeros,
    52125212    // since we know it already;
    52135213    // and do the basic transformation as well
     
    52155215  }
    52165216  list wneulist; // carries all newly computed weight vector
    5217   intvec wneu;   // carries the newly computed weight vector 
     5217  intvec wneu;   // carries the newly computed weight vector
    52185218  int tweight;   // carries the weight of t
    5219   list PARALIST; // carries the result when tropicalparametrise 
     5219  list PARALIST; // carries the result when tropicalparametrise
    52205220                 // is recursively called
    52215221  list eliminaterings;     // carries the result of eliminatecomponents
     
    52265226  list liftings,partliftings;  // the computed liftings (all resp. partly)
    52275227  // consider each ring which has been returned when computing the zeros of the
    5228   // the t-initial ideal, equivalently, consider 
     5228  // the t-initial ideal, equivalently, consider
    52295229  // each zero which has been returned
    52305230  for (jj=1;jj<=size(trring);jj++)
     
    52325232    def TRRING=trring[jj];
    52335233    setring TRRING;
    5234     // check if a certain number of components lead to suitable 
     5234    // check if a certain number of components lead to suitable
    52355235    // solutions with zero components;
    52365236    // compute them all if findall==1
    52375237    eliminaterings=eliminatecomponents(i,m,oldanzahlvariablen,findall,oldanzahlvariablen-1,deletedvariables);
    5238     // consider each of the rings returned by eliminaterings ... 
     5238    // consider each of the rings returned by eliminaterings ...
    52395239    // there is at least one !!!
    52405240    for (ii=1;ii<=size(eliminaterings);ii++)
    52415241    {
    52425242      // #variables which have been eliminated
    5243       numberdeletedvariables=oldanzahlvariablen-eliminaterings[ii][2]; 
     5243      numberdeletedvariables=oldanzahlvariablen-eliminaterings[ii][2];
    52445244      // #true variables which remain (including t)
    5245       anzahlvariablen=eliminaterings[ii][2]; 
     5245      anzahlvariablen=eliminaterings[ii][2];
    52465246      // a 1 in this vector says that variable was eliminated
    5247       deletedvariables=eliminaterings[ii][3]; 
     5247      deletedvariables=eliminaterings[ii][3];
    52485248      setring TRRING; // set TRRING - this is important for the loop
    52495249      // pass the ring computed by eliminatecomponents
    5250       def PREGFANRING=eliminaterings[ii][1]; 
     5250      def PREGFANRING=eliminaterings[ii][1];
    52515251      setring PREGFANRING;
    52525252      poly m=imap(TRRING,m);        // map the maximal ideal to this ring
    52535253      list zero=imap(TRRING,zero);  // map the vector of zeros to this ring
    5254       // now we have to compute a point ww on the tropical 
     5254      // now we have to compute a point ww on the tropical
    52555255      // variety of the transformed ideal i;
    5256       // of course, we only have to do so, if we have 
     5256      // of course, we only have to do so, if we have
    52575257      // not yet reached the order up to which we
    52585258      // were supposed to do our computations
    5259       if ((ordnung>1) and (anzahlvariablen>1)) // if only t remains, 
     5259      if ((ordnung>1) and (anzahlvariablen>1)) // if only t remains,
    52605260      { // all true variables are gone
    52615261        if (nogfan!=1)
    5262         {         
     5262        {
    52635263          // pass to a ring which has variables which are suitable for gfan
    52645264          execute("ring GFANRING=("+string(char(basering))+"),(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z),dp;");
    5265           ideal phiideal=b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z; 
     5265          ideal phiideal=b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z;
    52665266          phiideal[nvars(PREGFANRING)]=a; // map t to a
    5267           map phi=PREGFANRING,phiideal; 
     5267          map phi=PREGFANRING,phiideal;
    52685268          ideal II=phi(i);
    5269           // homogenise the ideal II with the first not yet 
    5270           // used variable in our ring, since gfan 
    5271           // only handles homogenous ideals; in principle for this 
     5269          // homogenise the ideal II with the first not yet
     5270          // used variable in our ring, since gfan
     5271          // only handles homogenous ideals; in principle for this
    52725272          // one has first to compute a
    5273           // standard basis of II and homogenise that, 
    5274           // but for the tropical variety (says Anders) 
     5273          // standard basis of II and homogenise that,
     5274          // but for the tropical variety (says Anders)
    52755275          // it suffices to homogenise an arbitrary system of generators
    5276           // II=groebner(II); 
     5276          // II=groebner(II);
    52775277          II=homog(II,maxideal(1)[nvars(PREGFANRING)+1]);
    52785278          // if gfan version >= 0.3.0 is used and the characteristic
     
    53125312            int goon=1;
    53135313            trop;
    5314             "CHOOSE A RAY IN THE OUTPUT OF GFAN WHICH HAS ONLY"; 
     5314            "CHOOSE A RAY IN THE OUTPUT OF GFAN WHICH HAS ONLY";
    53155315            "NON-POSITIVE ENTRIES AND STARTS WITH A NEGATIVE ONE,";
    53165316            "E.G. (-3,-4,-1,-5,0,0,0) - the last entry will always be 0 -";
     
    53195319            "IF YOU WANT wneu TO BE TESTED, THEN SET goon=0;";
    53205320            ~
    5321             // THIS IS NOT NECESSARY !!!! IF WE COMPUTE NOT ONLY 
     5321            // THIS IS NOT NECESSARY !!!! IF WE COMPUTE NOT ONLY
    53225322            // THE TROPICAL PREVARIETY
    5323             // test, if wneu really is in the tropical variety   
     5323            // test, if wneu really is in the tropical variety
    53245324            while (goon==0)
    53255325            {
     
    53395339          {
    53405340            system("sh","gfan_tropicallifting -n "+string(anzahlvariablen)+" --noMult -c < /tmp/gfaninput > /tmp/gfanoutput");
    5341             // read the result from gfan and store it to a string, 
     5341            // read the result from gfan and store it to a string,
    53425342            // which in a later version
    53435343            // should be interpreded by Singular
     
    53625362        }
    53635363      }
    5364       // if we have not yet computed our parametrisation up to 
     5364      // if we have not yet computed our parametrisation up to
    53655365      // the required order and
    5366       // zero is not yet a solution, then we have to go on 
     5366      // zero is not yet a solution, then we have to go on
    53675367      // by calling the procedure recursively;
    53685368      // if all variables were deleted, then i=0 and thus anzahlvariablen==0
    53695369      lll=0;
    53705370      if ((ordnung>1) and (anzahlvariablen>1))
    5371       { 
     5371      {
    53725372        partliftings=list(); // initialise partliftings
    5373         // we call the procedure with the transformed 
     5373        // we call the procedure with the transformed
    53745374        // ideal i, the new weight vector, with the
    5375         // required order lowered by one, and with 
     5375        // required order lowered by one, and with
    53765376        // additional parameters, namely the number of
    5377         // true variables and the maximal ideal that 
     5377        // true variables and the maximal ideal that
    53785378        // was computed so far to describe the field extension
    53795379        for (kk=1;kk<=size(wneulist);kk++)
     
    53815381          wneu=wneulist[kk];
    53825382          PARALIST=tropicalparametrise(i,wneu,ordnung-1,gfanold,findall,nogfan,anzahlvariablen,zero);
    5383           // the output will be a ring, in which the 
     5383          // the output will be a ring, in which the
    53845384          // parametrisation lives, and a string, which contains
    53855385          // the maximal ideal that describes the necessary field extension
    53865386          for (ll=1;ll<=size(PARALIST);ll++)
    5387           { 
     5387          {
    53885388            def PARARing=PARALIST[ll][1];
    53895389            tweight=-ww[1]*PARALIST[ll][2];
    53905390            setring PARARing;
    5391             // if some variables have been eliminated 
    5392             // in before, then we have to insert zeros 
     5391            // if some variables have been eliminated
     5392            // in before, then we have to insert zeros
    53935393            // into the parametrisation for those variables
    53945394            if (numberdeletedvariables>0)
     
    53965396              ideal PARAneu=PARA;
    53975397              kkk=0;
    5398               for (jjj=1;jjj<=anzahlvariablen+numberdeletedvariables-1;jjj++) 
     5398              for (jjj=1;jjj<=anzahlvariablen+numberdeletedvariables-1;jjj++)
    53995399              { // t admits no parametrisation
    54005400                if (deletedvariables[jjj]!=1)
     
    54165416        }
    54175417      }
    5418       // otherwise we are done and we can start 
     5418      // otherwise we are done and we can start
    54195419      // to compute the last step of the parametrisation
    54205420      else
    54215421      {
    5422         // we define the weight of t, i.e. in the 
     5422        // we define the weight of t, i.e. in the
    54235423        // parametrisation t has to be replaced by t^1/tweight
    54245424        tweight=-ww[1];
    5425         // if additional variables were necessary, 
     5425        // if additional variables were necessary,
    54265426        // we introduce them now as parameters;
    5427         // in any case the parametrisation ring will 
    5428         // have only one variable, namely t, 
    5429         // and its order will be local, so that it 
     5427        // in any case the parametrisation ring will
     5428        // have only one variable, namely t,
     5429        // and its order will be local, so that it
    54305430        // displays the lowest term in t first
    54315431        if (anzahlvariablen<nvars(basering))
     
    54395439        }
    54405440        ideal PARA; // will contain the parametrisation
    5441         // we start by initialising the entries to be zero; 
     5441        // we start by initialising the entries to be zero;
    54425442        // one entry for each true variable
    5443         // here we also have to consider the variables 
     5443        // here we also have to consider the variables
    54445444        // that we have eliminated in before
    54455445        for (jjj=1;jjj<=anzahlvariablen+numberdeletedvariables-1;jjj++)
     
    54535453        kill PARARing;
    54545454      }
    5455       // we now have to change the parametrisation by 
     5455      // we now have to change the parametrisation by
    54565456      // reverting the transformations that we have done
    54575457      for (lll=1;lll<=size(partliftings);lll++)
    54585458      {
    5459         if (size(partliftings[lll])==2) // when tropicalparametrise is called 
    5460         { // for the last time, it does not enter the part, where wneu is 
     5459        if (size(partliftings[lll])==2) // when tropicalparametrise is called
     5460        { // for the last time, it does not enter the part, where wneu is
    54615461          wneu=-1;     // defined and the variable t should have weight -1
    54625462        }
     
    54735473          PARA[jjj]=(PARA[jjj]+zeros[size(zeros)][jjj+1])*t^(ww[jjj+1]*tweight/ww[1]);
    54745474        }
    5475         // delete the last entry in zero, since that one has 
     5475        // delete the last entry in zero, since that one has
    54765476        // been used for the transformation
    54775477        zeros=delete(zeros,size(zeros));
    5478         // in order to avoid redefining commands an empty 
     5478        // in order to avoid redefining commands an empty
    54795479        // zeros list should be removed
    54805480        if (size(zeros)==0)
     
    54925492  }
    54935493  // kill the gfan files in /tmp
    5494   system("sh","cd /tmp; /usr/bin/touch gfaninput; /usr/bin/touch gfanoutput; /bin/rm gfaninput; /bin/rm gfanoutput"); 
    5495   // we return a list which contains lists of the parametrisation 
     5494  system("sh","cd /tmp; /usr/bin/touch gfaninput; /usr/bin/touch gfanoutput; /bin/rm gfaninput; /bin/rm gfanoutput");
     5495  // we return a list which contains lists of the parametrisation
    54965496  // rings (with the parametrisation ideal)
    54975497  // and an integer N such that t should be replaced by t^1/N
     
    55035503static proc eliminatecomponents (ideal i,ideal m,int anzahlvariablen,int findall,int lastvar,intvec deletedvariables)
    55045504"USAGE:  eliminatecomponents(i,m,n,a,v,d); i,m ideal, n,a,v int, d intvec
    5505 ASSUME:  i is an ideal in Q[x_1,...,x_n,@a,t] and w=(-w_1/w_0,...,-w_n/w_0) 
    5506          is in the tropical variety of i considered in 
    5507          Q[@a]/m{{t}}[x_1,...,x_n]; 
    5508          considered in this ring i is zero-dimensional; @a need not be present 
     5505ASSUME:  i is an ideal in Q[x_1,...,x_n,@a,t] and w=(-w_1/w_0,...,-w_n/w_0)
     5506         is in the tropical variety of i considered in
     5507         Q[@a]/m{{t}}[x_1,...,x_n];
     5508         considered in this ring i is zero-dimensional; @a need not be present
    55095509         in which case m is zero; 1<=v<=n
    55105510RETURN:  list, L of lists
     
    55125512               L[j][2] = an integer anzahlvariablen
    55135513               L[j][3] = an intvec deletedvariables
    5514 NOTE:    - the procedure is called from inside the recursive 
     5514NOTE:    - the procedure is called from inside the recursive
    55155515           procedure tropicalparametrise
    5516          - the procedure checks for solutions which have certain 
    5517            components zero; these are separated from the rest by 
    5518            elimination and saturation; the integer deletedvariables 
    5519            records which variables have been eliminated; 
    5520            the integer anzahlvariablen records how many true variables remain 
     5516         - the procedure checks for solutions which have certain
     5517           components zero; these are separated from the rest by
     5518           elimination and saturation; the integer deletedvariables
     5519           records which variables have been eliminated;
     5520           the integer anzahlvariablen records how many true variables remain
    55215521           after the elimination
    5522          - if the integer a is one then all zeros of the ideal i are 
    5523            considered and found, otherwise only one is considered, so that L 
     5522         - if the integer a is one then all zeros of the ideal i are
     5523           considered and found, otherwise only one is considered, so that L
    55245524           has length one"
    55255525{
     
    55295529  // if all solutions have to be found
    55305530  if (findall==1)
    5531   {   
     5531  {
    55325532    list saturatelist,eliminatelist; // carry the solution of the two tests
    5533     // we test first if there is a solution which has the component 
    5534     // lastvar zero and 
     5533    // we test first if there is a solution which has the component
     5534    // lastvar zero and
    55355535    // where the order of each component is strictly positive;
    5536     // if so, we add this variable to the ideal and 
     5536    // if so, we add this variable to the ideal and
    55375537    // eliminate it - which amounts to
    5538     // to projecting the solutions with this component 
     5538    // to projecting the solutions with this component
    55395539    // zero to the hyperplane without this component;
    5540     // for the test we compute the saturation with 
     5540    // for the test we compute the saturation with
    55415541    // respect to t and replace each variable
    5542     // x_i and also t by zero -- if the result is zero, 
    5543     // then 1 is not in I:t^infty 
     5542    // x_i and also t by zero -- if the result is zero,
     5543    // then 1 is not in I:t^infty
    55445544    // (i.e. there is a solution which has the component lastvar zero) and
    5545     // the result lives in the maximal 
    5546     // ideal <t,x_1,...,[no x_lastvar],...,x_n> so that 
     5545    // the result lives in the maximal
     5546    // ideal <t,x_1,...,[no x_lastvar],...,x_n> so that
    55475547    // there is a solution which has strictly positive valuation
    55485548/*
    55495549    // DER NACHFOLGENDE TEIL IST MUELL UND WIRD NICHT MEHR GAMACHT
    5550     // for the test we simply compute the leading ideal 
     5550    // for the test we simply compute the leading ideal
    55515551    // and set all true variables zero;
    5552     // since the ordering was an elimination ordering 
     5552    // since the ordering was an elimination ordering
    55535553    // with respect to (@a if present and) t
    5554     // there remains something not equal to zero 
     5554    // there remains something not equal to zero
    55555555    // if and only if there is polynomial which only
    5556     // depends on t (and @a if present), but that is 
     5556    // depends on t (and @a if present), but that is
    55575557    // a unit in K{{t}}, which would show that there
    55585558    // is no solution with the component lastvar zero;
    5559     // however, we also have to ensure that if there 
     5559    // however, we also have to ensure that if there
    55605560    // exists a solution with the component lastvar
    5561     // equal to zero then this component has a 
     5561    // equal to zero then this component has a
    55625562    // valuation with all strictly positive values!!!!;
    5563     // for this we can either saturate the ideal 
     5563    // for this we can either saturate the ideal
    55645564    // after elimination with respect to <t,x_1,...,x_n>
    5565     // and see if the saturated ideal is contained in <t,x_1,...x_n>+m, 
    5566     // or ALTERNATIVELY we can pass to the 
     5565    // and see if the saturated ideal is contained in <t,x_1,...x_n>+m,
     5566    // or ALTERNATIVELY we can pass to the
    55675567    // ring 0,(t,x_1,...,x_n,@a),(ds(n+1),dp(1)),
    5568     // compute a standard basis of the elimination 
     5568    // compute a standard basis of the elimination
    55695569    // ideal (plus m) there and check if the dimension 1
    5570     // (since we have not omitted the variable lastvar, 
     5570    // (since we have not omitted the variable lastvar,
    55715571    // this means that we have the ideal
    5572     // generated by t,x_1,...,[no x_lastvar],...,x_n 
     5572    // generated by t,x_1,...,[no x_lastvar],...,x_n
    55735573    // and this defines NO curve after omitting x_lastvar)
    55745574    I=std(ideal(var(lastvar)+i));
     
    55765576    LI=lead(reduce(I,std(m)));
    55775577    //size(deletedvariables)=anzahlvariablen(before elimination)
    5578     for (j=1;j<=anzahlvariablen-1;j++) 
     5578    for (j=1;j<=anzahlvariablen-1;j++)
    55795579    {
    55805580      LI=subst(LI,var(j),0);
     
    55825582    if (size(LI)==0) // if no power of t is in lead(I) (where @a is considered as a field element)
    55835583*/
    5584     I=reduce(sat(ideal(var(lastvar)+i),t)[1],std(m)); // get rid of the minimal 
     5584    I=reduce(sat(ideal(var(lastvar)+i),t)[1],std(m)); // get rid of the minimal
    55855585                                                      // polynomial for the test
    55865586    LI=subst(I,var(nvars(basering)),0);
    55875587    //size(deletedvariables)=anzahlvariablen(before elimination)
    5588     for (j=1;j<=anzahlvariablen-1;j++) 
     5588    for (j=1;j<=anzahlvariablen-1;j++)
    55895589    {
    55905590      LI=subst(LI,var(j),0);
    55915591    }
    5592     if (size(LI)==0) // the saturation lives in the maximal 
     5592    if (size(LI)==0) // the saturation lives in the maximal
    55935593    { // ideal generated by t and the x_i
    55945594      // get rid of var(lastvar)
     
    56055605      {
    56065606        string elring="ring ELIMINATERING=("+charstr(basering)+"),("+string(simplify(reduce(maxideal(1),std(var(lastvar))),2))+"),(";
    5607       }   
    5608       if (anzahlvariablen<nvars(basering)) // if @a was present, the 
     5607      }
     5608      if (anzahlvariablen<nvars(basering)) // if @a was present, the
    56095609      { // ordersting needs an additional entry
    56105610        elring=elring+"dp(1),";
    56115611      }
    56125612      elring=elring+"lp(1));";
    5613       execute(elring);     
     5613      execute(elring);
    56145614      ideal i=imap(BASERING,I); // move the ideal I to the new ring
    5615       // if not yet all variables have been checked, 
     5615      // if not yet all variables have been checked,
    56165616      // then go on with the next smaller variable,
    5617       // else prepare the elimination ring and the neccessary 
     5617      // else prepare the elimination ring and the neccessary
    56185618      // information for return
    56195619      if (lastvar>1)
     
    56285628      setring BASERING;
    56295629    }
    5630     // next we have to test if there is also a solution 
     5630    // next we have to test if there is also a solution
    56315631    // which has the variable lastvar non-zero;
    5632     // to do so, we saturate with respect to this variable; 
    5633     // since when considered over K{{t}} 
    5634     // the ideal is zero dimensional, this really removes 
     5632    // to do so, we saturate with respect to this variable;
     5633    // since when considered over K{{t}}
     5634    // the ideal is zero dimensional, this really removes
    56355635    // all solutions with that component zero;
    56365636    // the checking is then done as above
    56375637    i=std(sat(i,var(lastvar))[1]);
    56385638    I=reduce(i,std(m)); // "remove" m from i
    5639     // test first, if i still is in the ideal <t,x_1,...,x_n> -- if not, then 
    5640     // we know that i has no longer a point in the tropical 
     5639    // test first, if i still is in the ideal <t,x_1,...,x_n> -- if not, then
     5640    // we know that i has no longer a point in the tropical
    56415641    // variety with all components negative
    56425642    LI=subst(I,var(nvars(basering)),0);
    5643     for (j=1;j<=anzahlvariablen-1;j++) // set all variables 
     5643    for (j=1;j<=anzahlvariablen-1;j++) // set all variables
    56445644    { // t,x_1,...,x_n equal to zero
    56455645      LI=subst(LI,var(j),0);
    56465646    }
    56475647    if (size(LI)==0) // the entries of i have not constant part
    5648     {     
    5649       // check now, if the leading ideal of i contains an element 
     5648    {
     5649      // check now, if the leading ideal of i contains an element
    56505650      // which only depends on t
    56515651      LI=lead(I);
    56525652      //size(deletedvariables)=anzahlvariablen(before elimination)
    5653       for (j=1;j<=anzahlvariablen-1;j++) 
     5653      for (j=1;j<=anzahlvariablen-1;j++)
    56545654      {
    56555655        LI=subst(LI,var(j),0);
    56565656      }
    5657       if (size(LI)==0) // if no power of t is in lead(i) 
     5657      if (size(LI)==0) // if no power of t is in lead(i)
    56585658      { // (where @a is considered as a field element)
    5659         // if not yet all variables have been tested, go on with the 
     5659        // if not yet all variables have been tested, go on with the
    56605660        // next smaller variable
    56615661        // else prepare the neccessary information for return
     
    56655665        }
    56665666        else
    5667         {   
     5667        {
    56685668          execute("ring SATURATERING=("+charstr(basering)+"),("+varstr(basering)+"),("+ordstr(basering)+");");
    56695669          ideal i=imap(BASERING,i);
     
    56765676    return(eliminatelist+saturatelist);
    56775677  }
    5678   else // only one solution is searched for, we can do a simplified 
     5678  else // only one solution is searched for, we can do a simplified
    56795679  { // version of the above
    5680     // check if there is a solution which has the n-th component 
     5680    // check if there is a solution which has the n-th component
    56815681    // zero and with positive valuation,
    5682     // if so, then eliminate the n-th variable from 
     5682    // if so, then eliminate the n-th variable from
    56835683    // sat(i+x_n,t), otherwise leave i as it is;
    5684     // then check if the (remaining) ideal has as 
     5684    // then check if the (remaining) ideal has as
    56855685    // solution where the n-1st component is zero ...,
    56865686    // and procede as before; do the same for the remaining variables;
    5687     // this way we make sure that the remaining ideal has 
     5687    // this way we make sure that the remaining ideal has
    56885688    // a solution which has no component zero;
    56895689    ideal variablen; // will contain the variables which are not eliminated
     
    56935693      LI=subst(I,var(nvars(basering)),0);
    56945694      //size(deletedvariables)=anzahlvariablen-1(before elimination)
    5695       for (k=1;k<=size(deletedvariables);k++) 
     5695      for (k=1;k<=size(deletedvariables);k++)
    56965696      {
    56975697        LI=subst(LI,var(k),0);
    56985698      }
    5699       if (size(LI)==0) // if no power of t is in lead(I) 
     5699      if (size(LI)==0) // if no power of t is in lead(I)
    57005700      { // (where the X(i) are considered as field elements)
    5701         // get rid of var(j)   
     5701        // get rid of var(j)
    57025702        i=eliminate(I,var(j));
    57035703        deletedvariables[j]=1;
    5704         anzahlvariablen--; // if a variable is eliminated, 
     5704        anzahlvariablen--; // if a variable is eliminated,
    57055705                           // then the number of true variables drops
    57065706      }
     
    57115711    }
    57125712    variablen=invertorder(variablen);
    5713     // store also the additional variable and t, 
     5713    // store also the additional variable and t,
    57145714    // since they for sure have not been eliminated
    57155715    for (j=size(deletedvariables)+1;j<=nvars(basering);j++)
     
    57175717      variablen=variablen+var(j);
    57185718    }
    5719     // if there are variables left, then pass to a ring which 
    5720     // only realises these variables else we are done 
     5719    // if there are variables left, then pass to a ring which
     5720    // only realises these variables else we are done
    57215721    if (anzahlvariablen>1)
    57225722    {
     
    57265726    {
    57275727      string elring="ring ELIMINATERING=("+charstr(basering)+"),("+string(variablen)+"),(";
    5728     }   
    5729     if (size(deletedvariables)+1<nvars(basering)) // if @a was present, 
     5728    }
     5729    if (size(deletedvariables)+1<nvars(basering)) // if @a was present,
    57305730    { // the ordersting needs an additional entry
    57315731      elring=elring+"dp(1),";
    57325732    }
    57335733    elring=elring+"lp(1));";
    5734     execute(elring);     
     5734    execute(elring);
    57355735    ideal i=imap(BASERING,i);
    57365736    ideal m=imap(BASERING,m);
     
    57455745static proc findzerosAndBasictransform (ideal i,intvec w,list zerolist,int findall,list #)
    57465746"USAGE:  findzerosAndBasictransform(i,w,z,f[,#]); i ideal, w intvec, z list, f int,# an optional list
    5747 ASSUME:  i is an ideal in Q[t,x_1,...,x_n,@a] and w=(w_0,...,w_n,0) 
     5747ASSUME:  i is an ideal in Q[t,x_1,...,x_n,@a] and w=(w_0,...,w_n,0)
    57485748         is in the tropical variety of i; @a need not be present;
    57495749         the list 'zero' contains the zeros computed in previous recursion steps;
    5750          if 'f' is one then all zeros should be found and returned, 
     5750         if 'f' is one then all zeros should be found and returned,
    57515751         otherwise only one
    5752 RETURN:  list, each entry is a ring corresponding to one conjugacy class of 
    5753                zeros of the t-initial ideal inside the torus; each of the rings 
     5752RETURN:  list, each entry is a ring corresponding to one conjugacy class of
     5753               zeros of the t-initial ideal inside the torus; each of the rings
    57545754               contains the following objects
    57555755               ideal i    = the ideal i, where the variable @a (if present) has
    5756                             possibly been transformed according to the new 
    5757                             minimal polynomial, and where itself has been 
    5758                             submitted to the basic transform of the algorithm 
     5756                            possibly been transformed according to the new
     5757                            minimal polynomial, and where itself has been
     5758                            submitted to the basic transform of the algorithm
    57595759                            given by the jth zero found for the t-initial ideal;
    5760                             note that the new minimal polynomial has already 
     5760                            note that the new minimal polynomial has already
    57615761                            been added
    5762                poly m     = the new minimal polynomial for @a 
     5762               poly m     = the new minimal polynomial for @a
    57635763                            (it is zero if no @a is present)
    5764                list zero  = zero[k+1] is the kth component of a zero 
     5764               list zero  = zero[k+1] is the kth component of a zero
    57655765                            the t-initial ideal of i
    5766 NOTE:     -  the procedure is called from inside the recursive procedure 
     5766NOTE:     -  the procedure is called from inside the recursive procedure
    57675767             tropicalparametrise;
    5768              if it is called in the first recursion, the list #[1] contains 
    5769              the t-initial ideal of i w.r.t. w, otherwise #[1] is an integer, 
     5768             if it is called in the first recursion, the list #[1] contains
     5769             the t-initial ideal of i w.r.t. w, otherwise #[1] is an integer,
    57705770             one more than the number of true variables x_1,...,x_n
    5771           -  if #[2] is present, then it is an integer which tells whether 
     5771          -  if #[2] is present, then it is an integer which tells whether
    57725772             ALL zeros should be found or not"
    57735773{
     
    57875787    int anzahlvariablen=#[1];
    57885788    // compute the initial ideal of i
    5789     // - the last 1 just means that the variable t is the last 
     5789    // - the last 1 just means that the variable t is the last
    57905790    //   variable in the ring
    57915791    ideal ini=tInitialIdeal(i,w,1);
     
    57955795    int recursive=0;
    57965796    int anzahlvariablen=nvars(basering);
    5797     ideal ini=#[1]; // the t-initial ideal has been computed 
     5797    ideal ini=#[1]; // the t-initial ideal has been computed
    57985798                    // in before and was handed over
    5799   } 
     5799  }
    58005800  // collect the true variables x_1,...,x_n plus @a, if it is defined in BASERING
    58015801  ideal variablen;
    58025802  for (j=1;j<=nvars(basering)-1;j++)
    5803   {   
     5803  {
    58045804    variablen=variablen+var(j);
    58055805  }
    5806   // move to a polynomial ring with global monomial ordering 
     5806  // move to a polynomial ring with global monomial ordering
    58075807  // - the variable t is superflous,
    58085808  // the variable @a is not if it was already present
    58095809  execute("ring INITIALRING=("+charstr(basering)+"),("+string(variablen)+"),dp;");
    58105810  ideal ini=imap(BASERING,ini);
    5811   // compute the minimal associated primes of the 
     5811  // compute the minimal associated primes of the
    58125812  // initialideal over the algebraic closure;
    5813   // ordering the maximal ideals shall help to 
     5813  // ordering the maximal ideals shall help to
    58145814  // avoid unneccessary field extensions
    58155815  list absminass=absPrimdecGTZ(ini);
    5816   def ABSRING=absminass[1]; // the ring in which the minimal 
     5816  def ABSRING=absminass[1]; // the ring in which the minimal
    58175817                            // associated primes live
    58185818  setring ABSRING;
     
    58275827    // check fort the jth maximal ideal a field extension is necessary;
    58285828    // the latter condition says that @a is not in BASERING;
    5829     // if some of the maximal ideals needs a field extension, 
     5829    // if some of the maximal ideals needs a field extension,
    58305830    // then everything will live in this ring
    58315831    if ((maximalideals[j][1]!=0) and (nvars(BASERING)==anzahlvariablen))
    58325832    {
    5833       // define the extension ring which contains 
     5833      // define the extension ring which contains
    58345834      // the new variable @a, if it is not yet present
    58355835      execute("ring EXTENSIONRING=("+charstr(BASERING)+"),("+string(imap(BASERING,variablen))+",@a,"+tvar+"),(dp("+string(anzahlvariablen-1)+"),dp(1),lp(1));");
    5836       // phi maps x_i to x_i, @a to @a (if present in the ring), 
     5836      // phi maps x_i to x_i, @a to @a (if present in the ring),
    58375837      // and the additional variable
    5838       // for the field extension is mapped to @a as well 
     5838      // for the field extension is mapped to @a as well
    58395839      // -- note that we only apply phi
    5840       // to the list a, and in this list no @a is present; 
     5840      // to the list a, and in this list no @a is present;
    58415841      // therefore, it does not matter where this is mapped to
    58425842      map phi=ABSRING,imap(BASERING,variablen),@a;
    58435843    }
    5844     else // @a was already present in the BASERING or no 
     5844    else // @a was already present in the BASERING or no
    58455845    { // field extension is necessary
    58465846      execute("ring EXTENSIONRING=("+charstr(BASERING)+"),("+varstr(BASERING)+"),("+ordstr(BASERING)+");");
    5847       // phi maps x_i to x_i, @a to @a (if present in the ring), 
     5847      // phi maps x_i to x_i, @a to @a (if present in the ring),
    58485848      // and the additional variable
    5849       // for the field extension is mapped to @a as well respectively to 0, 
     5849      // for the field extension is mapped to @a as well respectively to 0,
    58505850      // if no @a is present;
    5851       // note that we only apply phi to the list a and to 
     5851      // note that we only apply phi to the list a and to
    58525852      // the replacement rule for
    5853       // the old variable @a, and in this list resp. 
    5854       // replacement rule no @a is present; 
     5853      // the old variable @a, and in this list resp.
     5854      // replacement rule no @a is present;
    58555855      // therefore, it does not matter where this is mapped to;
    58565856      if (anzahlvariablen<nvars(EXTENSIONRING)) // @a is in EXTENSIONRING
    5857       {     
     5857      {
    58585858        // additional variable is mapped to @a
    5859         map phi=ABSRING,imap(BASERING,variablen),@a; 
     5859        map phi=ABSRING,imap(BASERING,variablen),@a;
    58605860      }
    58615861      else
    58625862      {
    58635863        // additional variable is mapped to 0
    5864         map phi=ABSRING,imap(BASERING,variablen),0; 
     5864        map phi=ABSRING,imap(BASERING,variablen),0;
    58655865      }
    58665866    }
     
    58695869    poly m=maximalideals[j][1];    // extract m
    58705870    list zeroneu=maximalideals[j][2]; // extract the new zero
    5871     poly repl=maximalideals[j][3]; // extract the replacement rule   
    5872     // the list zero may very well exist as an EMPTY global list 
     5871    poly repl=maximalideals[j][3]; // extract the replacement rule
     5872    // the list zero may very well exist as an EMPTY global list
    58735873    // - in this case we have to remove it
    58745874    // in order to avoid a redefining warning
    5875     if (defined(zero)!=0) 
     5875    if (defined(zero)!=0)
    58765876    {
    58775877      if (size(zero)==0)
     
    58845884    {
    58855885      ideal i=imap(BASERING,i);
    5886       if (defined(zerolist)==0) // if zerolist is empty, it does not 
     5886      if (defined(zerolist)==0) // if zerolist is empty, it does not
    58875887      { // depend on BASERING !
    58885888        list zero=imap(BASERING,zerolist);
    58895889      }
    5890       else 
     5890      else
    58915891      {
    58925892        list zero=zerolist;
    58935893      }
    58945894    }
    5895     else // in BASERING was @a present 
     5895    else // in BASERING was @a present
    58965896    {
    58975897      ideal variablen=imap(BASERING,variablen);
    5898       // map i and zerolist to EXTENSIONRING replacing @a 
     5898      // map i and zerolist to EXTENSIONRING replacing @a
    58995899      // by the replacement rule repl
    59005900      map psi=BASERING,variablen[1..size(variablen)-1],repl,var(nvars(basering));
     
    59065906    zero[size(zero)+1]=zeroneu;
    59075907    // do now the basic transformation sending x_l -> t^-w_l*(zero_l+x_l)
    5908     for (l=1;l<=anzahlvariablen;l++) 
     5908    for (l=1;l<=anzahlvariablen;l++)
    59095909    {
    59105910      for (k=1;k<=size(i);k++)
    59115911      {
    59125912        if (l!=1) // corresponds to  x_(l-1) --  note t is the last variable
    5913         {       
     5913        {
    59145914          i[k]=substitute(i[k],var(l-1),(zeroneu[l]+var(l-1))*t^(-w[l]));
    59155915        }
     
    59235923    for (l=1;l<=ncols(i);l++)
    59245924    {
    5925       if (wdegs[l]<0) // if wdegs[l]==0 there is no need to divide, 
     5925      if (wdegs[l]<0) // if wdegs[l]==0 there is no need to divide,
    59265926      { // and we made sure that it is no positive
    59275927        i[l]=i[l]/t^(-wdegs[l]);
     
    59295929    }
    59305930    // since we want to consider i now in the ring (Q[@a]/m)[t,x_1,...,x_n]
    5931     // we can  reduce i modulo m, so that "constant terms" 
     5931    // we can  reduce i modulo m, so that "constant terms"
    59325932    // which are "zero" since they
    59335933    // are in m will disappear; simplify(...,2) then really removes them;
     
    59365936    export(i);
    59375937    export(m);
    5938     export(zero);   
     5938    export(zero);
    59395939    extensionringlist[j]=EXTENSIONRING;
    59405940    kill EXTENSIONRING;
     
    59485948static proc ordermaximalideals (list minassi,int anzahlvariablen)
    59495949"USAGE:      ordermaximalideals(minassi); minassi list
    5950 ASSUME:      minassi is a list of maximal ideals (together with the information 
    5951              how many conjugates it has), where the first polynomial is the 
    5952              minimal polynomial of the last variable in the ring which is 
     5950ASSUME:      minassi is a list of maximal ideals (together with the information
     5951             how many conjugates it has), where the first polynomial is the
     5952             minimal polynomial of the last variable in the ring which is
    59535953             considered as a parameter
    5954 RETURN:      list, the procedure orders the maximal ideals in minassi according 
    5955                    to how many new variables are needed (namely none or one) to 
    5956                    describe the zeros of the ideal, and accordingly to the 
     5954RETURN:      list, the procedure orders the maximal ideals in minassi according
     5955                   to how many new variables are needed (namely none or one) to
     5956                   describe the zeros of the ideal, and accordingly to the
    59575957                   degree of the corresponding minimal polynomial
    59585958                   l[j][1] = the minimal polynomial for the jth maximal ideal
    5959                    l[j][2] = list, the k+1st entry is the kth coordinate of the 
    5960                                    zero described by the maximal ideal in terms 
     5959                   l[j][2] = list, the k+1st entry is the kth coordinate of the
     5960                                   zero described by the maximal ideal in terms
    59615961                                   of the last variable
    5962                    l[j][3] = poly, the replacement for the old variable @a 
     5962                   l[j][3] = poly, the replacement for the old variable @a
    59635963NOTE:        if a maximal ideal contains a variable, it is removed from the list;
    59645964             the procedure is called by findzerosAndBasictransform"
     
    59675967  int pruefer;       // is set one if a maximal ideal contains a variable
    59685968  list minassisort;  // will contain the output
    5969   for (j=1;j<=size(minassi);j++){minassisort[j]=0;} // initialise minassisort 
     5969  for (j=1;j<=size(minassi);j++){minassisort[j]=0;} // initialise minassisort
    59705970                                                    // to fix its initial length
    59715971  list zwischen;     // needed for reordering
    5972   list zero;         // (a_1,...,a_n)=(zero[2],...,zero[n+1]) will be 
     5972  list zero;         // (a_1,...,a_n)=(zero[2],...,zero[n+1]) will be
    59735973                     // a common zero of the ideal m
    59745974  poly nf;           // normalform of a variable w.r.t. m
    5975   poly minimalpolynomial;  // minimal polynomial for the field extension 
     5975  poly minimalpolynomial;  // minimal polynomial for the field extension
    59765976  poly parrep;  // the old variable @a possibly has to be replaced by a new one
    5977   // compute for each maximal ideal the number of new variables, which are 
    5978   // needed to describe its zeros -- note, a new variable is needed 
     5977  // compute for each maximal ideal the number of new variables, which are
     5978  // needed to describe its zeros -- note, a new variable is needed
    59795979  // if the first entry of minassi[j][1] is not the last variable
    5980   // store the value a variable reduces to in the list a; 
     5980  // store the value a variable reduces to in the list a;
    59815981  for (j=size(minassi);j>=1;j--)
    59825982  {
     
    59865986      minimalpolynomial=0;
    59875987    }
    5988     zero[1]=poly(0);         // the first entry in zero and in 
     5988    zero[1]=poly(0);         // the first entry in zero and in
    59895989                             // neuevariablen corresponds to the variable t,
    59905990    minassi[j][1]=std(minassi[j][1]);
     
    59925992    {
    59935993      // zero_k+1 is the normal form of the kth variable modulo m
    5994       zero[k+1]=reduce(var(k),minassi[j][1]); 
    5995       // if a variable reduces to zero, then the maximal 
     5994      zero[k+1]=reduce(var(k),minassi[j][1]);
     5995      // if a variable reduces to zero, then the maximal
    59965996      // ideal contains a variable and we can delete it
    59975997      if (zero[k+1]==0)
     
    60006000      }
    60016001    }
    6002     // if anzahlvariablen<nvars(basering), then the old ring 
     6002    // if anzahlvariablen<nvars(basering), then the old ring
    60036003    // had already an additional variable;
    60046004    // the old parameter @a then has to be replaced by parrep
     
    60096009    // if the maximal ideal contains a variable, we simply delete it
    60106010    if (pruefer==0)
    6011     {     
     6011    {
    60126012      minassisort[j]=list(minimalpolynomial,zero,parrep);
    60136013    }
    6014     // otherwise we store the information on a, neuevariablen 
     6014    // otherwise we store the information on a, neuevariablen
    60156015    // and neuvar together with the ideal
    60166016    else
     
    60216021    }
    60226022  }
    6023   // sort the maximal ideals ascendingly according to the 
     6023  // sort the maximal ideals ascendingly according to the
    60246024  // number of new variables needed to
    60256025  // express the zero of the maximal ideal
     
    60286028    l=j;
    60296029    for (k=j-1;k>=1;k--)
    6030     {     
     6030    {
    60316031      if (deg(minassisort[l][1])<deg(minassisort[k][1]))
    60326032      {
     
    60636063static proc verticesTropicalCurve (def tp,list #)
    60646064"USAGE:      verticesTropicalCurve(tp[,#]); tp list, # optional list
    6065 ASSUME:      tp is represents an ideal in Z[x,y] representing a tropical 
     6065ASSUME:      tp is represents an ideal in Z[x,y] representing a tropical
    60666066             polynomial (in the form of the output of the procedure tropicalise)
    60676067             defining a tropical plane curve
    6068 RETURN:      list, each entry corresponds to a vertex in the tropical plane 
     6068RETURN:      list, each entry corresponds to a vertex in the tropical plane
    60696069                   curve defined by tp
    60706070                   l[i][1] = x-coordinate of the ith vertex
    60716071                   l[i][2] = y-coordinate of the ith vertex
    6072                    l[i][3] = a polynomial whose monimials mark the vertices in 
    6073                              the Newton polygon corresponding to the entries in 
     6072                   l[i][3] = a polynomial whose monimials mark the vertices in
     6073                             the Newton polygon corresponding to the entries in
    60746074                             tp which take the common minimum at the ith vertex
    60756075NOTE:      - the information in l[i][3] represents the subdivision of the Newton
    6076              polygon of tp (respectively a polynomial which defines tp); 
    6077            - if # is non-empty and #[1] is the string 'max', then in the 
    6078              computations minimum and maximum are exchanged; 
    6079            - if # is non-empty and the #[1] is not a string, only the vertices 
     6076             polygon of tp (respectively a polynomial which defines tp);
     6077           - if # is non-empty and #[1] is the string 'max', then in the
     6078             computations minimum and maximum are exchanged;
     6079           - if # is non-empty and the #[1] is not a string, only the vertices
    60806080             will be computed and the information on the Newton subdivision will
    60816081             be omitted;
    6082            - here the tropical polynomial is supposed to be the MINIMUM of the 
    6083              linear forms in tp, unless the optional input #[1] is the 
     6082           - here the tropical polynomial is supposed to be the MINIMUM of the
     6083             linear forms in tp, unless the optional input #[1] is the
    60846084             string 'max'
    6085            - the procedure is called from tropicalCurve and from 
     6085           - the procedure is called from tropicalCurve and from
    60866086             conicWithTangents"
    60876087{
    6088   // if you insert a single polynomial instead of an ideal representing 
     6088  // if you insert a single polynomial instead of an ideal representing
    60896089  // a tropicalised polynomial,
    6090   // then we compute first the tropicalisation of this polynomial 
     6090  // then we compute first the tropicalisation of this polynomial
    60916091  // -- this feature is not documented in the above help string
    60926092  if (typeof(tp)=="poly")
     
    60976097  }
    60986098  int i,j,k,l,z; // indices
    6099   // make sure that no constant entry of tp has type int since that 
     6099  // make sure that no constant entry of tp has type int since that
    61006100  // would lead to trouble
    61016101  // when using the procedure substitute
     
    61156115  int e=1;
    61166116  option(redSB);
    6117   // for each triple (i,j,k) of entries in tp check if they have a 
    6118   // point in common and if they attain at this point the minimal 
     6117  // for each triple (i,j,k) of entries in tp check if they have a
     6118  // point in common and if they attain at this point the minimal
    61196119  // possible value for all linear forms in tp
    61206120  for (i=1;i<=size(tp)-2;i++)
     
    61696169            e++;
    61706170          }
    6171         }         
     6171        }
    61726172      }
    61736173    }
     
    61926192static proc bunchOfLines (def tp,list #)
    61936193"USAGE:      bunchOfLines(tp[,#]); tp list, # optional list
    6194 ASSUME:      tp is represents an ideal in Q[x,y] representing a tropical 
     6194ASSUME:      tp is represents an ideal in Q[x,y] representing a tropical
    61956195             polynomial (in the form of the output of the procedure tropicalise)
    61966196             defining a bunch of ordinary lines in the plane,
    61976197             i.e. the Newton polygone is a line segment
    6198 RETURN:      list, see the procedure tropicalCurve for an explanation of 
     6198RETURN:      list, see the procedure tropicalCurve for an explanation of
    61996199                   the syntax of this list
    6200 NOTE:      - the tropical curve defined by tp will consist of a bunch of 
    6201              parallel lines and throughout the procedure a list with the 
    6202              name bunchoflines is computed, which represents these lines and 
     6200NOTE:      - the tropical curve defined by tp will consist of a bunch of
     6201             parallel lines and throughout the procedure a list with the
     6202             name bunchoflines is computed, which represents these lines and
    62036203             has the following interpretation:
    6204              list, each entry corresponds to a vertex in the tropical plane 
     6204             list, each entry corresponds to a vertex in the tropical plane
    62056205                   curve defined by tp
    62066206                   l[i][1] = the equation of the ith line in the tropical curve
    6207                    l[i][2] = a polynomial whose monimials mark the vertices in 
    6208                              the Newton polygon corresponding to the entries in 
     6207                   l[i][2] = a polynomial whose monimials mark the vertices in
     6208                             the Newton polygon corresponding to the entries in
    62096209                             tp which take the common minimum at the ith vertex
    62106210           - the information in l[i][2] represents the subdivision of the Newton