# Singular

#### D.13.4.6 drawTropicalCurve

Procedure from library `tropical.lib` (see tropical_lib).

Usage:
drawTropicalCurve(f[,#]); f poly or list, # optional list

Assume:
f is list of linear polynomials of the form ax+by+c with integers a, b and a rational number c representing a tropical Laurent polynomial defining a tropical plane curve;
alternatively f can be a polynomial in Q(t)[x,y] defining a tropical plane curve via the valuation map;
the basering must have a global monomial ordering, two variables and up to one parameter!

Return:
NONE

Note:
- the procedure creates the files /tmp/tropicalcurveNUMBER.tex and /tmp/tropicalcurveNUMBER.ps, where NUMBER is a random four digit integer;
moreover it displays the tropical curve via kghostview; if you wish to remove all these files from /tmp,
call the procedure cleanTmp
- edges with multiplicity greater than one carry this multiplicity
- if # is empty, then the tropical curve is computed w.r.t. minimum, if #[1] is the string 'max', then it is computed w.r.t. maximum
- if the last optional argument is 'onlytexfile' then only the latex file is produced; this option should be used if kghostview is not installed on your system
- note that lattice points in the Newton subdivision which are black correspond to markings of the marked subdivision, while lattice points in grey are not marked

Example:
 ```LIB "tropical.lib"; ==> Welcome to polymake version ==> Copyright (c) 1997-2015 ==> Ewgenij Gawrilow, Michael Joswig (TU Darmstadt) ==> http://www.polymake.org ring r=(0,t),(x,y),dp; poly f=t*(x3+y3+1)+1/t*(x2+y2+x+y+x2y+xy2)+1/t2*xy; // the command drawTropicalCurve(f) computes the graph of the tropical curve // given by f and displays a post script image, provided you have kghostview drawTropicalCurve(f); ==> This is pdfTeX, Version 3.14159265-2.6-1.40.15 (TeX Live 2014) (preloaded\ format=latex) ==> restricted \write18 enabled. ==> entering extended mode ==> (/tmp/tropicalcurve6034.tex ==> LaTeX2e <2014/05/01> ==> Babel <3.9l> and hyphenation patterns for 2 languages loaded. ==> (/usr/share/texmf-dist/tex/latex/amscls/amsart.cls ==> Document Class: amsart 2009/07/02 v2.20.1 ==> (/usr/share/texmf-dist/tex/latex/amsmath/amsmath.sty ==> For additional information on amsmath, use the `?' option. ==> (/usr/share/texmf-dist/tex/latex/amsmath/amstext.sty ==> (/usr/share/texmf-dist/tex/latex/amsmath/amsgen.sty)) ==> (/usr/share/texmf-dist/tex/latex/amsmath/amsbsy.sty) ==> (/usr/share/texmf-dist/tex/latex/amsmath/amsopn.sty)) ==> (/usr/share/texmf-dist/tex/latex/amsfonts/umsa.fd) ==> (/usr/share/texmf-dist/tex/latex/amsfonts/amsfonts.sty)) ==> ==> ! LaTeX Error: File `texdraw.sty' not found. ==> ==> Type X to quit or to proceed, ==> or enter new name. (Default extension: sty) ==> ==> Enter file name: warning: kpathsea: \$.sty: Unrecognized variable construc\ t `\$.'. ==> ==> ! LaTeX Error: File `\$.sty' not found. ==> ==> Type X to quit or to proceed, ==> or enter new name. (Default extension: sty) ==> ==> Enter file name: ==> ! Emergency stop. ==> ==> ==> l.3 \setlength ==> {\topmargin}{30mm}^^M ==> No pages of output. ==> Transcript written on tropicalcurve6034.log. ==> This is dvips(k) 5.994 Copyright 2014 Radical Eye Software (www.radicaley\ e.com) ==> dvips: DVI file can't be opened: /tmp/tropicalcurve6034.dvi: No such file\ or directory ==> rm: das Entfernen von „tropicalcurve6034.aux“ ist nicht möglich: Dat\ ei oder Verzeichnis nicht gefunden ==> rm: das Entfernen von „tropicalcurve6034.ps?“ ist nicht möglich: Dat\ ei oder Verzeichnis nicht gefunden ==> rm: das Entfernen von „tropicalcurve6034.dvi“ ist nicht möglich: Dat\ ei oder Verzeichnis nicht gefunden ==> sh: kghostview: Kommando nicht gefunden. ==> 0 // we can instead apply the procedure to a tropical polynomial and use "maximum" poly g=1/t3*(x7+y7+1)+t3*(x4+y4+x2+y2+x3y+xy3)+t21*x2y2; list tropical_g=tropicalise(g); tropical_g; ==> [1]: ==> 7*x-3 ==> [2]: ==> 7*y-3 ==> [3]: ==> 4*x+3 ==> [4]: ==> 3*x+y+3 ==> [5]: ==> 2*x+2*y+21 ==> [6]: ==> x+3*y+3 ==> [7]: ==> 4*y+3 ==> [8]: ==> 2*x+3 ==> [9]: ==> 2*y+3 ==> [10]: ==> -3 drawTropicalCurve(tropical_g,"max"); ==> This is pdfTeX, Version 3.14159265-2.6-1.40.15 (TeX Live 2014) (preloaded\ format=latex) ==> restricted \write18 enabled. ==> entering extended mode ==> (/tmp/tropicalcurve9641.tex ==> LaTeX2e <2014/05/01> ==> Babel <3.9l> and hyphenation patterns for 2 languages loaded. ==> (/usr/share/texmf-dist/tex/latex/amscls/amsart.cls ==> Document Class: amsart 2009/07/02 v2.20.1 ==> (/usr/share/texmf-dist/tex/latex/amsmath/amsmath.sty ==> For additional information on amsmath, use the `?' option. ==> (/usr/share/texmf-dist/tex/latex/amsmath/amstext.sty ==> (/usr/share/texmf-dist/tex/latex/amsmath/amsgen.sty)) ==> (/usr/share/texmf-dist/tex/latex/amsmath/amsbsy.sty) ==> (/usr/share/texmf-dist/tex/latex/amsmath/amsopn.sty)) ==> (/usr/share/texmf-dist/tex/latex/amsfonts/umsa.fd) ==> (/usr/share/texmf-dist/tex/latex/amsfonts/amsfonts.sty)) ==> ==> ! LaTeX Error: File `texdraw.sty' not found. ==> ==> Type X to quit or to proceed, ==> or enter new name. (Default extension: sty) ==> ==> Enter file name: ==> ! Emergency stop. ==> ==> ==> l.3 \setlength ==> {\topmargin}{30mm}^^M ==> No pages of output. ==> Transcript written on tropicalcurve9641.log. ==> This is dvips(k) 5.994 Copyright 2014 Radical Eye Software (www.radicaley\ e.com) ==> dvips: DVI file can't be opened: /tmp/tropicalcurve9641.dvi: No such file\ or directory ==> rm: das Entfernen von „tropicalcurve9641.aux“ ist nicht möglich: Dat\ ei oder Verzeichnis nicht gefunden ==> rm: das Entfernen von „tropicalcurve9641.ps?“ ist nicht möglich: Dat\ ei oder Verzeichnis nicht gefunden ==> rm: das Entfernen von „tropicalcurve9641.dvi“ ist nicht möglich: Dat\ ei oder Verzeichnis nicht gefunden ==> sh: kghostview: Kommando nicht gefunden. ==> 0 ==> > fgets() failed with errno 9 ```