Thomas Markwig tropical.lib
Contact
Research Interests
Curriculum Vitae
Publications
Teaching
Tropical Geometry Software
SFB-TRR 195
Links
tropical.lib is a SINGULAR library for certain computations concerned with tropical geometry. The library can be downloaded from

http://www.math.uni-tuebingen.de/~keilen/download/Tropical/tropical.lib

If you use the library in your scientific work and want to cite it, please do so as follows:

Anders Nedergaard Jensen, Hannah Markwig, Thomas Markwig: tropical.lib. A SINGULAR 3.0 library for computations in tropical geometry, 2007

In order to be able to use all procedures of this library you should download as well the library

http://www.math.uni-tuebingen.de/~keilen/download/Tropical/polymake.lib

Note, however, that only very few features from that library are used which do NOT invole computations by polymake or topcom. Moreover, if you want to use the procedure tropicalLifting the program gfan must be installed on your system, preferably in version 0.3.0 or higher.



On this web page you will find some information on procedures in the library tropical.lib.



Main procedures in tropical.lib

Procedures concerned with tropical lifting
tropicalLiftingcomputes a point in the tropical variety of ideal over intvec
displayTropicalLiftingdisplays the output of tropicalLifting
Procedures concerned with drawing tropical curves
drawTropicalCurveproduces a post script image of the tropical plane curve
drawNewtonSubdivisionproduces a post script image of the Newton subdivision a tropical plane curve
tropicalCurvecomputes a tropical plane curve and its Newton subdivision
Procedures conderned with j-invariants
tropicalJInvariantcomputes the tropical j-invariant of the tropical curve poly
weierstrassFormcomputes the Weierstrass form of an elliptic curve
jInvariantcomputes the j-invariant of an elliptic curve
General procedures
tropicalisecomputes the tropicalisation of the polynomial
tropicaliseSetcomputes the tropicalisation of all polynomials in input
tInitialFormcomputes the t-initialform of a polynomial
tInitialIdealcomputes the t-initial ideal of an ideal
initialFormcomputes the initialform of a polynomial
initialIdealcomputes the initial ideal of an ideal
Procedures concerned with the latex conversion
texNumberoutputs the texcommand for the leading coefficient of poly
texPolynomialoutputs the texcommand for the polynomial poly
texMatrixoutputs the texcommand for the matrix
texDrawBasicembeds the output of texdrawtropical in a texdraw environment
texDrawTropicalcomputes the texdraw commands for a tropical curve
texDrawNewtonSubdivisioncomputes the texdraw commands for a Newton subdivision
texDrawTriangulationcomputes the texdraw commands for a triangulation




How to use SINGULAR ?

First we want to give some general advise for users not familiar with SINGULAR , for more information see SINGULAR .
To start Singular, type the command Singular in a shell. Do this in the directory where your copy of the library tropical.lib resides. The program will start and give you some information on the version and the authors. Moreover, it will produce a prompt waiting for your commands.
To load the library type
LIB "tropical.lib";
at the prompt. Note, every command in Singular ends with a semicolon, and note that if you started SINGULAR in a directory different from the one where the library resides, then you have to add the path to the library name.
Basically all procedures in this library need polynomials as input. In order to have these at hand it is necessary do define the polynomial ring in which they life. This will in general either be Q[t,x1,...,xn], defined by the command (if n=5)
ring r=0,(t,x(1..5)),dp;
or Q(t)[x1,...,xn], defined by the command (if n=5)
ring r=(0,t),(x(1..5)),dp;
If you need a finite field of characteristic p instead, then replace 0 by the prime p. You can of course also choose other variable names than x(i) -- e.g. x,y,z.
You now can define a polynomial respectively an ideal by the commands
poly f=3*x(1)*x(2)^3-t*x(5);
respectively
ideal i=f,x(2)-t*f,x(3)^4-t^3;
Every object in SINGULAR has its own type and this type has to be specified when defining the object. Besides the types ring, poly, and ideal there are three more types which are needed for this library, namely list defining a list of object of possibly different types, int defining an integer, and intvec defining a vector of integers.
Example:
> LIB "tropical.lib";
> ring r=0,(t,x),dp;
> ideal i=(1+t2)*x2+t5x+t2;
> intvec w=1,-1;
> list L=tropicalLifting(i,w,4,"oldGfan");
> displayTropicalLifting(L,"subst");
You can invoke the SINGULAR help on the library by the command
help tropical.lib;
This will give you a list of all procedures available in the library with a very short description on what they are supposed to do. If you want information on a particular procedure, e.g. on tropicalLifting, type
help tropicalLifting;
The help will be displayed in the shell window which you are running. Instead you can open the library in a text editor and search for proc tropicalLifting. There you will find the same help string at the very beginning of the library. If you need help on general SINGULAR commands or features (e.g. on ideal), just type
help ideal;
The help should then in general be displayed in a web browser. If this does not work for some reason, then simply go the SINGULAR web page and look in the online manual.




