user_guide:tutorials:latest:legacy

# Differences

This shows you the differences between two versions of the page.

 — user_guide:tutorials:latest:legacy [2020/02/29 03:10] (current) Line 1: Line 1: + ====== 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. + + ==== Numbers ==== + + ''​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 [[http://​www.swox.com/​gmp/​|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; + 93326215443944152681699238856266700490715968264381621468592963895217599993229915608941463976156518286253697920827223758251185210916864000000000000000000000000 + + ​ + 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; + 93326215443944152681699238856266700490715968264381621468592963895217599993229915608941463976156518286253697920827223758251185210916864000000000000000000000000 + ​ + >$ratnum=123456/​789012;​ + > print $ratnum; + 10288/65751 + ​ + ​ + 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). + + ==== Command line ==== + + 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: + + <​code>​ + polymake '​save(cube(3),"​c3.poly"​);'​ + ​ + Instead of "''​polymake c3.poly N_VERTICES N_FACETS''",​ run: + + <​code>​ + 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. + + ==== Stored files ==== + + 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/latest/legacy.txt