 LIB "tropical.lib";
ring r=(0,t),(x,y),dp;
// the input consists of a list of five points in the plane over Q(t)
list points=list(1/t2,t),list(1/t,t2),list(1,1),list(t,1/t2),list(t2,1/t);
list conic=conicWithTangents(points);
// conic[1] is the list of the given five points
conic[1];
// conic[2] is the equation of the conic f passing through the five points
conic[2];
// conic[3] is a list containing the equations of the tangents
// through the five points
conic[3];
// conic[4] is an ideal representing the tropicalisation of the conic f
conic[4];
// conic[5] is a list containing the tropicalisation
// of the five tangents in conic[3]
conic[5];
// conic[6] is a list containing the vertices of the tropical conic
conic[6];
// conic[7] is a list containing the vertices of the five tangents
conic[7];
// conic[8] contains the latex code to draw the tropical conic and
// its tropicalised tangents; it can written in a file, processed and
// displayed via kghostview
write(":w /tmp/conic.tex",conic[8]);
system("sh","cd /tmp; latex /tmp/conic.tex; dvips /tmp/conic.dvi o;
kghostview conic.ps &");
// with an optional argument the same information for the dual conic is computed
// and saved in conic[9]
conic=conicWithTangents(points,1);
conic[9][2]; // the equation of the dual conic