Details on some procedures

We now want to describe some of the procedures from tropical.lib in more detail.

1) tropicalLifting

Warning: The procedure tropicalLifting requires the computer algebra system SINGULAR to be installed on your computer (which is rather obvious), but it also requires the program gfan to be present. Moreover, if your version of gfan is less than 0.3.0, then the procedure MUST be called with the option gfanOld - see below for details on options. If you have SINGULAR version 3-0-2 or less it might be advisable to get a new version of the libraries primdec.lib and absfact.lib from the SINGULAR home page, since some errors have been repaired recently - if you have problems with this please send an email to keilen@math.uni-tuebingen.de.
Short: The procedure tropicalLifting can be used to lift a point in a tropical variety of an ideal to a point in the algebraic variety of the ideal up to a given order.
Long: Given polynomials f1,...,fk in the polynomial ring Q[t,x1,...,xn] we consider the ideal J generated by the polynomials in C{{t}}[x1,...,xn], the polynomial ring over the field of Puiseux series over the complex numbers. The tropical variety Trop(J) of J is defined to be the negative of the valuation of the points in the the algebraic variety V(J). Since the valuation of a point in C{{t}} is a rational number Trop(J) is a subset of Qn. Given a point w in Trop(J) the procedure computes a point p in V(J) such that val(p)=-w. Of course, since the components of p are Puiseux series, we can only compute them up to a given order.
Usage: The procedure needs as input an ideal J, an integer vector w representing the point in the tropical variety of J, and an integer ord specifying up how many terms of the point p in V(J) with val(p)=-w should be computed.
Since the point in the tropical variety that we want to lift will in general have rational components, we have to explain how to interprete it as an integer vector. Bring the components to a common denominator and insert this common denominator as first component. E.g. if you want to lift the point (1/2,-1/3) then your input w will be w=6,3,-2.
The procedure will produce an output of type list which should be stored for later use and which should best be displayed using the procedure displayTropicalLifting.
To find a suitable w in the tropical variety, use gfan.
Example: Let us give an example showing how this could be done in practise.
> LIB "tropical.lib";
> ring R=0,(t,x,y,z),dp;
> ideal i=-y2t4+x2,yt3+xz+y;
> intvec w=1,-2,0,2;
> list L=tropicalLifting(i,w,3);
> displayTropicalLifting(L,"subst");

In this example, the lifting is not a series but it is finite and exact, as the substitution result shows, and no fractional exponents are needed:
> The lifting of the point in the tropical variety lives in the ring
Q[[t]]
The lifting has the form:
x=(-1)*t^2
y=(1)
z=(1)*1/t^2 + (1)*t
Substituting the solution into the ideal gives:
i[1]=0
i[2]=0
Result: The result of the procedure should be the truncation, say p, of a point in the Puiseux series field. This, however, is a type which is not available in Singular. Moreover, even though the coefficients of our input were rational numbers the coefficients of p will lie in a field extension of Q.
This first of all forces us to create a new ring where the base field is a field extension of Q and which will, basically, contain p. The procedure produces a list (which in the above example was saved as L) and where the first entry is of type ring. You can access this ring (if you have to) by the following sequence of commands:
def LIFTRing=LIST[1]; setring LIFTRing; LIFT;
This has created a new ring with name LIFTRing, and in this ring lives the point p with name LIFT. It is of type ideal and the ith entry encodes the ith component of p. Since the components of p are Puieseux series which involve fractional exponents and possibly negative exponents (if w had positive entries). Both is not available in SINGULAR . We get around this problem by the second and third entry of the list L, which can be viewed by the command:
L[2];L[3];
L[2] is an integer, say N, and the variable t in LIFT should be replaced by t^(1/N); moreover, if the k+1st entry of L[3] is non-zero, then the kth component of LIFT has to be multiplied t^(-l[3][k]/l[3][1]) AFTER substituting t by t^1/N. Doing this we finally get p -- and this should convince you that it is preferable to use displayTropicalLifting for displaying the result, since it does the transformations for you.
Finally, there is a fourth entry L[4] in the list, which contains a list of strings as entry. The kth string displays the result of substituting p into the kth polynomial in the ideal J. This should give you a feeling if the procedure worked all right.
Options: You can call the procedure with a number of options which you can simply add as further arguments when calling the procedure. The options are as follows:
"isZeroDimensional" use option only if you know that the ideal is zero dimensional over C{{t}}, then the procedure the does not check this any more
"isPrime" use this option only if the ideal is prime over K(t)[x_1,...,x_n], then the procedure the does not check this any more; this is only important if your ideal is not zero dimensional, and it avoids a costly primary decomposition
"isInTrop" use this otpion only if (w_1/w_0,...,w_n/w_0) certainly is in the tropical variety then the procedure the does not check this any more
"oldGfan" use this option if your version of gfan is less than 0.3.0; you will then be asked for user interactive inputs during the computations
"findAll" use this option if your ideal is zero-dimensional over C{{t}} and you want to find all solutions lifting (w_1/w_0,...,w_n/w_0) rather than only one; if you use this output the result will be a list of lists and each of these lists is of the same format as a single output of tropicalLifting without this option; this option does NOT work if you use the option "noAbs"
"noAbs" the procedure uses absolute primary decomposition; with this option you avoid this, which is necessary if you use an old version of SINGULAR ; if you use this option the output is slightly different, and you should use help tropicalLifting; to find out about this
"noRestubst" use this option to avoid computing the resubstitution, which might be time consuming
An example of for the use of several of the above options is the command:
list L=tropicalLifting(i,w,3,"noAbs","isInTrop");
Remark: If you want to use other base fields than the rational numbers, like algebraic or transcendental extensions of Q, you have to simulate these by treating the parameters as variables with weight zero and possibly adding the relations of the parameters to the ideal J.
You can even use base fields of positive characteristic, like Z/pZ. However, since the Puiseux series field over the algebraic closure of Z/pZ is no longer algebraically closed, there is no guarantee that the algorithm will work - but if you are not too unlucky or if p is sufficiently large, it should work. This might speed up the computations considerable, since many standard basis computations are necessary, and the coefficient growth is a vital problem. However, if you work with positive characteristic then you MUST use the option "noAbs" since the absolute primary decomposition in SINGULAR works only in characteristic zero.
Reference: The theory and the algorithm are described in the paper: Anders Nedergaard Jensen, Hannah Markwig, Thomas Markwig: An Algorithm for Lifting Points in a Tropical Variety. Preprint (2007).





