{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "Switch to the application for tropical geometry." ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [], "source": [ "application \"tropical\";" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Tropical arithmetic, with minimum as the addition." ] }, { "cell_type": "code", "execution_count": 3, "metadata": {}, "outputs": [], "source": [ "$x=new TropicalNumber(3);\n", "$y=new TropicalNumber(5);" ] }, { "cell_type": "code", "execution_count": 4, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "3" ] }, "execution_count": 4, "metadata": {}, "output_type": "execute_result" } ], "source": [ "print $x+$y;" ] }, { "cell_type": "code", "execution_count": 5, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "8" ] }, "execution_count": 5, "metadata": {}, "output_type": "execute_result" } ], "source": [ "print $x*$y;" ] }, { "cell_type": "code", "execution_count": 6, "metadata": {}, "outputs": [], "source": [ "$M=new Matrix>([[$x,new TropicalNumber(13)],[$y,$x+$y]]);" ] }, { "cell_type": "code", "execution_count": 7, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "6 16\n", "8 6\n" ] }, "execution_count": 7, "metadata": {}, "output_type": "execute_result" } ], "source": [ "print $M*$M;" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "The tropical determinant is the same as minimum weight bipartite matching." ] }, { "cell_type": "code", "execution_count": 8, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "6" ] }, "execution_count": 8, "metadata": {}, "output_type": "execute_result" } ], "source": [ "print tdet($M);" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Bellman-Ford for all-pairs shortest paths in tropical disguise." ] }, { "cell_type": "code", "execution_count": 9, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "0 2 3\n", "1 0 4\n", "1 0 0\n", "0 2 3\n", "1 0 4\n", "1 0 0\n" ] }, "execution_count": 9, "metadata": {}, "output_type": "execute_result" } ], "source": [ "$A = new Matrix>( [[1,2,3],[1,2,4],[1,0,1]]);\n", "$I = new Matrix>( [[0,\"inf\",\"inf\"],[\"inf\",0,\"inf\"],[\"inf\",\"inf\",0]]);\n", "print $I + $A;\n", "print $I + $A + $A*$A;" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "A tropical cubic surface." ] }, { "cell_type": "code", "execution_count": 10, "metadata": {}, "outputs": [ { "data": { "text/html": [ "\n", "\n", "\n", "\n", " \n", " V\n", " \n", " \n", "\n", "\n", "\n", "\t\t
\n", "\t\t\t
\n", "\t\t\t\tExplode\n", "\t\t\t\t\n", "\t\t\t\t
Automatic explosion
\n", "\t\t\t\t
Exploding speed
\n", "\t\t\t\t\n", "\t\t\t
\n", "\n", "\t\t\t\n", "\t\t\t
\n", "\t\t\t\tTransparency\n", "\t\t\t\t\n", "\t\t\t
\n", "\t\t\t\n", "\t\t\t
\n", "\t\t\t\tRotation\n", "\t\t\t\t
\n", "\t\t\t\t\t
x-axis
\n", "\t\t\t\t\t
y-axis
\n", "\t\t\t\t\t
z-axis
\n", "\t\t\t\t\t\n", "\t\t\t\t
\n", "\n", "\t\t\t\t
Rotation speed
\n", "\t\t\t\t\n", "\n", "\t\t\t
\n", "\n", "\n", "\t\t\t
\n", "\t\t\t\tDisplay\n", "\t\t\t\t
\n", "\t\t\t\t\t
\n", "\t\t\t\t\t
Labels
\n", "\t\t\t\t
\n", "\t\t\t
\n", "\n", "\n", "\t\t\t
\n", "\t\t\t\tSVG\n", "\t\t\t\t
\n", "\t\t\t\t\t
\n", "\t\t\t\t\t\t Download
\n", "\t\t\t\t\t\t New tab
\n", "\t\t\t\t\t
\n", "\t\t\t\t\t\n", "\t\t\t\t
\n", "\t\t\t
\n", "\n", "\t\t
\t\n", "\t\t\n", "\t\t\n", "
\n", "\n", "\n", "\n", "\n", "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "
Click here for additional output
\n", "
\n",
       "polymake: used package atint\n",
       "  a-tint is an extension for tropical intersection theory.\n",
       "  (C) 2011 - 2015 Simon Hampe, simon.hampe@googlemail.com\n",
       "  See also: https://github.com/simonhampe/atint \n",
       "polymake: used package lrs\n",
       "  Implementation of the reverse search algorithm of Avis and Fukuda.\n",
       "  Copyright by David Avis.\n",
       "  http://cgm.cs.mcgill.ca/~avis/C/lrs.html\n",
       "\n",
       "polymake: used package cdd\n",
       "  cddlib\n",
       "  Implementation of the double description method of Motzkin et al.\n",
       "  Copyright by Komei Fukuda.\n",
       "  http://www-oldurls.inf.ethz.ch/personal/fukudak/cdd_home/\n",
       "\n",
       "polymake: used package threejs\n",
       "   Three.js is a lightweight cross-browser JavaScript library/API used to create and display animated 3D computer graphics on a Web browser.\n",
       "   See http://github.com/mrdoob for the source code.\n",
       "\n",
       "
\n", "
\n" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "$F = toTropicalPolynomial(\"min(12+3*x0,-131+2*x0+x1, -67+2*x0+x2,-9+2*x0+x3,-131+x0+2*x1,-129+x0+x1+x2, -131+x0+x1+x3,-116+x0+2*x2,-76+x0+x2+x3,-24+x0+2*x3,-95+3*x1, -108+2*x1+x2,-92+2*x1+x3,-115+x1+2*x2,-117+x1+x2+x3, -83+x1+2*x3,-119+3*x2,-119+2*x2+x3,-82+x2+2*x3,-36+3*x3)\");\n", "$V = new Hypersurface(POLYNOMIAL=>$F);\n", "$V->VISUAL;" ] }, { "cell_type": "code", "execution_count": 11, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "3 27" ] }, "execution_count": 11, "metadata": {}, "output_type": "execute_result" } ], "source": [ "print $V->DEGREE, \" \",$V->dual_subdivision()->N_MAXIMAL_CELLS;" ] } ], "metadata": { "kernelspec": { "display_name": "polymake", "language": "polymake", "name": "polymake" }, "language_info": { "codemirror_mode": "perl", "file_extension": ".pl", "mimetype": "text/x-polymake", "name": "polymake" } }, "nbformat": 4, "nbformat_minor": 2 }