{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# If you have not used polymake in a long time...\n",
    "\n",
    "...you might want to read up on some things that are important for backward compatibility.\n",
    "\n",
    "### Numbers\n",
    "\n",
    "`polymake` always was a hybrid system written half in C++, half in Perl, but it is only now that the user can directly take advantage of C++ data types and interfaces in Perl.  For instance, via the interface to [GMP](https://gmplib.org/) `polymake` can also become your favorite programmable pocket calculator:\n",
    "\n",
    "    \n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [],
   "source": [
    "$f = new Integer(1);"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "    \n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [],
   "source": [
    "for (my $i = new Integer(100); $i>0; --$i) { $f *= $i; }"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "    \n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "93326215443944152681699238856266700490715968264381621468592963895217599993229915608941463976156518286253697920827223758251185210916864000000000000000000000000"
      ]
     },
     "execution_count": 3,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "print $f;"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "\n",
    "The input of large integer and rational numbers was kind of subtle in the past, but now it has become quite intuitive:\n",
    "\n",
    "    \n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [],
   "source": [
    "$bignum=93326215443944152681699238856266700490715968264381621468592963895217599993229915608941463976156518286253697920827223758251185210916864000000000000000000000000;"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "    \n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "93326215443944152681699238856266700490715968264381621468592963895217599993229915608941463976156518286253697920827223758251185210916864000000000000000000000000"
      ]
     },
     "execution_count": 5,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "print $bignum;"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [],
   "source": [
    "$ratnum=123456/789012;"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "    \n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "10288/65751"
      ]
     },
     "execution_count": 7,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "print $ratnum;"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "\n",
    "Each integer constant being too large to fit into a normal perl scalar value is automatically converted to an `Integer` object; each fraction of two integer constants is automatically converted to a `Rational` object (and canonicalized, as can be seen in the example above).\n",
    "\n",
    "### Command line\n",
    "\n",
    "With early polymake versions, you had to issue a separate polymake command from shell command line for every single step.  Starting with version 3.0, this way of working has been deprecated in favor of a much more comfortable and powerful interactive shell.  In the version 4.0, the support for old command line mode has been dropped completely.\n",
    "\n",
    "If necessary, you can resemble the old behavior using one-line scripts like the following ones:\n",
    "\n",
    "Instead of \"`cube c3.poly 3`\", run:\n",
    "    \n",
    "    polymake 'save(cube(3),\"c3.poly\");'\n",
    "    \n",
    "\n",
    "Instead of \"`polymake c3.poly N_VERTICES N_FACETS`\", run:\n",
    "    \n",
    "    polymake 'my $c=load(\"c3.poly\"); print \"N_VERTICES\\n\", $c->N_VERTICES, \"\\n\\nN_FACETS\\n\", $c->N_FACETS, \"\\n\";'\n",
    "Please keep in mind that this would be a rather uneconomic way of using polymake, since loading applications and rules every time causes a sizeable delay.\n",
    "    \n",
    "\n",
    "### Stored files\n",
    "\n",
    "polymake understands data files both in ancient plain ASCII format and in XML produced by 3.x releases.\n",
    "Upon loading, the data will be transformed to the current model and eventually stored in JSON format.\n",
    "You won't be able to use any old version of polymake with these files later.\n",
    "\n",
    "A word of warning: It was rarely legal but always popular to edit files that `polymake` worked on with an ASCII text processor.  This is still possible (if you know what you are doing), but in addition to the caveats previously in place (which are still valid) you have to pay attention to producing valid JSON.\n"
   ]
  }
 ],
 "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
}
