user_guide:tutorials:polynomials_tutorial

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

This is an old revision of the document!


The following will be available starting from version 2.9.8.

A polynomial always carries a reference to a polynomial ring. Polynomial in different rings cannot be added, multiplied, or whatever. The names of the indeterminates are relevant for the output functions only.

$r=new Ring(qw(x y));

It may be convenient to use special variable names for the indeterminates.

polytope> ($x,$y)=$r->variables;

Notice that the variable names are chosen to match the print names; but this is “coincidental”.

polytope> $p=1+$x+$y;
polytope> $q=1+$x+$y+$x*$y;
polytope> print($p*$q);
1 + 2*x + x^2 + 2*y + 3*x*y + y^2 + x^2*y + x*y^2

Standard arithmetic function “+”, “-”, “*”, “^” are defined. However, due to the fact that their precedence is given in perl it may be necessary to write more parentheses than expected at first sight.

Here is one way to produce polytopes from polynomials (as the convex hull of the exponent vectors of all terms).

polytope> $npq=newton($p*$q);
polytope> print $npq->VERTICES;
1 0 0
1 2 0
1 0 2
1 2 1
1 1 2
polytope> print equal_polyhedra($npq, minkowski_sum(newton($p),newton($q)));
1

The final “1” means “true”: The Newton polytope of the product of two polynomials always equals the Minkowski sum of the Newton polytopes of the factors.

  • user_guide/tutorials/polynomials_tutorial.1265625698.txt.gz
  • Last modified: 2014/01/03 15:45
  • (external edit)