2) displayTropicalLifting

Aim: The procedure displayTropicalLifting can be used to display the result of tropicalLifting. It takes as input a list which MUST be the output of tropicalLifting.
Result: None, the procedure does only display something but it has no return value.
Example: Let us give an example showing how this could be done in practise.
> LIB "tropical.lib";
> ring S=0,(t,x),dp;
> ideal i=tx2-tx-1;
> intvec w=2,1;
> list L=tropicalLifting(i,w,3);
> displayTropicalLifting(L);

In this example, the lifting is not a series but it is finite and exact, as the substitution result shows, and no fractional exponents are needed:
> The lifting of the point in the tropical variety lives in the ring
Q[[t^(1/2)]]
The lifting has the form:
x=(1)*1/t^(1/2) + (1/2) + (1/8)*t^(1/2)
Option: The procedure can be called with the additional option "subst", in which case the result of the resubstitution of the lifting into the ideal is shown. See e.g. the example in tropicalLifting.





3) drawTropicalCurve

Aim: The procedure drawTropicalCurve produces a postscript file which displays the tropical f curve defined by a polynomial f in K{{t}}[x,y], i.e. the image of V(f) under the valuation map, and the corresponding Newton subdivision.
Note:
The input should be in the ring K(t)[x,y] where K is either Q or Z/pZ, e.g.
ring r=(0,t),(x,y),dp;
Unlike the procedure tropicalLifting this procedure uses the min convention for tropical varieties by default. If you prefer max images you should use the option "max" as FIRST option.
The procedure produces the files /tmp/tropicalcurveNUMBER.tex, /tmp/tropicalcurveNUMBER.dvi and /tmp/tropicalcurveNUMBER.ps, where NUMBER is a random four digit integer. Moreover it displays the tropical curve defined by f via kghostview. Thus the directory /tmp should be writable and the programme kghostview should be available on your system. If kghostview is not available, then the option "onlytexfile" should be used, and it MUST be the LAST argument.
Result: None, the procedure only produces latex and ps files, but it has no return value.
Example: Let us give an example showing how this could be done in practise.
> LIB "tropical.lib";
> ring r=(0,t),(x,y),dp;
> poly f=t*(x3+y3+1)+1/t*(x2+y2+x+y+x2y+xy2)+1/t2*xy;
> drawTropicalCurve(f);
> list F=0,1+3x,1+3y,-2/3+x+y;
> drawTropicalCurve(F);
> // use the option "max"
> drawTropicalCurve(F,"max");

Universität TübingenDept. of MathematicsSection AlgebraCAS SINGULAR SFB-TRR 195Alma