This tutorial is probably also available as a Jupyter notebook in the demo folder in the polymake source and on github.

Different versions of this tutorial: latest release, release 4.12, release 4.11, release 4.10, release 4.9, release 4.8, release 4.7, release 4.6, release 4.5, release 4.4, release 4.3, release 4.2, release 4.1, release 4.0, release 3.6, nightly master

If you have not used polymake in a long time...

…you might want to read up on some things that are important for backward compatibility.

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 polymake can also become your favorite programmable pocket calculator:

> $f = new Integer(1);
> for (my $i = new Integer(100); $i>0; --$i) { $f *= $i; }
> print $f;

The input of large integer and rational numbers was kind of subtle in the past, but now it has become quite intuitive:

> $bignum=93326215443944152681699238856266700490715968264381621468592963895217599993229915608941463976156518286253697920827223758251185210916864000000000000000000000000;
> print $bignum;
> $ratnum=123456/789012;
> print $ratnum;

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).

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.

If necessary, you can resemble the old behavior using one-line scripts like the following ones:

Instead of “cube c3.poly 3”, run:

polymake 'save(cube(3),"c3.poly");'

Instead of “polymake c3.poly N_VERTICES N_FACETS”, run:

polymake 'my $c=load("c3.poly"); print "N_VERTICES\n", $c->N_VERTICES, "\n\nN_FACETS\n", $c->N_FACETS, "\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.

polymake understands data files both in ancient plain ASCII format and in XML produced by 3.x releases. Upon loading, the data will be transformed to the current model and eventually stored in JSON format. You won't be able to use any old version of polymake with these files later.

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.

  • user_guide/tutorials/legacy.txt
  • Last modified: 2019/02/11 16:42
  • by oroehrig